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

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

Issue 810403004: [Storage] Blob Storage Refactoring pt 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Snapshots now created by the Handle, one more rename Created 5 years, 11 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/indexed_db/indexed_db_dispatcher_host.h" 5 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 219 }
220 220
221 std::string IndexedDBDispatcherHost::HoldBlobData( 221 std::string IndexedDBDispatcherHost::HoldBlobData(
222 const IndexedDBBlobInfo& blob_info) { 222 const IndexedDBBlobInfo& blob_info) {
223 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 223 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
224 std::string uuid = blob_info.uuid(); 224 std::string uuid = blob_info.uuid();
225 storage::BlobStorageContext* context = blob_storage_context_->context(); 225 storage::BlobStorageContext* context = blob_storage_context_->context();
226 scoped_ptr<storage::BlobDataHandle> blob_data_handle; 226 scoped_ptr<storage::BlobDataHandle> blob_data_handle;
227 if (uuid.empty()) { 227 if (uuid.empty()) {
228 uuid = base::GenerateGUID(); 228 uuid = base::GenerateGUID();
229 scoped_refptr<storage::BlobData> blob_data = new storage::BlobData(uuid); 229 scoped_ptr<storage::BlobDataBuilder> blob_data(
michaeln 2015/01/21 01:46:41 instead of heap allocaing it, could BlobDataBuilde
dmurph 2015/01/21 22:40:11 Done.
230 new storage::BlobDataBuilder(uuid));
230 blob_data->set_content_type(base::UTF16ToUTF8(blob_info.type())); 231 blob_data->set_content_type(base::UTF16ToUTF8(blob_info.type()));
231 blob_data->AppendFile(blob_info.file_path(), 0, blob_info.size(), 232 blob_data->AppendFile(blob_info.file_path(), 0, blob_info.size(),
232 blob_info.last_modified()); 233 blob_info.last_modified());
233 blob_data_handle = context->AddFinishedBlob(blob_data.get()); 234 blob_data_handle = context->AddFinishedBlob(*blob_data.get());
michaeln 2015/01/21 01:46:41 so readers don't have to decrypt *smart.get()
dmurph 2015/01/21 22:40:11 Done.
234 } else { 235 } else {
235 auto iter = blob_data_handle_map_.find(uuid); 236 auto iter = blob_data_handle_map_.find(uuid);
236 if (iter != blob_data_handle_map_.end()) { 237 if (iter != blob_data_handle_map_.end()) {
237 iter->second.second += 1; 238 iter->second.second += 1;
238 return uuid; 239 return uuid;
239 } 240 }
240 blob_data_handle = context->GetBlobDataFromUUID(uuid); 241 blob_data_handle = context->GetBlobDataFromUUID(uuid);
241 } 242 }
242 243
243 DCHECK(!ContainsKey(blob_data_handle_map_, uuid)); 244 DCHECK(!ContainsKey(blob_data_handle_map_, uuid));
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 } 1022 }
1022 1023
1023 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( 1024 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed(
1024 int32 ipc_object_id) { 1025 int32 ipc_object_id) {
1025 DCHECK( 1026 DCHECK(
1026 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); 1027 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread());
1027 parent_->DestroyObject(&map_, ipc_object_id); 1028 parent_->DestroyObject(&map_, ipc_object_id);
1028 } 1029 }
1029 1030
1030 } // namespace content 1031 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698