summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-27 23:37:42 +0000
committerdgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-27 23:37:42 +0000
commitb8d79c24469cbecf463fed07ae423a317e57dfe0 (patch)
tree84ad17568dc7581e56b7649e5878f1a828bf2213
parent89a8dadf68ae9496295d345dc7a892302496d2e4 (diff)
downloadchromium_src-b8d79c24469cbecf463fed07ae423a317e57dfe0.zip
chromium_src-b8d79c24469cbecf463fed07ae423a317e57dfe0.tar.gz
chromium_src-b8d79c24469cbecf463fed07ae423a317e57dfe0.tar.bz2
revert 87108 and 87076
TBR=msw_ git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87112 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/profiles/profile.cc11
-rw-r--r--chrome/browser/profiles/profile_impl.cc11
-rw-r--r--chrome/chrome_tests.gypi1
-rw-r--r--chrome/test/testing_profile.cc2
-rw-r--r--content/browser/browser_thread.h4
-rw-r--r--content/browser/in_process_webkit/indexed_db_context.cc11
-rw-r--r--content/browser/in_process_webkit/indexed_db_context.h17
-rw-r--r--content/browser/in_process_webkit/indexed_db_quota_client.cc219
-rw-r--r--content/browser/in_process_webkit/indexed_db_quota_client.h80
-rw-r--r--content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc104
-rw-r--r--content/browser/in_process_webkit/webkit_context.cc12
-rw-r--r--content/browser/in_process_webkit/webkit_context.h11
-rw-r--r--content/browser/in_process_webkit/webkit_context_unittest.cc6
-rw-r--r--content/content_browser.gypi2
14 files changed, 27 insertions, 464 deletions
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
index fbb0f4b..4f882cb 100644
--- a/chrome/browser/profiles/profile.cc
+++ b/chrome/browser/profiles/profile.cc
@@ -565,7 +565,11 @@ class OffTheRecordProfileImpl : public Profile,
}
virtual WebKitContext* GetWebKitContext() {
- CreateQuotaManagerAndClients();
+ if (!webkit_context_.get()) {
+ webkit_context_ = new WebKitContext(
+ IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(),
+ false);
+ }
return webkit_context_.get();
}
@@ -690,7 +694,6 @@ class OffTheRecordProfileImpl : public Profile,
if (quota_manager_.get()) {
DCHECK(file_system_context_.get());
DCHECK(db_tracker_.get());
- DCHECK(webkit_context_.get());
return;
}
@@ -714,10 +717,6 @@ class OffTheRecordProfileImpl : public Profile,
GetPath(), IsOffTheRecord(), GetExtensionSpecialStoragePolicy(),
quota_manager_->proxy(),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
- webkit_context_ = new WebKitContext(
- IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(),
- false, quota_manager_->proxy(),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT));
appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy());
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 4780570..3ed5116 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -1306,7 +1306,6 @@ void ProfileImpl::CreateQuotaManagerAndClients() {
if (quota_manager_.get()) {
DCHECK(file_system_context_.get());
DCHECK(db_tracker_.get());
- DCHECK(webkit_context_.get());
return;
}
@@ -1330,10 +1329,6 @@ void ProfileImpl::CreateQuotaManagerAndClients() {
GetPath(), IsOffTheRecord(), GetExtensionSpecialStoragePolicy(),
quota_manager_->proxy(),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
- webkit_context_ = new WebKitContext(
- IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(),
- clear_local_state_on_exit_, quota_manager_->proxy(),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT));
appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy());
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
@@ -1348,7 +1343,11 @@ void ProfileImpl::CreateQuotaManagerAndClients() {
}
WebKitContext* ProfileImpl::GetWebKitContext() {
- CreateQuotaManagerAndClients();
+ if (!webkit_context_.get()) {
+ webkit_context_ = new WebKitContext(
+ IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(),
+ clear_local_state_on_exit_);
+ }
return webkit_context_.get();
}
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index dd9e8b5..9faad86 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1923,7 +1923,6 @@
'../content/browser/geolocation/win7_location_api_unittest_win.cc',
'../content/browser/geolocation/win7_location_provider_unittest_win.cc',
'../content/browser/gpu/gpu_blacklist_unittest.cc',
- '../content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc',
'../content/browser/in_process_webkit/webkit_context_unittest.cc',
'../content/browser/in_process_webkit/webkit_thread_unittest.cc',
'../content/browser/media_stream/video_capture_manager_unittest.cc',
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index 12e6c1e..3604f9d 100644
--- a/chrome/test/testing_profile.cc
+++ b/chrome/test/testing_profile.cc
@@ -680,7 +680,7 @@ WebKitContext* TestingProfile::GetWebKitContext() {
webkit_context_ = new WebKitContext(
IsOffTheRecord(), GetPath(),
GetExtensionSpecialStoragePolicy(),
- false, NULL, NULL);
+ false);
}
return webkit_context_;
}
diff --git a/content/browser/browser_thread.h b/content/browser/browser_thread.h
index 65235be..3da4012c9 100644
--- a/content/browser/browser_thread.h
+++ b/content/browser/browser_thread.h
@@ -191,9 +191,7 @@ class BrowserThread : public base::Thread {
#if defined(UNIT_TEST)
// Only logged under unit testing because leaks at shutdown
// are acceptable under normal circumstances.
- LOG(ERROR) << "DeleteSoon failed on thread " << thread
- << "; deleting locally.";
- delete x;
+ LOG(ERROR) << "DeleteSoon failed on thread " << thread;
#endif // UNIT_TEST
}
}
diff --git a/content/browser/in_process_webkit/indexed_db_context.cc b/content/browser/in_process_webkit/indexed_db_context.cc
index 23c5214..f9722ec 100644
--- a/content/browser/in_process_webkit/indexed_db_context.cc
+++ b/content/browser/in_process_webkit/indexed_db_context.cc
@@ -6,11 +6,9 @@
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/message_loop_proxy.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/in_process_webkit/indexed_db_quota_client.h"
#include "content/browser/in_process_webkit/webkit_context.h"
#include "googleurl/src/gurl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h"
@@ -19,7 +17,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
#include "webkit/glue/webkit_glue.h"
-#include "webkit/quota/quota_manager.h"
#include "webkit/quota/special_storage_policy.h"
using WebKit::WebIDBDatabase;
@@ -57,16 +54,10 @@ const FilePath::CharType IndexedDBContext::kIndexedDBExtension[] =
IndexedDBContext::IndexedDBContext(
WebKitContext* webkit_context,
- quota::SpecialStoragePolicy* special_storage_policy,
- quota::QuotaManagerProxy* quota_manager_proxy,
- base::MessageLoopProxy* webkit_thread_loop)
+ quota::SpecialStoragePolicy* special_storage_policy)
: clear_local_state_on_exit_(false),
special_storage_policy_(special_storage_policy) {
data_path_ = webkit_context->data_path().Append(kIndexedDBDirectory);
- if (quota_manager_proxy) {
-// quota_manager_proxy->RegisterClient(
-// new IndexedDBQuotaClient(webkit_thread_loop, this));
- }
}
IndexedDBContext::~IndexedDBContext() {
diff --git a/content/browser/in_process_webkit/indexed_db_context.h b/content/browser/in_process_webkit/indexed_db_context.h
index be23e0d..2bd32e5 100644
--- a/content/browser/in_process_webkit/indexed_db_context.h
+++ b/content/browser/in_process_webkit/indexed_db_context.h
@@ -10,7 +10,6 @@
#include "base/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "content/browser/browser_thread.h"
class GURL;
class FilePath;
@@ -20,24 +19,14 @@ namespace WebKit {
class WebIDBFactory;
}
-namespace base {
-class MessageLoopProxy;
-}
-
namespace quota {
-class QuotaManagerProxy;
class SpecialStoragePolicy;
}
-class IndexedDBContext :
- public base::RefCountedThreadSafe<IndexedDBContext,
- BrowserThread::DeleteOnWebKitThread> {
+class IndexedDBContext {
public:
IndexedDBContext(WebKitContext* webkit_context,
- quota::SpecialStoragePolicy* special_storage_policy,
- quota::QuotaManagerProxy* quota_manager_proxy,
- base::MessageLoopProxy* webkit_thread_loop);
-
+ quota::SpecialStoragePolicy* special_storage_policy);
~IndexedDBContext();
WebKit::WebIDBFactory* GetIDBFactory();
@@ -80,8 +69,6 @@ class IndexedDBContext :
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
- scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_;
-
DISALLOW_COPY_AND_ASSIGN(IndexedDBContext);
};
diff --git a/content/browser/in_process_webkit/indexed_db_quota_client.cc b/content/browser/in_process_webkit/indexed_db_quota_client.cc
deleted file mode 100644
index 2334bac..0000000
--- a/content/browser/in_process_webkit/indexed_db_quota_client.cc
+++ /dev/null
@@ -1,219 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/browser/in_process_webkit/indexed_db_quota_client.h"
-
-#include <vector>
-
-#include "base/file_util.h"
-#include "base/message_loop_proxy.h"
-#include "content/browser/in_process_webkit/indexed_db_context.h"
-#include "net/base/net_util.h"
-#include "webkit/database/database_util.h"
-
-using quota::QuotaClient;
-
-
-// Helper tasks ---------------------------------------------------------------
-
-class IndexedDBQuotaClient::HelperTask : public quota::QuotaThreadTask {
- protected:
- HelperTask(
- IndexedDBQuotaClient* client,
- base::MessageLoopProxy* webkit_thread_message_loop)
- : QuotaThreadTask(client, webkit_thread_message_loop),
- client_(client), indexed_db_context_(client->indexed_db_context_) {
- }
-
- IndexedDBQuotaClient* client_;
- scoped_refptr<IndexedDBContext> indexed_db_context_;
-};
-
-class IndexedDBQuotaClient::GetOriginUsageTask : public HelperTask {
- public:
- GetOriginUsageTask(
- IndexedDBQuotaClient* client,
- base::MessageLoopProxy* webkit_thread_message_loop,
- const GURL& origin_url)
- : HelperTask(client, webkit_thread_message_loop),
- origin_url_(origin_url), usage_(0) {
- }
-
- private:
- virtual void RunOnTargetThread() OVERRIDE {
- string16 origin_id =
- webkit_database::DatabaseUtil::GetOriginIdentifier(origin_url_);
- FilePath file_path = indexed_db_context_->GetIndexedDBFilePath(origin_id);
- usage_ = 0;
- if (!file_util::GetFileSize(file_path, &usage_)) {
- LOG(ERROR) << "Failed to get file size for " << file_path.value();
- }
- }
- virtual void Completed() OVERRIDE {
- client_->DidGetOriginUsage(origin_url_, usage_);
- }
- GURL origin_url_;
- int64 usage_;
-};
-
-class IndexedDBQuotaClient::GetOriginsTaskBase : public HelperTask {
- protected:
- GetOriginsTaskBase(
- IndexedDBQuotaClient* client,
- base::MessageLoopProxy* webkit_thread_message_loop)
- : HelperTask(client, webkit_thread_message_loop) {
- }
-
- virtual bool ShouldAddOrigin(const GURL& origin) = 0;
-
- virtual void RunOnTargetThread() OVERRIDE {
- // TODO(dgrogan): Implement.
- }
-
- std::set<GURL> origins_;
-};
-
-class IndexedDBQuotaClient::GetAllOriginsTask : public GetOriginsTaskBase {
- public:
- GetAllOriginsTask(
- IndexedDBQuotaClient* client,
- base::MessageLoopProxy* webkit_thread_message_loop)
- : GetOriginsTaskBase(client, webkit_thread_message_loop) {
- }
-
- protected:
- virtual bool ShouldAddOrigin(const GURL& origin) OVERRIDE {
- return true;
- }
- virtual void Completed() OVERRIDE {
- client_->DidGetAllOrigins(origins_);
- }
-};
-
-class IndexedDBQuotaClient::GetOriginsForHostTask : public GetOriginsTaskBase {
- public:
- GetOriginsForHostTask(
- IndexedDBQuotaClient* client,
- base::MessageLoopProxy* webkit_thread_message_loop,
- const std::string& host)
- : GetOriginsTaskBase(client, webkit_thread_message_loop),
- host_(host) {
- }
-
- private:
- virtual bool ShouldAddOrigin(const GURL& origin) OVERRIDE {
- return host_ == net::GetHostOrSpecFromURL(origin);
- }
- virtual void Completed() OVERRIDE {
- client_->DidGetOriginsForHost(host_, origins_);
- }
- std::string host_;
-};
-
-// IndexedDBQuotaClient --------------------------------------------------------
-
-IndexedDBQuotaClient::IndexedDBQuotaClient(
- base::MessageLoopProxy* webkit_thread_message_loop,
- IndexedDBContext* indexed_db_context)
- : webkit_thread_message_loop_(webkit_thread_message_loop),
- indexed_db_context_(indexed_db_context) {
-}
-
-IndexedDBQuotaClient::~IndexedDBQuotaClient() {
-}
-
-QuotaClient::ID IndexedDBQuotaClient::id() const {
- return kIndexedDatabase;
-}
-
-void IndexedDBQuotaClient::OnQuotaManagerDestroyed() {
- delete this;
-}
-
-void IndexedDBQuotaClient::GetOriginUsage(
- const GURL& origin_url,
- quota::StorageType type,
- GetUsageCallback* callback_ptr) {
- DCHECK(callback_ptr);
- DCHECK(indexed_db_context_.get());
- scoped_ptr<GetUsageCallback> callback(callback_ptr);
-
- // IndexedDB is in the temp namespace for now.
- if (type != quota::kStorageTypeTemporary) {
- callback->Run(0);
- return;
- }
-
- if (usage_for_origin_callbacks_.Add(origin_url, callback.release())) {
- scoped_refptr<GetOriginUsageTask> task(
- new GetOriginUsageTask(this, webkit_thread_message_loop_, origin_url));
- task->Start();
- }
-}
-
-void IndexedDBQuotaClient::GetOriginsForType(
- quota::StorageType type,
- GetOriginsCallback* callback_ptr) {
- DCHECK(callback_ptr);
- DCHECK(indexed_db_context_.get());
- scoped_ptr<GetOriginsCallback> callback(callback_ptr);
-
- // All databases are in the temp namespace for now.
- if (type != quota::kStorageTypeTemporary) {
- callback->Run(std::set<GURL>());
- return;
- }
-
- if (origins_for_type_callbacks_.Add(callback.release())) {
- scoped_refptr<GetAllOriginsTask> task(
- new GetAllOriginsTask(this, webkit_thread_message_loop_));
- task->Start();
- }
-}
-
-void IndexedDBQuotaClient::GetOriginsForHost(
- quota::StorageType type,
- const std::string& host,
- GetOriginsCallback* callback_ptr) {
- DCHECK(callback_ptr);
- DCHECK(indexed_db_context_.get());
- scoped_ptr<GetOriginsCallback> callback(callback_ptr);
-
- // All databases are in the temp namespace for now.
- if (type != quota::kStorageTypeTemporary) {
- callback->Run(std::set<GURL>());
- return;
- }
-
- if (origins_for_host_callbacks_.Add(host, callback.release())) {
- scoped_refptr<GetOriginsForHostTask> task(
- new GetOriginsForHostTask(this, webkit_thread_message_loop_, host));
- task->Start();
- }
-}
-
-void IndexedDBQuotaClient::DeleteOriginData(const GURL& origin,
- quota::StorageType type,
- DeletionCallback* callback) {
- // TODO(tzik): implement me
- callback->Run(quota::kQuotaErrorNotSupported);
- delete callback;
-}
-
-void IndexedDBQuotaClient::DidGetOriginUsage(
- const GURL& origin_url, int64 usage) {
- DCHECK(usage_for_origin_callbacks_.HasCallbacks(origin_url));
- usage_for_origin_callbacks_.Run(origin_url, usage);
-}
-
-void IndexedDBQuotaClient::DidGetAllOrigins(const std::set<GURL>& origins) {
- DCHECK(origins_for_type_callbacks_.HasCallbacks());
- origins_for_type_callbacks_.Run(origins);
-}
-
-void IndexedDBQuotaClient::DidGetOriginsForHost(
- const std::string& host, const std::set<GURL>& origins) {
- DCHECK(origins_for_host_callbacks_.HasCallbacks(host));
- origins_for_host_callbacks_.Run(host, origins);
-}
diff --git a/content/browser/in_process_webkit/indexed_db_quota_client.h b/content/browser/in_process_webkit/indexed_db_quota_client.h
deleted file mode 100644
index 59b3b23..0000000
--- a/content/browser/in_process_webkit/indexed_db_quota_client.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_BROWER_IN_PROCESS_WEBKIT_QUOTA_CLIENT_H_
-#define CONTENT_BROWER_IN_PROCESS_WEBKIT_QUOTA_CLIENT_H_
-
-#include <set>
-#include <string>
-
-#include "base/memory/ref_counted.h"
-#include "base/message_loop_proxy.h"
-#include "webkit/quota/quota_client.h"
-#include "webkit/quota/quota_task.h"
-#include "webkit/quota/quota_types.h"
-
-class IndexedDBContext;
-
-// A QuotaClient implementation to integrate IndexedDB
-// with the quota management system. This interface is used
-// on the IO thread by the quota manager.
-class IndexedDBQuotaClient : public quota::QuotaClient,
- public quota::QuotaTaskObserver {
- public:
- IndexedDBQuotaClient(
- base::MessageLoopProxy* tracker_thread,
- IndexedDBContext* indexed_db_context);
- virtual ~IndexedDBQuotaClient();
-
- // QuotaClient method overrides
- virtual ID id() const OVERRIDE;
- virtual void OnQuotaManagerDestroyed() OVERRIDE;
- virtual void GetOriginUsage(const GURL& origin_url,
- quota::StorageType type,
- GetUsageCallback* callback) OVERRIDE;
- virtual void GetOriginsForType(quota::StorageType type,
- GetOriginsCallback* callback) OVERRIDE;
- virtual void GetOriginsForHost(quota::StorageType type,
- const std::string& host,
- GetOriginsCallback* callback) OVERRIDE;
- virtual void DeleteOriginData(const GURL& origin,
- quota::StorageType type,
- DeletionCallback* callback) OVERRIDE;
- private:
- class HelperTask;
- class GetOriginUsageTask;
- class GetOriginsTaskBase;
- class GetAllOriginsTask;
- class GetOriginsForHostTask;
-
- typedef quota::CallbackQueueMap1
- <GetUsageCallback*,
- GURL, // origin
- int64
- > UsageForOriginCallbackMap;
- typedef quota::CallbackQueue1
- <GetOriginsCallback*,
- const std::set<GURL>&
- > OriginsForTypeCallbackQueue;
- typedef quota::CallbackQueueMap1
- <GetOriginsCallback*,
- std::string, // host
- const std::set<GURL>&
- > OriginsForHostCallbackMap;
-
- void DidGetOriginUsage(const GURL& origin_url, int64 usage);
- void DidGetAllOrigins(const std::set<GURL>& origins);
- void DidGetOriginsForHost(
- const std::string& host, const std::set<GURL>& origins);
-
- scoped_refptr<base::MessageLoopProxy> webkit_thread_message_loop_;
- scoped_refptr<IndexedDBContext> indexed_db_context_;
- UsageForOriginCallbackMap usage_for_origin_callbacks_;
- OriginsForTypeCallbackQueue origins_for_type_callbacks_;
- OriginsForHostCallbackMap origins_for_host_callbacks_;
-
- DISALLOW_COPY_AND_ASSIGN(IndexedDBQuotaClient);
-};
-
-#endif // CONTENT_BROWER_IN_PROCESS_WEBKIT_QUOTA_CLIENT_H_
diff --git a/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc b/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc
deleted file mode 100644
index d9f39cc..0000000
--- a/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <map>
-
-#include "base/file_path.h"
-#include "base/file_util.h"
-#include "base/memory/scoped_callback_factory.h"
-#include "base/message_loop.h"
-#include "base/message_loop_proxy.h"
-#include "chrome/test/testing_profile.h"
-#include "content/browser/in_process_webkit/indexed_db_context.h"
-#include "content/browser/in_process_webkit/indexed_db_quota_client.h"
-#include "content/browser/in_process_webkit/webkit_context.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "webkit/database/database_util.h"
-
-// Declared to shorten the line lengths.
-static const quota::StorageType kTemp = quota::kStorageTypeTemporary;
-static const quota::StorageType kPerm = quota::kStorageTypePersistent;
-
-using namespace webkit_database;
-
-// Base class for our test fixtures.
-class IndexedDBQuotaClientTest : public testing::Test {
- public:
- const GURL kOriginA;
- const GURL kOriginB;
-
- IndexedDBQuotaClientTest()
- : kOriginA("http://host"),
- kOriginB("http://host:8000"),
- usage_(0),
- callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
- message_loop_(MessageLoop::TYPE_IO) {
- TestingProfile profile;
- idb_context_ = new IndexedDBContext(profile.GetWebKitContext(), NULL,
- NULL, NULL);
- }
-
- int64 GetOriginUsage(
- quota::QuotaClient* client,
- const GURL& origin,
- quota::StorageType type) {
- usage_ = -1;
- client->GetOriginUsage(origin, type,
- callback_factory_.NewCallback(
- &IndexedDBQuotaClientTest::OnGetOriginUsageComplete));
- MessageLoop::current()->RunAllPending();
- EXPECT_GT(usage_, -1);
- return usage_;
- }
-
- IndexedDBContext* idb_context() { return idb_context_.get(); }
-
- void SetFileSizeTo(const FilePath& path, int size) {
- std::string junk(size, 'a');
- ASSERT_EQ(size, file_util::WriteFile(path, junk.c_str(), size));
- }
-
-
- private:
- void OnGetOriginUsageComplete(int64 usage) {
- usage_ = usage;
- }
-
- int64 usage_;
- scoped_refptr<IndexedDBContext> idb_context_;
- base::ScopedCallbackFactory<IndexedDBQuotaClientTest> callback_factory_;
- MessageLoop message_loop_;
-};
-
-
-TEST_F(IndexedDBQuotaClientTest, GetOriginUsage) {
- IndexedDBQuotaClient client(
- base::MessageLoopProxy::CreateForCurrentThread(),
- idb_context());
-
- ScopedTempDir temp_dir;
- ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
- FilePath indexeddb_dir = temp_dir.path().Append(
- IndexedDBContext::kIndexedDBDirectory);
- ASSERT_TRUE(file_util::CreateDirectory(indexeddb_dir));
-
- idb_context()->set_data_path(indexeddb_dir);
- FilePath file_path_origin_a = idb_context()->GetIndexedDBFilePath(
- DatabaseUtil::GetOriginIdentifier(kOriginA));
- FilePath file_path_origin_b = idb_context()->GetIndexedDBFilePath(
- DatabaseUtil::GetOriginIdentifier(kOriginB));
-
- SetFileSizeTo(file_path_origin_a, 6);
- SetFileSizeTo(file_path_origin_b, 3);
- EXPECT_EQ(6, GetOriginUsage(&client, kOriginA, kTemp));
- EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kPerm));
- EXPECT_EQ(3, GetOriginUsage(&client, kOriginB, kTemp));
- EXPECT_EQ(0, GetOriginUsage(&client, kOriginB, kPerm));
-
- SetFileSizeTo(file_path_origin_a, 1000);
- EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp));
- EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kPerm));
- EXPECT_EQ(3, GetOriginUsage(&client, kOriginB, kTemp));
- EXPECT_EQ(0, GetOriginUsage(&client, kOriginB, kPerm));
-}
diff --git a/content/browser/in_process_webkit/webkit_context.cc b/content/browser/in_process_webkit/webkit_context.cc
index 6359916..1983263 100644
--- a/content/browser/in_process_webkit/webkit_context.cc
+++ b/content/browser/in_process_webkit/webkit_context.cc
@@ -10,9 +10,7 @@
WebKitContext::WebKitContext(
bool is_incognito, const FilePath& data_path,
quota::SpecialStoragePolicy* special_storage_policy,
- bool clear_local_state_on_exit,
- quota::QuotaManagerProxy* quota_manager_proxy,
- base::MessageLoopProxy* webkit_thread_loop)
+ bool clear_local_state_on_exit)
: data_path_(is_incognito ? FilePath() : data_path),
is_incognito_(is_incognito),
clear_local_state_on_exit_(clear_local_state_on_exit),
@@ -21,8 +19,7 @@ WebKitContext::WebKitContext(
this, special_storage_policy))),
ALLOW_THIS_IN_INITIALIZER_LIST(
indexed_db_context_(new IndexedDBContext(
- this, special_storage_policy, quota_manager_proxy,
- webkit_thread_loop))) {
+ this, special_storage_policy))) {
}
WebKitContext::~WebKitContext() {
@@ -41,6 +38,11 @@ WebKitContext::~WebKitContext() {
indexed_db_context_->set_clear_local_state_on_exit(
clear_local_state_on_exit_);
+ IndexedDBContext* indexed_db_context = indexed_db_context_.release();
+ if (!BrowserThread::DeleteSoon(
+ BrowserThread::WEBKIT, FROM_HERE, indexed_db_context)) {
+ delete indexed_db_context;
+ }
}
void WebKitContext::PurgeMemory() {
diff --git a/content/browser/in_process_webkit/webkit_context.h b/content/browser/in_process_webkit/webkit_context.h
index fa2d32d..3c324a6 100644
--- a/content/browser/in_process_webkit/webkit_context.h
+++ b/content/browser/in_process_webkit/webkit_context.h
@@ -15,12 +15,7 @@
#include "content/browser/in_process_webkit/dom_storage_context.h"
#include "content/browser/in_process_webkit/indexed_db_context.h"
-namespace base {
-class MessageLoopProxy;
-}
-
namespace quota {
-class QuotaManagerProxy;
class SpecialStoragePolicy;
}
@@ -35,9 +30,7 @@ class WebKitContext : public base::RefCountedThreadSafe<WebKitContext> {
public:
WebKitContext(bool is_incognito, const FilePath& data_path,
quota::SpecialStoragePolicy* special_storage_policy,
- bool clear_local_state_on_exit,
- quota::QuotaManagerProxy* quota_manager_proxy,
- base::MessageLoopProxy* webkit_thread_loop);
+ bool clear_local_state_on_exit);
const FilePath& data_path() const { return data_path_; }
bool is_incognito() const { return is_incognito_; }
@@ -85,7 +78,7 @@ class WebKitContext : public base::RefCountedThreadSafe<WebKitContext> {
bool clear_local_state_on_exit_;
scoped_ptr<DOMStorageContext> dom_storage_context_;
- scoped_refptr<IndexedDBContext> indexed_db_context_;
+ scoped_ptr<IndexedDBContext> indexed_db_context_;
DISALLOW_IMPLICIT_CONSTRUCTORS(WebKitContext);
};
diff --git a/content/browser/in_process_webkit/webkit_context_unittest.cc b/content/browser/in_process_webkit/webkit_context_unittest.cc
index e27bece..5232757 100644
--- a/content/browser/in_process_webkit/webkit_context_unittest.cc
+++ b/content/browser/in_process_webkit/webkit_context_unittest.cc
@@ -33,14 +33,14 @@ TEST(WebKitContextTest, Basic) {
scoped_refptr<WebKitContext> context1(new WebKitContext(
profile.IsOffTheRecord(), profile.GetPath(),
profile.GetSpecialStoragePolicy(),
- false, NULL, NULL));
+ false));
EXPECT_TRUE(profile.GetPath() == context1->data_path());
EXPECT_TRUE(profile.IsOffTheRecord() == context1->is_incognito());
scoped_refptr<WebKitContext> context2(new WebKitContext(
profile.IsOffTheRecord(), profile.GetPath(),
profile.GetSpecialStoragePolicy(),
- false, NULL, NULL));
+ false));
EXPECT_TRUE(context1->data_path() == context2->data_path());
EXPECT_TRUE(context1->is_incognito() == context2->is_incognito());
}
@@ -56,7 +56,7 @@ TEST(WebKitContextTest, PurgeMemory) {
scoped_refptr<WebKitContext> context(new WebKitContext(
profile.IsOffTheRecord(), profile.GetPath(),
profile.GetSpecialStoragePolicy(),
- false, NULL, NULL));
+ false));
MockDOMStorageContext* mock_context = new MockDOMStorageContext(
context.get(), profile.GetSpecialStoragePolicy());
context->set_dom_storage_context(mock_context); // Takes ownership.
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 6ceea3c..bc04327 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -157,8 +157,6 @@
'browser/in_process_webkit/indexed_db_dispatcher_host.h',
'browser/in_process_webkit/indexed_db_key_utility_client.cc',
'browser/in_process_webkit/indexed_db_key_utility_client.h',
- 'browser/in_process_webkit/indexed_db_quota_client.cc',
- 'browser/in_process_webkit/indexed_db_quota_client.h',
'browser/in_process_webkit/indexed_db_transaction_callbacks.cc',
'browser/in_process_webkit/indexed_db_transaction_callbacks.h',
'browser/in_process_webkit/session_storage_namespace.cc',