OLD | NEW |
---|---|
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_webidbcursor_impl.h" | 5 #include "content/renderer/renderer_webidbcursor_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 | 10 |
(...skipping 11 matching lines...) Expand all Loading... | |
22 value_(value) { | 22 value_(value) { |
23 } | 23 } |
24 | 24 |
25 RendererWebIDBCursorImpl::~RendererWebIDBCursorImpl() { | 25 RendererWebIDBCursorImpl::~RendererWebIDBCursorImpl() { |
26 // It's not possible for there to be pending callbacks that address this | 26 // It's not possible for there to be pending callbacks that address this |
27 // object since inside WebKit, they hold a reference to the object wich owns | 27 // object since inside WebKit, they hold a reference to the object wich owns |
28 // this object. But, if that ever changed, then we'd need to invalidate | 28 // this object. But, if that ever changed, then we'd need to invalidate |
29 // any such pointers. | 29 // any such pointers. |
30 RenderThreadImpl::current()->Send(new IndexedDBHostMsg_CursorDestroyed( | 30 RenderThreadImpl::current()->Send(new IndexedDBHostMsg_CursorDestroyed( |
31 idb_cursor_id_)); | 31 idb_cursor_id_)); |
32 IndexedDBDispatcher* dispatcher = | |
33 RenderThreadImpl::current()->indexed_db_dispatcher(); | |
34 dispatcher->CursorDestroyed(idb_cursor_id_); | |
32 } | 35 } |
33 | 36 |
34 unsigned short RendererWebIDBCursorImpl::direction() const { | 37 unsigned short RendererWebIDBCursorImpl::direction() const { |
35 int direction; | 38 int direction; |
36 RenderThreadImpl::current()->Send( | 39 RenderThreadImpl::current()->Send( |
37 new IndexedDBHostMsg_CursorDirection(idb_cursor_id_, &direction)); | 40 new IndexedDBHostMsg_CursorDirection(idb_cursor_id_, &direction)); |
38 return direction; | 41 return direction; |
39 } | 42 } |
40 | 43 |
41 WebIDBKey RendererWebIDBCursorImpl::key() const { | 44 WebIDBKey RendererWebIDBCursorImpl::key() const { |
42 return key_; | 45 IndexedDBDispatcher* dispatcher = |
dgrogan
2011/10/29 00:54:28
I think you can delete these data members.
hans
2011/10/31 16:11:52
Letting them stay, and removing the maps in the di
| |
46 RenderThreadImpl::current()->indexed_db_dispatcher(); | |
47 return dispatcher->getCursorKey(idb_cursor_id_); | |
43 } | 48 } |
44 | 49 |
45 WebIDBKey RendererWebIDBCursorImpl::primaryKey() const { | 50 WebIDBKey RendererWebIDBCursorImpl::primaryKey() const { |
46 return primary_key_; | 51 IndexedDBDispatcher* dispatcher = |
52 RenderThreadImpl::current()->indexed_db_dispatcher(); | |
53 return dispatcher->getCursorPrimaryKey(idb_cursor_id_); | |
47 } | 54 } |
48 | 55 |
49 WebSerializedScriptValue RendererWebIDBCursorImpl::value() const { | 56 WebSerializedScriptValue RendererWebIDBCursorImpl::value() const { |
50 return value_; | 57 IndexedDBDispatcher* dispatcher = |
58 RenderThreadImpl::current()->indexed_db_dispatcher(); | |
59 return dispatcher->getCursorValue(idb_cursor_id_); | |
51 } | 60 } |
52 | 61 |
53 void RendererWebIDBCursorImpl::update(const WebSerializedScriptValue& value, | 62 void RendererWebIDBCursorImpl::update(const WebSerializedScriptValue& value, |
54 WebIDBCallbacks* callbacks, | 63 WebIDBCallbacks* callbacks, |
55 WebExceptionCode& ec) { | 64 WebExceptionCode& ec) { |
56 IndexedDBDispatcher* dispatcher = | 65 IndexedDBDispatcher* dispatcher = |
57 RenderThreadImpl::current()->indexed_db_dispatcher(); | 66 RenderThreadImpl::current()->indexed_db_dispatcher(); |
58 dispatcher->RequestIDBCursorUpdate( | 67 dispatcher->RequestIDBCursorUpdate( |
59 content::SerializedScriptValue(value), callbacks, idb_cursor_id_, &ec); | 68 content::SerializedScriptValue(value), callbacks, idb_cursor_id_, &ec); |
60 } | 69 } |
61 | 70 |
62 void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key, | 71 void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key, |
63 WebIDBCallbacks* callbacks, | 72 WebIDBCallbacks* callbacks, |
64 WebExceptionCode& ec) { | 73 WebExceptionCode& ec) { |
65 IndexedDBDispatcher* dispatcher = | 74 IndexedDBDispatcher* dispatcher = |
66 RenderThreadImpl::current()->indexed_db_dispatcher(); | 75 RenderThreadImpl::current()->indexed_db_dispatcher(); |
67 dispatcher->RequestIDBCursorContinue(IndexedDBKey(key), callbacks, | 76 dispatcher->RequestIDBCursorContinue(IndexedDBKey(key), callbacks, |
68 idb_cursor_id_, &ec); | 77 idb_cursor_id_, &ec); |
69 } | 78 } |
70 | 79 |
71 void RendererWebIDBCursorImpl::deleteFunction(WebIDBCallbacks* callbacks, | 80 void RendererWebIDBCursorImpl::deleteFunction(WebIDBCallbacks* callbacks, |
72 WebExceptionCode& ec) { | 81 WebExceptionCode& ec) { |
73 IndexedDBDispatcher* dispatcher = | 82 IndexedDBDispatcher* dispatcher = |
74 RenderThreadImpl::current()->indexed_db_dispatcher(); | 83 RenderThreadImpl::current()->indexed_db_dispatcher(); |
75 dispatcher->RequestIDBCursorDelete(callbacks, idb_cursor_id_, &ec); | 84 dispatcher->RequestIDBCursorDelete(callbacks, idb_cursor_id_, &ec); |
76 } | 85 } |
OLD | NEW |