Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: chrome/browser/browsing_data/browsing_data_indexed_db_helper.cc

Issue 10836216: Add SiteInstance parameters to IndexedDBContext calls (Closed) Base URL: http://git.chromium.org/chromium/src.git@isolated-storage
Patch Set: Address ajwong's comments Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" 5 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/browsing_data/browsing_data_helper.h" 15 #include "chrome/browser/browsing_data/browsing_data_helper.h"
16 #include "chrome/browser/profiles/profile.h"
17 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/indexed_db_context.h" 17 #include "content/public/browser/indexed_db_context.h"
19 #include "webkit/database/database_util.h" 18 #include "webkit/database/database_util.h"
20 #include "webkit/glue/webkit_glue.h" 19 #include "webkit/glue/webkit_glue.h"
21 20
22 using content::BrowserContext; 21 using content::BrowserContext;
23 using content::BrowserThread; 22 using content::BrowserThread;
24 using content::IndexedDBContext; 23 using content::IndexedDBContext;
25 using webkit_database::DatabaseUtil; 24 using webkit_database::DatabaseUtil;
26 25
27 namespace { 26 namespace {
28 27
29 class BrowsingDataIndexedDBHelperImpl : public BrowsingDataIndexedDBHelper { 28 class BrowsingDataIndexedDBHelperImpl : public BrowsingDataIndexedDBHelper {
30 public: 29 public:
31 explicit BrowsingDataIndexedDBHelperImpl(Profile* profile); 30 explicit BrowsingDataIndexedDBHelperImpl(
31 IndexedDBContext* indexed_db_context);
32 32
33 virtual void StartFetching( 33 virtual void StartFetching(
34 const base::Callback<void(const std::list<IndexedDBInfo>&)>& 34 const base::Callback<void(const std::list<IndexedDBInfo>&)>&
35 callback) OVERRIDE; 35 callback) OVERRIDE;
36 virtual void DeleteIndexedDB(const GURL& origin) OVERRIDE; 36 virtual void DeleteIndexedDB(const GURL& origin) OVERRIDE;
37 37
38 private: 38 private:
39 virtual ~BrowsingDataIndexedDBHelperImpl(); 39 virtual ~BrowsingDataIndexedDBHelperImpl();
40 40
41 // Enumerates all indexed database files in the WEBKIT thread. 41 // Enumerates all indexed database files in the WEBKIT thread.
(...skipping 19 matching lines...) Expand all
61 // Indicates whether or not we're currently fetching information: 61 // Indicates whether or not we're currently fetching information:
62 // it's true when StartFetching() is called in the UI thread, and it's reset 62 // it's true when StartFetching() is called in the UI thread, and it's reset
63 // after we notified the callback in the UI thread. 63 // after we notified the callback in the UI thread.
64 // This only mutates on the UI thread. 64 // This only mutates on the UI thread.
65 bool is_fetching_; 65 bool is_fetching_;
66 66
67 DISALLOW_COPY_AND_ASSIGN(BrowsingDataIndexedDBHelperImpl); 67 DISALLOW_COPY_AND_ASSIGN(BrowsingDataIndexedDBHelperImpl);
68 }; 68 };
69 69
70 BrowsingDataIndexedDBHelperImpl::BrowsingDataIndexedDBHelperImpl( 70 BrowsingDataIndexedDBHelperImpl::BrowsingDataIndexedDBHelperImpl(
71 Profile* profile) 71 IndexedDBContext* indexed_db_context)
72 : indexed_db_context_(BrowserContext::GetIndexedDBContext(profile)), 72 : indexed_db_context_(indexed_db_context),
73 is_fetching_(false) { 73 is_fetching_(false) {
74 DCHECK(indexed_db_context_.get()); 74 DCHECK(indexed_db_context_.get());
75 } 75 }
76 76
77 BrowsingDataIndexedDBHelperImpl::~BrowsingDataIndexedDBHelperImpl() { 77 BrowsingDataIndexedDBHelperImpl::~BrowsingDataIndexedDBHelperImpl() {
78 } 78 }
79 79
80 void BrowsingDataIndexedDBHelperImpl::StartFetching( 80 void BrowsingDataIndexedDBHelperImpl::StartFetching(
81 const base::Callback<void(const std::list<IndexedDBInfo>&)>& callback) { 81 const base::Callback<void(const std::list<IndexedDBInfo>&)>& callback) {
82 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 82 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 base::Time last_modified) 144 base::Time last_modified)
145 : origin(origin), 145 : origin(origin),
146 size(size), 146 size(size),
147 last_modified(last_modified) { 147 last_modified(last_modified) {
148 } 148 }
149 149
150 BrowsingDataIndexedDBHelper::IndexedDBInfo::~IndexedDBInfo() {} 150 BrowsingDataIndexedDBHelper::IndexedDBInfo::~IndexedDBInfo() {}
151 151
152 // static 152 // static
153 BrowsingDataIndexedDBHelper* BrowsingDataIndexedDBHelper::Create( 153 BrowsingDataIndexedDBHelper* BrowsingDataIndexedDBHelper::Create(
154 Profile* profile) { 154 IndexedDBContext* context) {
155 return new BrowsingDataIndexedDBHelperImpl(profile); 155 return new BrowsingDataIndexedDBHelperImpl(context);
156 } 156 }
157 157
158 CannedBrowsingDataIndexedDBHelper:: 158 CannedBrowsingDataIndexedDBHelper::
159 PendingIndexedDBInfo::PendingIndexedDBInfo(const GURL& origin, 159 PendingIndexedDBInfo::PendingIndexedDBInfo(const GURL& origin,
160 const string16& name) 160 const string16& name)
161 : origin(origin), 161 : origin(origin),
162 name(name) { 162 name(name) {
163 } 163 }
164 164
165 CannedBrowsingDataIndexedDBHelper:: 165 CannedBrowsingDataIndexedDBHelper::
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 254 }
255 255
256 void CannedBrowsingDataIndexedDBHelper::NotifyInUIThread() { 256 void CannedBrowsingDataIndexedDBHelper::NotifyInUIThread() {
257 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 257 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
258 DCHECK(is_fetching_); 258 DCHECK(is_fetching_);
259 259
260 completion_callback_.Run(indexed_db_info_); 260 completion_callback_.Run(indexed_db_info_);
261 completion_callback_.Reset(); 261 completion_callback_.Reset();
262 is_fetching_ = false; 262 is_fetching_ = false;
263 } 263 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_indexed_db_helper.h ('k') | chrome/browser/extensions/data_deleter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698