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

Side by Side Diff: content/browser/indexed_db/indexed_db_active_blob_registry.cc

Issue 2941353002: Indexed DB: Use BindOnce / OnceCallback / OnceClosure where applicable (Closed)
Patch Set: Created 3 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/location.h" 6 #include "base/location.h"
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/task_runner.h" 8 #include "base/task_runner.h"
9 #include "content/browser/indexed_db/indexed_db_active_blob_registry.h" 9 #include "content/browser/indexed_db/indexed_db_active_blob_registry.h"
10 #include "content/browser/indexed_db/indexed_db_backing_store.h" 10 #include "content/browser/indexed_db/indexed_db_backing_store.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 iter->second = true; 104 iter->second = true;
105 return true; 105 return true;
106 } 106 }
107 107
108 void IndexedDBActiveBlobRegistry::ReleaseBlobRefThreadSafe( 108 void IndexedDBActiveBlobRegistry::ReleaseBlobRefThreadSafe(
109 scoped_refptr<base::TaskRunner> task_runner, 109 scoped_refptr<base::TaskRunner> task_runner,
110 base::WeakPtr<IndexedDBActiveBlobRegistry> weak_ptr, 110 base::WeakPtr<IndexedDBActiveBlobRegistry> weak_ptr,
111 int64_t database_id, 111 int64_t database_id,
112 int64_t blob_key, 112 int64_t blob_key,
113 const base::FilePath& unused) { 113 const base::FilePath& unused) {
114 task_runner->PostTask(FROM_HERE, 114 task_runner->PostTask(
115 base::Bind(&IndexedDBActiveBlobRegistry::ReleaseBlobRef, 115 FROM_HERE, base::BindOnce(&IndexedDBActiveBlobRegistry::ReleaseBlobRef,
116 weak_ptr, 116 weak_ptr, database_id, blob_key));
117 database_id,
118 blob_key));
119 } 117 }
120 118
121 storage::ShareableFileReference::FinalReleaseCallback 119 storage::ShareableFileReference::FinalReleaseCallback
122 IndexedDBActiveBlobRegistry::GetFinalReleaseCallback(int64_t database_id, 120 IndexedDBActiveBlobRegistry::GetFinalReleaseCallback(int64_t database_id,
123 int64_t blob_key) { 121 int64_t blob_key) {
124 return base::Bind( 122 return base::Bind(
125 &IndexedDBActiveBlobRegistry::ReleaseBlobRefThreadSafe, 123 &IndexedDBActiveBlobRegistry::ReleaseBlobRefThreadSafe,
126 scoped_refptr<base::TaskRunner>(backing_store_->task_runner()), 124 scoped_refptr<base::TaskRunner>(backing_store_->task_runner()),
127 weak_factory_.GetWeakPtr(), 125 weak_factory_.GetWeakPtr(), database_id, blob_key);
128 database_id,
129 blob_key);
130 } 126 }
131 127
132 base::Closure IndexedDBActiveBlobRegistry::GetAddBlobRefCallback( 128 base::Closure IndexedDBActiveBlobRegistry::GetAddBlobRefCallback(
133 int64_t database_id, 129 int64_t database_id,
134 int64_t blob_key) { 130 int64_t blob_key) {
135 return base::Bind(&IndexedDBActiveBlobRegistry::AddBlobRef, 131 return base::Bind(&IndexedDBActiveBlobRegistry::AddBlobRef,
136 weak_factory_.GetWeakPtr(), 132 weak_factory_.GetWeakPtr(), database_id, blob_key);
137 database_id,
138 blob_key);
139 } 133 }
140 134
141 void IndexedDBActiveBlobRegistry::ForceShutdown() { 135 void IndexedDBActiveBlobRegistry::ForceShutdown() {
142 weak_factory_.InvalidateWeakPtrs(); 136 weak_factory_.InvalidateWeakPtrs();
143 use_tracker_.clear(); 137 use_tracker_.clear();
144 backing_store_ = NULL; 138 backing_store_ = NULL;
145 } 139 }
146 140
147 } // namespace content 141 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/database_impl.cc ('k') | content/browser/indexed_db/indexed_db_backing_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698