void ArgumentCoder<DatabaseDetails>::encode(ArgumentEncoder& encoder, const DatabaseDetails& details) { encoder << details.name(); encoder << details.displayName(); encoder << details.expectedUsage(); encoder << details.currentUsage(); }
/*! Returns the current size of the database in bytes. */ qint64 QWebDatabase::size() const { #if ENABLE(DATABASE) DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(d->name, d->origin.get()); return details.currentUsage(); #else return 0; #endif }
void ChromeClientEfl::exceededDatabaseQuota(Frame* frame, const String& databaseName, DatabaseDetails details) { uint64_t quota; SecurityOrigin* origin = frame->document()->securityOrigin(); quota = ewk_view_exceeded_database_quota(m_view, kit(frame), databaseName.utf8().data(), details.currentUsage(), details.expectedUsage()); /* if client did not set quota, and database is being created now, the * default quota is applied */ if (!quota && !DatabaseManager::manager().hasEntryForOrigin(origin)) quota = ewk_settings_web_database_default_quota_get(); DatabaseManager::manager().setQuota(origin, quota); }
// IPropertyBag -------------------------------------------------------------------- HRESULT STDMETHODCALLTYPE DatabaseDetailsPropertyBag::Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog*) { if (!pszPropName || !pVar) return E_POINTER; VariantInit(pVar); if (isEqual(pszPropName, WebDatabaseDisplayNameKey)) { COMVariantSetter<String>::setVariant(pVar, m_details.displayName()); return S_OK; } else if (isEqual(pszPropName, WebDatabaseExpectedSizeKey)) { COMVariantSetter<unsigned long long>::setVariant(pVar, m_details.expectedUsage()); return S_OK; } else if (isEqual(pszPropName, WebDatabaseUsageKey)) { COMVariantSetter<unsigned long long>::setVariant(pVar, m_details.currentUsage()); return S_OK; } return E_INVALIDARG; }
void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName) { WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); SecurityOrigin* origin = frame->document()->securityOrigin(); DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(databaseName, origin); uint64_t currentQuota = DatabaseTracker::tracker().quotaForOrigin(origin); uint64_t currentOriginUsage = DatabaseTracker::tracker().usageForOrigin(origin); uint64_t newQuota = 0; WebProcess::shared().connection()->sendSync( Messages::WebPageProxy::ExceededDatabaseQuota(webFrame->frameID(), origin->databaseIdentifier(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()), Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page->pageID()); DatabaseTracker::tracker().setQuota(origin, newQuota); }
void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName, DatabaseDetails details) { WebFrame* webFrame = WebFrame::fromCoreFrame(*frame); ASSERT(webFrame); SecurityOrigin* origin = frame->document()->securityOrigin(); DatabaseManager& dbManager = DatabaseManager::singleton(); uint64_t currentQuota = dbManager.quotaForOrigin(origin); uint64_t currentOriginUsage = dbManager.usageForOrigin(origin); uint64_t newQuota = 0; RefPtr<API::SecurityOrigin> securityOrigin = API::SecurityOrigin::create(WebCore::SecurityOrigin::createFromDatabaseIdentifier(origin->databaseIdentifier())); newQuota = m_page->injectedBundleUIClient().didExceedDatabaseQuota(m_page, securityOrigin.get(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()); if (!newQuota) { WebProcess::singleton().parentProcessConnection()->sendSync( Messages::WebPageProxy::ExceededDatabaseQuota(webFrame->frameID(), origin->databaseIdentifier(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()), Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page->pageID(), std::chrono::milliseconds::max(), IPC::SendSyncOption::InformPlatformProcessWillSuspend); } dbManager.setQuota(origin, newQuota); }
void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName, DatabaseDetails details) { WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; ASSERT(webFrame); SecurityOrigin* origin = frame->document()->securityOrigin(); DatabaseManager& dbManager = DatabaseManager::manager(); uint64_t currentQuota = dbManager.quotaForOrigin(origin); uint64_t currentOriginUsage = dbManager.usageForOrigin(origin); uint64_t newQuota = 0; RefPtr<WebSecurityOrigin> webSecurityOrigin = WebSecurityOrigin::createFromDatabaseIdentifier(origin->databaseIdentifier()); newQuota = m_page->injectedBundleUIClient().didExceedDatabaseQuota(m_page, webSecurityOrigin.get(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()); if (!newQuota) { WebProcess::shared().connection()->sendSync( Messages::WebPageProxy::ExceededDatabaseQuota(webFrame->frameID(), origin->databaseIdentifier(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()), Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page->pageID()); } dbManager.setQuota(origin, newQuota); }
void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName, DatabaseDetails details) { WebFrame* webFrame = WebFrame::fromCoreFrame(*frame); ASSERT(webFrame); SecurityOrigin* origin = frame->document()->securityOrigin(); DatabaseManager& dbManager = DatabaseManager::manager(); uint64_t currentQuota = dbManager.quotaForOrigin(origin); uint64_t currentOriginUsage = dbManager.usageForOrigin(origin); uint64_t newQuota = 0; RefPtr<WebSecurityOrigin> webSecurityOrigin = WebSecurityOrigin::createFromDatabaseIdentifier(origin->databaseIdentifier()); newQuota = m_page->injectedBundleUIClient().didExceedDatabaseQuota(m_page, webSecurityOrigin.get(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()); if (!newQuota) { unsigned syncSendFlags = IPC::InformPlatformProcessWillSuspend; if (WebPage::synchronousMessagesShouldSpinRunLoop()) syncSendFlags |= IPC::SpinRunLoopWhileWaitingForReply; WebProcess::shared().parentProcessConnection()->sendSync( Messages::WebPageProxy::ExceededDatabaseQuota(webFrame->frameID(), origin->databaseIdentifier(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()), Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page->pageID(), std::chrono::milliseconds::max(), syncSendFlags); } dbManager.setQuota(origin, newQuota); }
/*! Returns the current size of the database in bytes. */ qint64 QWebDatabase::size() const { DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(d->name, d->origin.get()); return details.currentUsage(); }