OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/renderer/indexed_db/renderer_webidbindex_impl.h" | |
6 | |
7 #include "content/common/indexed_db/indexed_db_messages.h" | |
8 #include "content/renderer/indexed_db/indexed_db_dispatcher.h" | |
9 #include "content/renderer/indexed_db/renderer_webidbtransaction_impl.h" | |
10 #include "content/renderer/render_thread_impl.h" | |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | |
13 | |
14 using WebKit::WebExceptionCode; | |
15 using WebKit::WebDOMStringList; | |
16 using WebKit::WebString; | |
17 using WebKit::WebVector; | |
18 | |
19 RendererWebIDBIndexImpl::RendererWebIDBIndexImpl(int32 idb_index_id) | |
20 : idb_index_id_(idb_index_id) { | |
21 } | |
22 | |
23 RendererWebIDBIndexImpl::~RendererWebIDBIndexImpl() { | |
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 | |
26 // this object. But, if that ever changed, then we'd need to invalidate | |
27 // any such pointers. | |
28 ChildThread::current()->Send(new IndexedDBHostMsg_IndexDestroyed( | |
29 idb_index_id_)); | |
30 } | |
31 | |
32 WebString RendererWebIDBIndexImpl::name() const { | |
33 string16 result; | |
34 ChildThread::current()->Send( | |
35 new IndexedDBHostMsg_IndexName(idb_index_id_, &result)); | |
36 return result; | |
37 } | |
38 | |
39 WebString RendererWebIDBIndexImpl::storeName() const { | |
40 string16 result; | |
41 ChildThread::current()->Send( | |
42 new IndexedDBHostMsg_IndexStoreName(idb_index_id_, &result)); | |
43 return result; | |
44 } | |
45 | |
46 WebString RendererWebIDBIndexImpl::keyPath() const { | |
47 NullableString16 result; | |
48 ChildThread::current()->Send( | |
49 new IndexedDBHostMsg_IndexKeyPath(idb_index_id_, &result)); | |
50 return result; | |
51 } | |
52 | |
53 bool RendererWebIDBIndexImpl::unique() const { | |
54 bool result; | |
55 ChildThread::current()->Send( | |
56 new IndexedDBHostMsg_IndexUnique(idb_index_id_, &result)); | |
57 return result; | |
58 } | |
59 | |
60 bool RendererWebIDBIndexImpl::multiEntry() const { | |
61 bool result; | |
62 ChildThread::current()->Send( | |
63 new IndexedDBHostMsg_IndexMultiEntry(idb_index_id_, &result)); | |
64 return result; | |
65 } | |
66 | |
67 void RendererWebIDBIndexImpl::openObjectCursor( | |
68 const WebKit::WebIDBKeyRange& range, | |
69 unsigned short direction, | |
70 WebKit::WebIDBCallbacks* callbacks, | |
71 const WebKit::WebIDBTransaction& transaction, | |
72 WebExceptionCode& ec) { | |
73 IndexedDBDispatcher* dispatcher = | |
74 IndexedDBDispatcher::ThreadSpecificInstance(); | |
75 dispatcher->RequestIDBIndexOpenObjectCursor( | |
76 range, direction, callbacks, idb_index_id_, transaction, &ec); | |
77 } | |
78 | |
79 void RendererWebIDBIndexImpl::openKeyCursor( | |
80 const WebKit::WebIDBKeyRange& range, | |
81 unsigned short direction, | |
82 WebKit::WebIDBCallbacks* callbacks, | |
83 const WebKit::WebIDBTransaction& transaction, | |
84 WebExceptionCode& ec) { | |
85 IndexedDBDispatcher* dispatcher = | |
86 IndexedDBDispatcher::ThreadSpecificInstance(); | |
87 dispatcher->RequestIDBIndexOpenKeyCursor( | |
88 range, direction, callbacks, idb_index_id_, transaction, &ec); | |
89 } | |
90 | |
91 void RendererWebIDBIndexImpl::count( | |
92 const WebKit::WebIDBKeyRange& range, | |
93 WebKit::WebIDBCallbacks* callbacks, | |
94 const WebKit::WebIDBTransaction& transaction, | |
95 WebExceptionCode& ec) { | |
96 IndexedDBDispatcher* dispatcher = | |
97 IndexedDBDispatcher::ThreadSpecificInstance(); | |
98 dispatcher->RequestIDBIndexCount( | |
99 range, callbacks, idb_index_id_, transaction, &ec); | |
100 } | |
101 | |
102 void RendererWebIDBIndexImpl::getObject( | |
103 const WebKit::WebIDBKey& key, | |
104 WebKit::WebIDBCallbacks* callbacks, | |
105 const WebKit::WebIDBTransaction& transaction, | |
106 WebExceptionCode& ec) { | |
107 IndexedDBDispatcher* dispatcher = | |
108 IndexedDBDispatcher::ThreadSpecificInstance(); | |
109 dispatcher->RequestIDBIndexGetObject( | |
110 IndexedDBKey(key), callbacks, idb_index_id_, transaction, &ec); | |
111 } | |
112 | |
113 void RendererWebIDBIndexImpl::getKey( | |
114 const WebKit::WebIDBKey& key, | |
115 WebKit::WebIDBCallbacks* callbacks, | |
116 const WebKit::WebIDBTransaction& transaction, | |
117 WebExceptionCode& ec) { | |
118 IndexedDBDispatcher* dispatcher = | |
119 IndexedDBDispatcher::ThreadSpecificInstance(); | |
120 dispatcher->RequestIDBIndexGetKey( | |
121 IndexedDBKey(key), callbacks, idb_index_id_, transaction, &ec); | |
122 } | |
OLD | NEW |