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

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

Issue 8400061: IndexedDB: Recycle cursor objects when calling continue(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: New version Created 9 years, 1 month 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_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
11 using WebKit::WebExceptionCode; 11 using WebKit::WebExceptionCode;
12 using WebKit::WebIDBCallbacks; 12 using WebKit::WebIDBCallbacks;
13 using WebKit::WebIDBKey; 13 using WebKit::WebIDBKey;
14 using WebKit::WebSerializedScriptValue; 14 using WebKit::WebSerializedScriptValue;
15 15
16 RendererWebIDBCursorImpl::RendererWebIDBCursorImpl(int32 idb_cursor_id, 16 RendererWebIDBCursorImpl::RendererWebIDBCursorImpl(int32 idb_cursor_id)
17 const IndexedDBKey& key, const IndexedDBKey& primary_key, 17 : idb_cursor_id_(idb_cursor_id) {
18 const content::SerializedScriptValue& value)
19 : idb_cursor_id_(idb_cursor_id),
20 key_(key),
21 primary_key_(primary_key),
22 value_(value) {
23 } 18 }
24 19
25 RendererWebIDBCursorImpl::~RendererWebIDBCursorImpl() { 20 RendererWebIDBCursorImpl::~RendererWebIDBCursorImpl() {
26 // It's not possible for there to be pending callbacks that address this 21 // 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 22 // 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 23 // this object. But, if that ever changed, then we'd need to invalidate
29 // any such pointers. 24 // any such pointers.
30 RenderThreadImpl::current()->Send(new IndexedDBHostMsg_CursorDestroyed( 25 RenderThreadImpl::current()->Send(new IndexedDBHostMsg_CursorDestroyed(
31 idb_cursor_id_)); 26 idb_cursor_id_));
27 IndexedDBDispatcher* dispatcher =
28 RenderThreadImpl::current()->indexed_db_dispatcher();
29 dispatcher->CursorDestroyed(idb_cursor_id_);
32 } 30 }
33 31
34 unsigned short RendererWebIDBCursorImpl::direction() const { 32 unsigned short RendererWebIDBCursorImpl::direction() const {
35 int direction; 33 int direction;
36 RenderThreadImpl::current()->Send( 34 RenderThreadImpl::current()->Send(
37 new IndexedDBHostMsg_CursorDirection(idb_cursor_id_, &direction)); 35 new IndexedDBHostMsg_CursorDirection(idb_cursor_id_, &direction));
38 return direction; 36 return direction;
39 } 37 }
40 38
41 WebIDBKey RendererWebIDBCursorImpl::key() const { 39 WebIDBKey RendererWebIDBCursorImpl::key() const {
(...skipping 25 matching lines...) Expand all
67 dispatcher->RequestIDBCursorContinue(IndexedDBKey(key), callbacks, 65 dispatcher->RequestIDBCursorContinue(IndexedDBKey(key), callbacks,
68 idb_cursor_id_, &ec); 66 idb_cursor_id_, &ec);
69 } 67 }
70 68
71 void RendererWebIDBCursorImpl::deleteFunction(WebIDBCallbacks* callbacks, 69 void RendererWebIDBCursorImpl::deleteFunction(WebIDBCallbacks* callbacks,
72 WebExceptionCode& ec) { 70 WebExceptionCode& ec) {
73 IndexedDBDispatcher* dispatcher = 71 IndexedDBDispatcher* dispatcher =
74 RenderThreadImpl::current()->indexed_db_dispatcher(); 72 RenderThreadImpl::current()->indexed_db_dispatcher();
75 dispatcher->RequestIDBCursorDelete(callbacks, idb_cursor_id_, &ec); 73 dispatcher->RequestIDBCursorDelete(callbacks, idb_cursor_id_, &ec);
76 } 74 }
75
76 void RendererWebIDBCursorImpl::setKeyAndValue(const IndexedDBKey& key,
michaeln 2011/10/31 18:58:25 nit: args should all line up
hans 2011/11/01 14:57:45 Done.
77 const IndexedDBKey& primary_key,
78 const content::SerializedScriptValue& value) {
79 key_ = key;
80 primary_key_ = primary_key;
81 value_ = value;
82 }
OLDNEW
« content/renderer/indexed_db_dispatcher.cc ('K') | « content/renderer/renderer_webidbcursor_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698