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

Side by Side Diff: content/common/indexed_db/indexed_db_dispatcher.cc

Issue 10834039: Plumb through the rest of OnSuccessWithKey (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 months 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
« no previous file with comments | « content/common/indexed_db/indexed_db_dispatcher.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/common/indexed_db/indexed_db_dispatcher.h" 5 #include "content/common/indexed_db/indexed_db_dispatcher.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/threading/thread_local.h" 8 #include "base/threading/thread_local.h"
9 #include "content/common/child_thread.h" 9 #include "content/common/child_thread.h"
10 #include "content/common/indexed_db/indexed_db_messages.h" 10 #include "content/common/indexed_db/indexed_db_messages.h"
11 #include "content/common/indexed_db/proxy_webidbcursor_impl.h" 11 #include "content/common/indexed_db/proxy_webidbcursor_impl.h"
12 #include "content/common/indexed_db/proxy_webidbdatabase_impl.h" 12 #include "content/common/indexed_db/proxy_webidbdatabase_impl.h"
13 #include "content/common/indexed_db/proxy_webidbindex_impl.h" 13 #include "content/common/indexed_db/proxy_webidbindex_impl.h"
14 #include "content/common/indexed_db/proxy_webidbobjectstore_impl.h" 14 #include "content/common/indexed_db/proxy_webidbobjectstore_impl.h"
15 #include "content/common/indexed_db/proxy_webidbtransaction_impl.h" 15 #include "content/common/indexed_db/proxy_webidbtransaction_impl.h"
16 #include "ipc/ipc_channel.h" 16 #include "ipc/ipc_channel.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac ks.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac ks.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h " 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h "
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseExcepti on.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseExcepti on.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h"
22 22
23 using base::ThreadLocalPointer; 23 using base::ThreadLocalPointer;
24 using content::IndexedDBKey; 24 using content::IndexedDBKey;
25 using content::IndexedDBKeyPath;
25 using content::IndexedDBKeyRange; 26 using content::IndexedDBKeyRange;
26 using content::SerializedScriptValue; 27 using content::SerializedScriptValue;
27 using WebKit::WebDOMStringList; 28 using WebKit::WebDOMStringList;
28 using WebKit::WebExceptionCode; 29 using WebKit::WebExceptionCode;
29 using WebKit::WebFrame; 30 using WebKit::WebFrame;
30 using WebKit::WebIDBCallbacks; 31 using WebKit::WebIDBCallbacks;
31 using WebKit::WebIDBKeyRange; 32 using WebKit::WebIDBKeyRange;
32 using WebKit::WebIDBDatabase; 33 using WebKit::WebIDBDatabase;
33 using WebKit::WebIDBDatabaseCallbacks; 34 using WebKit::WebIDBDatabaseCallbacks;
34 using WebKit::WebIDBDatabaseError; 35 using WebKit::WebIDBDatabaseError;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBDatabase, 93 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBDatabase,
93 OnSuccessIDBDatabase) 94 OnSuccessIDBDatabase)
94 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIndexedDBKey, 95 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIndexedDBKey,
95 OnSuccessIndexedDBKey) 96 OnSuccessIndexedDBKey)
96 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBTransaction, 97 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBTransaction,
97 OnSuccessIDBTransaction) 98 OnSuccessIDBTransaction)
98 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessStringList, 99 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessStringList,
99 OnSuccessStringList) 100 OnSuccessStringList)
100 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, 101 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValue,
101 OnSuccessSerializedScriptValue) 102 OnSuccessSerializedScriptValue)
103 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValueWithKe y,
104 OnSuccessSerializedScriptValueWithKey)
102 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) 105 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError)
103 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksBlocked, OnBlocked) 106 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksBlocked, OnBlocked)
104 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort) 107 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort)
105 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete) 108 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete)
106 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksVersionChange, 109 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksVersionChange,
107 OnVersionChange) 110 OnVersionChange)
108 IPC_MESSAGE_UNHANDLED(handled = false) 111 IPC_MESSAGE_UNHANDLED(handled = false)
109 IPC_END_MESSAGE_MAP() 112 IPC_END_MESSAGE_MAP()
110 // If a message gets here, IndexedDBMessageFilter already determined that it 113 // If a message gets here, IndexedDBMessageFilter already determined that it
111 // is an IndexedDB message. 114 // is an IndexedDB message.
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 int32 thread_id, int32 response_id, 601 int32 thread_id, int32 response_id,
599 const SerializedScriptValue& value) { 602 const SerializedScriptValue& value) {
600 DCHECK_EQ(thread_id, CurrentWorkerId()); 603 DCHECK_EQ(thread_id, CurrentWorkerId());
601 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); 604 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
602 if (!callbacks) 605 if (!callbacks)
603 return; 606 return;
604 callbacks->onSuccess(value); 607 callbacks->onSuccess(value);
605 pending_callbacks_.Remove(response_id); 608 pending_callbacks_.Remove(response_id);
606 } 609 }
607 610
611 void IndexedDBDispatcher::OnSuccessSerializedScriptValueWithKey(
612 int32 thread_id, int32 response_id,
613 const SerializedScriptValue& value,
614 const IndexedDBKey& primary_key,
615 const IndexedDBKeyPath& key_path) {
616 DCHECK_EQ(thread_id, CurrentWorkerId());
617 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
618 if (!callbacks)
619 return;
620 callbacks->onSuccess(value, primary_key, key_path);
621 pending_callbacks_.Remove(response_id);
622 }
623
608 void IndexedDBDispatcher::OnSuccessOpenCursor( 624 void IndexedDBDispatcher::OnSuccessOpenCursor(
609 const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p) { 625 const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p) {
610 DCHECK_EQ(p.thread_id, CurrentWorkerId()); 626 DCHECK_EQ(p.thread_id, CurrentWorkerId());
611 int32 response_id = p.response_id; 627 int32 response_id = p.response_id;
612 int32 object_id = p.cursor_id; 628 int32 object_id = p.cursor_id;
613 const IndexedDBKey& key = p.key; 629 const IndexedDBKey& key = p.key;
614 const IndexedDBKey& primary_key = p.primary_key; 630 const IndexedDBKey& primary_key = p.primary_key;
615 const SerializedScriptValue& value = p.serialized_value; 631 const SerializedScriptValue& value = p.serialized_value;
616 632
617 WebIDBCallbacks* callbacks = 633 WebIDBCallbacks* callbacks =
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 } 733 }
718 734
719 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { 735 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) {
720 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; 736 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator;
721 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { 737 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) {
722 if (i->first == exception_cursor_id) 738 if (i->first == exception_cursor_id)
723 continue; 739 continue;
724 i->second->ResetPrefetchCache(); 740 i->second->ResetPrefetchCache();
725 } 741 }
726 } 742 }
OLDNEW
« no previous file with comments | « content/common/indexed_db/indexed_db_dispatcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698