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

Side by Side Diff: content/browser/blob_storage/chrome_blob_storage_context.cc

Issue 2973233002: [Background Fetch] Cleanup/fix thread safety (Closed)
Patch Set: Remove n.b. from comments Created 3 years, 5 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 "content/browser/blob_storage/chrome_blob_storage_context.h" 5 #include "content/browser/blob_storage/chrome_blob_storage_context.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 private: 74 private:
75 std::unique_ptr<storage::BlobDataHandle> handle_; 75 std::unique_ptr<storage::BlobDataHandle> handle_;
76 }; 76 };
77 77
78 } // namespace 78 } // namespace
79 79
80 ChromeBlobStorageContext::ChromeBlobStorageContext() {} 80 ChromeBlobStorageContext::ChromeBlobStorageContext() {}
81 81
82 ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor( 82 ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor(
83 BrowserContext* context) { 83 BrowserContext* context) {
84 DCHECK_CURRENTLY_ON(BrowserThread::UI);
85
84 if (!context->GetUserData(kBlobStorageContextKeyName)) { 86 if (!context->GetUserData(kBlobStorageContextKeyName)) {
85 scoped_refptr<ChromeBlobStorageContext> blob = 87 scoped_refptr<ChromeBlobStorageContext> blob =
86 new ChromeBlobStorageContext(); 88 new ChromeBlobStorageContext();
87 context->SetUserData( 89 context->SetUserData(
88 kBlobStorageContextKeyName, 90 kBlobStorageContextKeyName,
89 base::MakeUnique<UserDataAdapter<ChromeBlobStorageContext>>( 91 base::MakeUnique<UserDataAdapter<ChromeBlobStorageContext>>(
90 blob.get())); 92 blob.get()));
91 93
92 // Check first to avoid memory leak in unittests. 94 // Check first to avoid memory leak in unittests.
93 bool io_thread_valid = BrowserThread::IsMessageLoopValid(BrowserThread::IO); 95 bool io_thread_valid = BrowserThread::IsMessageLoopValid(BrowserThread::IO);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 std::unique_ptr<storage::BlobDataHandle> handle = 228 std::unique_ptr<storage::BlobDataHandle> handle =
227 blob_context->GetBlobDataFromUUID(element.blob_uuid()); 229 blob_context->GetBlobDataFromUUID(element.blob_uuid());
228 if (!handle) 230 if (!handle)
229 return false; 231 return false;
230 blob_handles->push_back(std::move(handle)); 232 blob_handles->push_back(std::move(handle));
231 } 233 }
232 return true; 234 return true;
233 } 235 }
234 236
235 } // namespace content 237 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/blob_storage/chrome_blob_storage_context.h ('k') | content/browser/storage_partition_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698