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

Side by Side Diff: content/renderer/renderer_webidbdatabase_impl.cc

Issue 8747002: Dispatch IndexedDB IPC messages to worker threads (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: repurpose obsolete indexed-db switch to control idb on workers Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer/renderer_webidbdatabase_impl.h" 5 #include "content/renderer/renderer_webidbdatabase_impl.h"
6 6
7 #include "content/common/indexed_db_messages.h" 7 #include "content/common/indexed_db_messages.h"
8 #include "content/renderer/indexed_db_dispatcher.h" 8 #include "content/renderer/indexed_db_dispatcher.h"
9 #include "content/renderer/render_thread_impl.h" 9 #include "content/renderer/render_thread_impl.h"
10 #include "content/renderer/renderer_webidbobjectstore_impl.h" 10 #include "content/renderer/renderer_webidbobjectstore_impl.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 new IndexedDBHostMsg_DatabaseDeleteObjectStore( 90 new IndexedDBHostMsg_DatabaseDeleteObjectStore(
91 idb_database_id_, name, 91 idb_database_id_, name,
92 IndexedDBDispatcher::TransactionId(transaction), &ec)); 92 IndexedDBDispatcher::TransactionId(transaction), &ec));
93 } 93 }
94 94
95 void RendererWebIDBDatabaseImpl::setVersion( 95 void RendererWebIDBDatabaseImpl::setVersion(
96 const WebString& version, 96 const WebString& version,
97 WebIDBCallbacks* callbacks, 97 WebIDBCallbacks* callbacks,
98 WebExceptionCode& ec) { 98 WebExceptionCode& ec) {
99 IndexedDBDispatcher* dispatcher = 99 IndexedDBDispatcher* dispatcher =
100 RenderThreadImpl::current()->indexed_db_dispatcher(); 100 ChildThread::current()->indexed_db_dispatcher();
101 dispatcher->RequestIDBDatabaseSetVersion( 101 dispatcher->RequestIDBDatabaseSetVersion(
102 version, callbacks, idb_database_id_, &ec); 102 version, callbacks, idb_database_id_, &ec);
103 } 103 }
104 104
105 WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::transaction( 105 WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::transaction(
106 const WebDOMStringList& names, 106 const WebDOMStringList& names,
107 unsigned short mode, 107 unsigned short mode,
108 WebExceptionCode& ec) { 108 WebExceptionCode& ec) {
109 std::vector<string16> object_stores; 109 std::vector<string16> object_stores;
110 object_stores.reserve(names.length()); 110 object_stores.reserve(names.length());
111 for (unsigned int i = 0; i < names.length(); ++i) 111 for (unsigned int i = 0; i < names.length(); ++i)
112 object_stores.push_back(names.item(i)); 112 object_stores.push_back(names.item(i));
113 113
114 int transaction_id; 114 int transaction_id;
115 ChildThread::current()->Send( 115 ChildThread::current()->Send(new IndexedDBHostMsg_DatabaseTransaction(
116 new IndexedDBHostMsg_DatabaseTransaction( 116 idb_database_id_, object_stores, mode, &transaction_id, &ec));
117 idb_database_id_, object_stores, mode,
118 &transaction_id, &ec));
119 if (!transaction_id) 117 if (!transaction_id)
120 return NULL; 118 return NULL;
121 return new RendererWebIDBTransactionImpl(transaction_id); 119 return new RendererWebIDBTransactionImpl(transaction_id);
122 } 120 }
123 121
124 void RendererWebIDBDatabaseImpl::close() { 122 void RendererWebIDBDatabaseImpl::close() {
125 IndexedDBDispatcher* dispatcher = 123 IndexedDBDispatcher* dispatcher =
126 RenderThreadImpl::current()->indexed_db_dispatcher(); 124 ChildThread::current()->indexed_db_dispatcher();
127 dispatcher->RequestIDBDatabaseClose(idb_database_id_); 125 dispatcher->RequestIDBDatabaseClose(idb_database_id_);
128 } 126 }
129 127
130 void RendererWebIDBDatabaseImpl::open(WebIDBDatabaseCallbacks* callbacks) { 128 void RendererWebIDBDatabaseImpl::open(WebIDBDatabaseCallbacks* callbacks) {
131 IndexedDBDispatcher* dispatcher = 129 IndexedDBDispatcher* dispatcher =
132 RenderThreadImpl::current()->indexed_db_dispatcher(); 130 ChildThread::current()->indexed_db_dispatcher();
131 DCHECK(dispatcher);
133 dispatcher->RequestIDBDatabaseOpen(callbacks, idb_database_id_); 132 dispatcher->RequestIDBDatabaseOpen(callbacks, idb_database_id_);
134 } 133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698