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

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

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 | Annotate | Revision Log
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/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 10 matching lines...) Expand all
21 #include "content/browser/indexed_db/indexed_db_pending_connection.h" 21 #include "content/browser/indexed_db/indexed_db_pending_connection.h"
22 #include "content/browser/indexed_db/indexed_db_value.h" 22 #include "content/browser/indexed_db/indexed_db_value.h"
23 #include "content/browser/renderer_host/render_message_filter.h" 23 #include "content/browser/renderer_host/render_message_filter.h"
24 #include "content/common/indexed_db/indexed_db_messages.h" 24 #include "content/common/indexed_db/indexed_db_messages.h"
25 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/user_metrics.h" 26 #include "content/public/browser/user_metrics.h"
27 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
28 #include "content/public/common/result_codes.h" 28 #include "content/public/common/result_codes.h"
29 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h" 29 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h"
30 #include "url/gurl.h" 30 #include "url/gurl.h"
31 #include "webkit/browser/blob/blob_storage_context.h" 31 #include "storage/browser/blob/blob_storage_context.h"
32 #include "webkit/browser/database/database_util.h" 32 #include "storage/browser/database/database_util.h"
33 #include "webkit/common/database/database_identifier.h" 33 #include "storage/common/database/database_identifier.h"
34 34
35 using webkit_database::DatabaseUtil; 35 using webkit_database::DatabaseUtil;
36 using blink::WebIDBKey; 36 using blink::WebIDBKey;
37 37
38 namespace content { 38 namespace content {
39 39
40 IndexedDBDispatcherHost::IndexedDBDispatcherHost( 40 IndexedDBDispatcherHost::IndexedDBDispatcherHost(
41 int ipc_process_id, 41 int ipc_process_id,
42 net::URLRequestContextGetter* request_context_getter, 42 net::URLRequestContextGetter* request_context_getter,
43 IndexedDBContextImpl* indexed_db_context, 43 IndexedDBContextImpl* indexed_db_context,
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 // static 206 // static
207 uint32 IndexedDBDispatcherHost::TransactionIdToProcessId( 207 uint32 IndexedDBDispatcherHost::TransactionIdToProcessId(
208 int64 host_transaction_id) { 208 int64 host_transaction_id) {
209 return (host_transaction_id >> 32) & 0xffffffff; 209 return (host_transaction_id >> 32) & 0xffffffff;
210 } 210 }
211 211
212 void IndexedDBDispatcherHost::HoldBlobDataHandle( 212 void IndexedDBDispatcherHost::HoldBlobDataHandle(
213 const std::string& uuid, 213 const std::string& uuid,
214 scoped_ptr<webkit_blob::BlobDataHandle> blob_data_handle) { 214 scoped_ptr<storage::BlobDataHandle> blob_data_handle) {
215 DCHECK(!ContainsKey(blob_data_handle_map_, uuid)); 215 DCHECK(!ContainsKey(blob_data_handle_map_, uuid));
216 blob_data_handle_map_[uuid] = blob_data_handle.release(); 216 blob_data_handle_map_[uuid] = blob_data_handle.release();
217 } 217 }
218 218
219 void IndexedDBDispatcherHost::DropBlobDataHandle(const std::string& uuid) { 219 void IndexedDBDispatcherHost::DropBlobDataHandle(const std::string& uuid) {
220 BlobDataHandleMap::iterator iter = blob_data_handle_map_.find(uuid); 220 BlobDataHandleMap::iterator iter = blob_data_handle_map_.find(uuid);
221 if (iter != blob_data_handle_map_.end()) { 221 if (iter != blob_data_handle_map_.end()) {
222 delete iter->second; 222 delete iter->second;
223 blob_data_handle_map_.erase(iter); 223 blob_data_handle_map_.erase(iter);
224 } else { 224 } else {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 new IndexedDBCallbacks( 333 new IndexedDBCallbacks(
334 this, params.ipc_thread_id, params.ipc_callbacks_id), 334 this, params.ipc_thread_id, params.ipc_callbacks_id),
335 origin_url, 335 origin_url,
336 indexed_db_path); 336 indexed_db_path);
337 } 337 }
338 338
339 // OnPutHelper exists only to allow us to hop threads while holding a reference 339 // OnPutHelper exists only to allow us to hop threads while holding a reference
340 // to the IndexedDBDispatcherHost. 340 // to the IndexedDBDispatcherHost.
341 void IndexedDBDispatcherHost::OnPutHelper( 341 void IndexedDBDispatcherHost::OnPutHelper(
342 const IndexedDBHostMsg_DatabasePut_Params& params, 342 const IndexedDBHostMsg_DatabasePut_Params& params,
343 std::vector<webkit_blob::BlobDataHandle*> handles) { 343 std::vector<storage::BlobDataHandle*> handles) {
344 database_dispatcher_host_->OnPut(params, handles); 344 database_dispatcher_host_->OnPut(params, handles);
345 } 345 }
346 346
347 void IndexedDBDispatcherHost::OnAckReceivedBlobs( 347 void IndexedDBDispatcherHost::OnAckReceivedBlobs(
348 const std::vector<std::string>& uuids) { 348 const std::vector<std::string>& uuids) {
349 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); 349 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread());
350 std::vector<std::string>::const_iterator iter; 350 std::vector<std::string>::const_iterator iter;
351 for (iter = uuids.begin(); iter != uuids.end(); ++iter) 351 for (iter = uuids.begin(); iter != uuids.end(); ++iter)
352 DropBlobDataHandle(*iter); 352 DropBlobDataHandle(*iter);
353 } 353 }
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 parent_->HostTransactionId(params.transaction_id), 609 parent_->HostTransactionId(params.transaction_id),
610 params.object_store_id, 610 params.object_store_id,
611 params.index_id, 611 params.index_id,
612 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)), 612 make_scoped_ptr(new IndexedDBKeyRange(params.key_range)),
613 params.key_only, 613 params.key_only,
614 callbacks); 614 callbacks);
615 } 615 }
616 616
617 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPutWrapper( 617 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPutWrapper(
618 const IndexedDBHostMsg_DatabasePut_Params& params) { 618 const IndexedDBHostMsg_DatabasePut_Params& params) {
619 std::vector<webkit_blob::BlobDataHandle*> handles; 619 std::vector<storage::BlobDataHandle*> handles;
620 for (size_t i = 0; i < params.blob_or_file_info.size(); ++i) { 620 for (size_t i = 0; i < params.blob_or_file_info.size(); ++i) {
621 const IndexedDBMsg_BlobOrFileInfo& info = params.blob_or_file_info[i]; 621 const IndexedDBMsg_BlobOrFileInfo& info = params.blob_or_file_info[i];
622 handles.push_back(parent_->blob_storage_context_->context() 622 handles.push_back(parent_->blob_storage_context_->context()
623 ->GetBlobDataFromUUID(info.uuid) 623 ->GetBlobDataFromUUID(info.uuid)
624 .release()); 624 .release());
625 } 625 }
626 parent_->indexed_db_context_->TaskRunner()->PostTask( 626 parent_->indexed_db_context_->TaskRunner()->PostTask(
627 FROM_HERE, 627 FROM_HERE,
628 base::Bind( 628 base::Bind(
629 &IndexedDBDispatcherHost::OnPutHelper, parent_, params, handles)); 629 &IndexedDBDispatcherHost::OnPutHelper, parent_, params, handles));
630 } 630 }
631 631
632 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPut( 632 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPut(
633 const IndexedDBHostMsg_DatabasePut_Params& params, 633 const IndexedDBHostMsg_DatabasePut_Params& params,
634 std::vector<webkit_blob::BlobDataHandle*> handles) { 634 std::vector<storage::BlobDataHandle*> handles) {
635
636 DCHECK( 635 DCHECK(
637 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); 636 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread());
638 637
639 ScopedVector<webkit_blob::BlobDataHandle> scoped_handles; 638 ScopedVector<storage::BlobDataHandle> scoped_handles;
640 scoped_handles.swap(handles); 639 scoped_handles.swap(handles);
641 640
642 IndexedDBConnection* connection = 641 IndexedDBConnection* connection =
643 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id); 642 parent_->GetOrTerminateProcess(&map_, params.ipc_database_id);
644 if (!connection || !connection->IsConnected()) 643 if (!connection || !connection->IsConnected())
645 return; 644 return;
646 scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( 645 scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks(
647 parent_, params.ipc_thread_id, params.ipc_callbacks_id)); 646 parent_, params.ipc_thread_id, params.ipc_callbacks_id));
648 647
649 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); 648 int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id);
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 } 990 }
992 991
993 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( 992 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed(
994 int32 ipc_object_id) { 993 int32 ipc_object_id) {
995 DCHECK( 994 DCHECK(
996 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); 995 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread());
997 parent_->DestroyObject(&map_, ipc_object_id); 996 parent_->DestroyObject(&map_, ipc_object_id);
998 } 997 }
999 998
1000 } // namespace content 999 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_dispatcher_host.h ('k') | content/browser/indexed_db/indexed_db_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698