void Type::objectVariableRecords(int index, std::vector<T> *information, Us... args) const { switch (type()) { case TypeType::ValueType: { if (storageType() == StorageType::Box) { information->push_back(T(index, ObjectVariableType::Box, args...)); return; } auto optional = storageType() == StorageType::SimpleOptional; auto size = information->size(); for (auto variable : valueType()->instanceScope().map()) { // TODO: auto vindex = index + variable.second.id() + (optional ? 1 : 0); // variable.second.type().objectVariableRecords(vindex, information, args...); } if (optional) { auto info = T(static_cast<unsigned int>(information->size() - size), index, ObjectVariableType::ConditionalSkip, args...); information->insert(information->begin() + size, info); } return; } case TypeType::Class: case TypeType::Someobject: case TypeType::Callable: case TypeType::Protocol: case TypeType::MultiProtocol: case TypeType::Something: case TypeType::GenericVariable: case TypeType::LocalGenericVariable: case TypeType::Error: // Is or may be an object pointer switch (storageType()) { case StorageType::SimpleOptional: information->push_back(T(index + 1, index, ObjectVariableType::Condition, args...)); return; case StorageType::Simple: information->push_back(T(index, ObjectVariableType::Simple, args...)); return; case StorageType::Box: information->push_back(T(index, ObjectVariableType::Box, args...)); return; default: throw std::domain_error("invalid storage type"); } case TypeType::Enum: case TypeType::NoReturn: case TypeType::StorageExpectation: case TypeType::Extension: return; // Can't be object pointer } }
void StorageAreaMap::dispatchLocalStorageEvent(uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString) { ASSERT(storageType() == LocalStorage); Vector<RefPtr<Frame>> frames; PageGroup& pageGroup = *WebProcess::singleton().webPageGroup(m_storageNamespaceID)->corePageGroup(); const HashSet<Page*>& pages = pageGroup.pages(); for (HashSet<Page*>::const_iterator it = pages.begin(), end = pages.end(); it != end; ++it) { for (Frame* frame = &(*it)->mainFrame(); frame; frame = frame->tree().traverseNext()) { Document* document = frame->document(); if (!document->securityOrigin()->equal(m_securityOrigin.ptr())) continue; Storage* storage = document->domWindow()->optionalLocalStorage(); if (!storage) continue; StorageAreaImpl& storageArea = static_cast<StorageAreaImpl&>(storage->area()); if (storageArea.storageAreaID() == sourceStorageAreaID) { // This is the storage area that caused the event to be dispatched. continue; } frames.append(frame); } } StorageEventDispatcher::dispatchLocalStorageEventsToFrames(pageGroup, frames, key, oldValue, newValue, urlString, m_securityOrigin.ptr()); }
void StorageAreaMap::dispatchSessionStorageEvent(uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString) { ASSERT(storageType() == SessionStorage); // Namespace IDs for session storage namespaces are equivalent to web page IDs // so we can get the right page here. WebPage* webPage = WebProcess::singleton().webPage(m_storageNamespaceID); if (!webPage) return; Vector<RefPtr<Frame>> frames; Page* page = webPage->corePage(); for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext()) { Document* document = frame->document(); if (!document->securityOrigin()->equal(m_securityOrigin.ptr())) continue; Storage* storage = document->domWindow()->optionalSessionStorage(); if (!storage) continue; StorageAreaImpl& storageArea = static_cast<StorageAreaImpl&>(storage->area()); if (storageArea.storageAreaID() == sourceStorageAreaID) { // This is the storage area that caused the event to be dispatched. continue; } frames.append(frame); } StorageEventDispatcher::dispatchLocalStorageEventsToFrames(page->group(), frames, key, oldValue, newValue, urlString, m_securityOrigin.ptr()); }
int Type::size() const { int basesize = 0; switch (storageType()) { case StorageType::SimpleOptional: basesize = 1; case StorageType::Simple: switch (type()) { case TypeType::ValueType: case TypeType::Enum: return basesize + typeDefinition()->size(); case TypeType::Callable: case TypeType::Class: case TypeType::Someobject: return basesize + 1; case TypeType::Error: if (genericArguments()[1].storageType() == StorageType::SimpleOptional) { return std::max(2, genericArguments()[1].size()); } return std::max(1, genericArguments()[1].size()) + basesize; case TypeType::NoReturn: return 0; default: throw std::logic_error("Type is wrongly simply stored"); } case StorageType::Box: return 4; default: throw std::logic_error("Type has invalid storage type"); } }
/// Returns the storage type to which the value of the given type should be unboxed, if the destination expects /// the most unboxed value as indicated by a storage type of @c StorageType::SimpleIfPossible. /// @returns The storage type to which the value can be unboxed or the original storage type if the value should /// not be unboxed. StorageType simplifyType(const Type& type) const { if (expectationMode_ == ExpectationMode::Simplify) { if (type.requiresBox()) { return StorageType::Box; } return type.optional() ? StorageType::SimpleOptional : StorageType::Simple; } return storageType(); }
bool StorageAreaProxy::disabledByPrivateBrowsingInFrame(const Frame* sourceFrame) const { if (!sourceFrame->page()->settings()->privateBrowsingEnabled()) return false; if (storageType() != LocalStorage) return true; return !SchemeRegistry::allowsLocalStorageAccessInPrivateBrowsing(sourceFrame->document()->securityOrigin()->protocol()); }
void StorageAreaMap::dispatchStorageEvent(uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString) { if (!sourceStorageAreaID) { // This storage event originates from another process so we need to apply the change to our storage area map. applyChange(key, newValue); } if (storageType() == SessionStorage) dispatchSessionStorageEvent(sourceStorageAreaID, key, oldValue, newValue, urlString); else dispatchLocalStorageEvent(sourceStorageAreaID, key, oldValue, newValue, urlString); }
bool Type::isReferencable() const { switch (type()) { case TypeType::Callable: case TypeType::Class: case TypeType::Someobject: case TypeType::GenericVariable: case TypeType::LocalGenericVariable: return storageType() != StorageType::Simple; case TypeType::NoReturn: return false; case TypeType::ValueType: case TypeType::Enum: case TypeType::Protocol: case TypeType::MultiProtocol: case TypeType::Something: case TypeType::Error: return true; case TypeType::StorageExpectation: case TypeType::Extension: throw std::logic_error("isReferenceWorthy for StorageExpectation/Extension"); } }
bool UIWizardExportAppPageExpert::isComplete() const { /* Initial result: */ bool fResult = true; /* There should be at least one vm selected: */ if (fResult) fResult = (m_pVMSelector->selectedItems().size() > 0); /* Check storage-type attributes: */ if (fResult) { const QString &strFile = m_pFileSelector->path().toLower(); fResult = VBoxGlobal::hasAllowedExtension(strFile, OVFFileExts); if (fResult) { StorageType st = storageType(); switch (st) { case Filesystem: break; case SunCloud: fResult &= !m_pUsernameEditor->text().isEmpty() && !m_pPasswordEditor->text().isEmpty() && !m_pBucketEditor->text().isEmpty(); break; case S3: fResult &= !m_pUsernameEditor->text().isEmpty() && !m_pPasswordEditor->text().isEmpty() && !m_pHostnameEditor->text().isEmpty() && !m_pBucketEditor->text().isEmpty(); break; } } } /* Return result: */ return fResult; }
/** Set the storage description (volume name) of the drive in the storage info data set */ void CMTPGetStorageInfo::SetStorageDescriptionL() { OstTraceFunctionEntry0( CMTPGETSTORAGEINFO_SETSTORAGEDESCRIPTIONL_ENTRY ); TUint32 storage(Request().Uint32(TMTPTypeRequest::ERequestParameter1)); TInt driveNumber = iFramework.StorageMgr().DriveNumber(storage); OstTrace1( TRACE_NORMAL, CMTPGETSTORAGEINFO_SETSTORAGEDESCRIPTIONL, "driveNumber:%d", driveNumber); CMTPTypeString* mtpDescription = CMTPTypeString::NewLC(); //Firstly, read name from VolumeInfo if (0 < iVolumeInfo.iName.Length()) { OstTraceExt1( TRACE_NORMAL, DUP1_CMTPGETSTORAGEINFO_SETSTORAGEDESCRIPTIONL, "Using standard volume name:%S", iVolumeInfo.iName); mtpDescription->SetL(iVolumeInfo.iName); } else //If name not set, set name according to type { TMTPTypeUint16 storageType(EMTPStorageUndefined); iStorageInfo->GetL(CMTPTypeStorageInfo::EStorageType,storageType); OstTrace1( TRACE_NORMAL, DUP2_CMTPGETSTORAGEINFO_SETSTORAGEDESCRIPTIONL, "Set name according to storage type: %d",storageType.Value() ); switch (storageType.Value()) { case EMTPStorageFixedROM: if (driveNumber == EDriveC)//Phone Memory { OstTrace0( TRACE_NORMAL, DUP3_CMTPGETSTORAGEINFO_SETSTORAGEDESCRIPTIONL, "drive c" ); mtpDescription->SetL(KPhoneMemory); } break; case EMTPStorageRemovableROM: break; case EMTPStorageFixedRAM: // Mass Memory mtpDescription->SetL(KMassMemory); break; case EMTPStorageRemovableRAM: // Memory Card mtpDescription->SetL(KMemoryCard); break; case EMTPStorageUndefined: default: break; } //Finally, it the name still not set, use default value: //eg, 'A drive' if(mtpDescription->NumChars() == 0) { TChar driveChar; TInt err = iFramework.Fs().DriveToChar(driveNumber,driveChar); OstTraceExt2( TRACE_NORMAL, DUP4_CMTPGETSTORAGEINFO_SETSTORAGEDESCRIPTIONL, "Use default name,driveNumber:%d err:%d",driveNumber,err ); if (err == KErrNone) { TBuf<sizeof(KDefaultName) + 1> driveName; driveName.Append(driveChar); driveName.Append(KDefaultName); mtpDescription->SetL(driveName); } else { mtpDescription->SetL(KNoName); } } } iStorageInfo->SetL(CMTPTypeStorageInfo::EStorageDescription,*mtpDescription); CleanupStack::PopAndDestroy(mtpDescription); OstTraceFunctionExit0( CMTPGETSTORAGEINFO_SETSTORAGEDESCRIPTIONL_EXIT ); }