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

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

Issue 8747002: Dispatch IndexedDB IPC messages to worker threads (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_webidbindex_impl.h" 5 #include "content/renderer/renderer_webidbindex_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_webidbtransaction_impl.h" 10 #include "content/renderer/renderer_webidbtransaction_impl.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h"
13 13
14 using WebKit::WebExceptionCode; 14 using WebKit::WebExceptionCode;
15 using WebKit::WebDOMStringList; 15 using WebKit::WebDOMStringList;
16 using WebKit::WebString; 16 using WebKit::WebString;
17 using WebKit::WebVector; 17 using WebKit::WebVector;
18 18
19 RendererWebIDBIndexImpl::RendererWebIDBIndexImpl(int32 idb_index_id) 19 RendererWebIDBIndexImpl::RendererWebIDBIndexImpl(int32 idb_index_id)
20 : idb_index_id_(idb_index_id) { 20 : idb_index_id_(idb_index_id) {
21 } 21 }
22 22
23 RendererWebIDBIndexImpl::~RendererWebIDBIndexImpl() { 23 RendererWebIDBIndexImpl::~RendererWebIDBIndexImpl() {
24 // It's not possible for there to be pending callbacks that address this 24 // It's not possible for there to be pending callbacks that address this
25 // object since inside WebKit, they hold a reference to the object wich owns 25 // object since inside WebKit, they hold a reference to the object wich owns
26 // this object. But, if that ever changed, then we'd need to invalidate 26 // this object. But, if that ever changed, then we'd need to invalidate
27 // any such pointers. 27 // any such pointers.
28 RenderThreadImpl::current()->Send(new IndexedDBHostMsg_IndexDestroyed( 28 ChildThread::current()->Send(new IndexedDBHostMsg_IndexDestroyed(
29 idb_index_id_)); 29 idb_index_id_));
30 } 30 }
31 31
32 WebString RendererWebIDBIndexImpl::name() const { 32 WebString RendererWebIDBIndexImpl::name() const {
33 string16 result; 33 string16 result;
34 RenderThreadImpl::current()->Send( 34 ChildThread::current()->Send(
35 new IndexedDBHostMsg_IndexName(idb_index_id_, &result)); 35 new IndexedDBHostMsg_IndexName(idb_index_id_, &result));
36 return result; 36 return result;
37 } 37 }
38 38
39 WebString RendererWebIDBIndexImpl::storeName() const { 39 WebString RendererWebIDBIndexImpl::storeName() const {
40 string16 result; 40 string16 result;
41 RenderThreadImpl::current()->Send( 41 ChildThread::current()->Send(
42 new IndexedDBHostMsg_IndexStoreName(idb_index_id_, &result)); 42 new IndexedDBHostMsg_IndexStoreName(idb_index_id_, &result));
43 return result; 43 return result;
44 } 44 }
45 45
46 WebString RendererWebIDBIndexImpl::keyPath() const { 46 WebString RendererWebIDBIndexImpl::keyPath() const {
47 NullableString16 result; 47 NullableString16 result;
48 RenderThreadImpl::current()->Send( 48 ChildThread::current()->Send(
49 new IndexedDBHostMsg_IndexKeyPath(idb_index_id_, &result)); 49 new IndexedDBHostMsg_IndexKeyPath(idb_index_id_, &result));
50 return result; 50 return result;
51 } 51 }
52 52
53 bool RendererWebIDBIndexImpl::unique() const { 53 bool RendererWebIDBIndexImpl::unique() const {
54 bool result; 54 bool result;
55 RenderThreadImpl::current()->Send( 55 ChildThread::current()->Send(
56 new IndexedDBHostMsg_IndexUnique(idb_index_id_, &result)); 56 new IndexedDBHostMsg_IndexUnique(idb_index_id_, &result));
57 return result; 57 return result;
58 } 58 }
59 59
60 void RendererWebIDBIndexImpl::openObjectCursor( 60 void RendererWebIDBIndexImpl::openObjectCursor(
61 const WebKit::WebIDBKeyRange& range, 61 const WebKit::WebIDBKeyRange& range,
62 unsigned short direction, 62 unsigned short direction,
63 WebKit::WebIDBCallbacks* callbacks, 63 WebKit::WebIDBCallbacks* callbacks,
64 const WebKit::WebIDBTransaction& transaction, 64 const WebKit::WebIDBTransaction& transaction,
65 WebExceptionCode& ec) { 65 WebExceptionCode& ec) {
66 IndexedDBDispatcher* dispatcher = 66 IndexedDBDispatcher* dispatcher =
67 RenderThreadImpl::current()->indexed_db_dispatcher(); 67 ChildThread::current()->indexed_db_dispatcher();
68 dispatcher->RequestIDBIndexOpenObjectCursor( 68 dispatcher->RequestIDBIndexOpenObjectCursor(
69 range, direction, callbacks, idb_index_id_, transaction, &ec); 69 range, direction, callbacks, idb_index_id_, transaction, &ec);
70 } 70 }
71 71
72 void RendererWebIDBIndexImpl::openKeyCursor( 72 void RendererWebIDBIndexImpl::openKeyCursor(
73 const WebKit::WebIDBKeyRange& range, 73 const WebKit::WebIDBKeyRange& range,
74 unsigned short direction, 74 unsigned short direction,
75 WebKit::WebIDBCallbacks* callbacks, 75 WebKit::WebIDBCallbacks* callbacks,
76 const WebKit::WebIDBTransaction& transaction, 76 const WebKit::WebIDBTransaction& transaction,
77 WebExceptionCode& ec) { 77 WebExceptionCode& ec) {
78 IndexedDBDispatcher* dispatcher = 78 IndexedDBDispatcher* dispatcher =
79 RenderThreadImpl::current()->indexed_db_dispatcher(); 79 ChildThread::current()->indexed_db_dispatcher();
80 dispatcher->RequestIDBIndexOpenKeyCursor( 80 dispatcher->RequestIDBIndexOpenKeyCursor(
81 range, direction, callbacks, idb_index_id_, transaction, &ec); 81 range, direction, callbacks, idb_index_id_, transaction, &ec);
82 } 82 }
83 83
84 void RendererWebIDBIndexImpl::getObject( 84 void RendererWebIDBIndexImpl::getObject(
85 const WebKit::WebIDBKey& key, 85 const WebKit::WebIDBKey& key,
86 WebKit::WebIDBCallbacks* callbacks, 86 WebKit::WebIDBCallbacks* callbacks,
87 const WebKit::WebIDBTransaction& transaction, 87 const WebKit::WebIDBTransaction& transaction,
88 WebExceptionCode& ec) { 88 WebExceptionCode& ec) {
89 IndexedDBDispatcher* dispatcher = 89 IndexedDBDispatcher* dispatcher =
90 RenderThreadImpl::current()->indexed_db_dispatcher(); 90 ChildThread::current()->indexed_db_dispatcher();
91 dispatcher->RequestIDBIndexGetObject( 91 dispatcher->RequestIDBIndexGetObject(
92 IndexedDBKey(key), callbacks, idb_index_id_, transaction, &ec); 92 IndexedDBKey(key), callbacks, idb_index_id_, transaction, &ec);
93 } 93 }
94 94
95 void RendererWebIDBIndexImpl::getKey( 95 void RendererWebIDBIndexImpl::getKey(
96 const WebKit::WebIDBKey& key, 96 const WebKit::WebIDBKey& key,
97 WebKit::WebIDBCallbacks* callbacks, 97 WebKit::WebIDBCallbacks* callbacks,
98 const WebKit::WebIDBTransaction& transaction, 98 const WebKit::WebIDBTransaction& transaction,
99 WebExceptionCode& ec) { 99 WebExceptionCode& ec) {
100 IndexedDBDispatcher* dispatcher = 100 IndexedDBDispatcher* dispatcher =
101 RenderThreadImpl::current()->indexed_db_dispatcher(); 101 ChildThread::current()->indexed_db_dispatcher();
102 dispatcher->RequestIDBIndexGetKey( 102 dispatcher->RequestIDBIndexGetKey(
103 IndexedDBKey(key), callbacks, idb_index_id_, transaction, &ec); 103 IndexedDBKey(key), callbacks, idb_index_id_, transaction, &ec);
104 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698