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

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

Issue 10533057: IPC plumbing for IndexedDB to snapshot metadata to the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't CamelCase "metadata" Created 8 years, 6 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 | Annotate | Revision Log
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/proxy_webidbdatabase_impl.h" 5 #include "content/common/indexed_db/proxy_webidbdatabase_impl.h"
6 6
7 #include "content/common/child_thread.h" 7 #include "content/common/child_thread.h"
8 #include "content/common/indexed_db/indexed_db_messages.h" 8 #include "content/common/indexed_db/indexed_db_messages.h"
9 #include "content/common/indexed_db/indexed_db_dispatcher.h" 9 #include "content/common/indexed_db/indexed_db_dispatcher.h"
10 #include "content/common/indexed_db/proxy_webidbobjectstore_impl.h" 10 #include "content/common/indexed_db/proxy_webidbobjectstore_impl.h"
11 #include "content/common/indexed_db/proxy_webidbtransaction_impl.h" 11 #include "content/common/indexed_db/proxy_webidbtransaction_impl.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBMetadata.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
15 #include "webkit/glue/worker_task_runner.h" 16 #include "webkit/glue/worker_task_runner.h"
16 17
17 using WebKit::WebDOMStringList; 18 using WebKit::WebDOMStringList;
18 using WebKit::WebExceptionCode; 19 using WebKit::WebExceptionCode;
19 using WebKit::WebFrame; 20 using WebKit::WebFrame;
20 using WebKit::WebIDBCallbacks; 21 using WebKit::WebIDBCallbacks;
21 using WebKit::WebIDBDatabaseCallbacks; 22 using WebKit::WebIDBDatabaseCallbacks;
23 using WebKit::WebIDBDatabaseMetadata;
22 using WebKit::WebIDBKeyPath; 24 using WebKit::WebIDBKeyPath;
23 using WebKit::WebIDBTransaction; 25 using WebKit::WebIDBTransaction;
24 using WebKit::WebString; 26 using WebKit::WebString;
25 using WebKit::WebVector; 27 using WebKit::WebVector;
26 using webkit_glue::WorkerTaskRunner; 28 using webkit_glue::WorkerTaskRunner;
27 29
28 RendererWebIDBDatabaseImpl::RendererWebIDBDatabaseImpl(int32 idb_database_id) 30 RendererWebIDBDatabaseImpl::RendererWebIDBDatabaseImpl(int32 idb_database_id)
29 : idb_database_id_(idb_database_id) { 31 : idb_database_id_(idb_database_id) {
30 } 32 }
31 33
32 RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() { 34 RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() {
33 // It's not possible for there to be pending callbacks that address this 35 // It's not possible for there to be pending callbacks that address this
34 // object since inside WebKit, they hold a reference to the object which owns 36 // object since inside WebKit, they hold a reference to the object which owns
35 // this object. But, if that ever changed, then we'd need to invalidate 37 // this object. But, if that ever changed, then we'd need to invalidate
36 // any such pointers. 38 // any such pointers.
37 IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseDestroyed( 39 IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseDestroyed(
38 idb_database_id_)); 40 idb_database_id_));
39 } 41 }
40 42
43 WebIDBDatabaseMetadata RendererWebIDBDatabaseImpl::metadata() const {
44 content::IndexedDBDatabaseMetadata result;
45 IndexedDBDispatcher::Send(
46 new IndexedDBHostMsg_DatabaseMetadata(idb_database_id_, &result));
47 return WebIDBDatabaseMetadata(result);
48 }
49
41 WebString RendererWebIDBDatabaseImpl::name() const { 50 WebString RendererWebIDBDatabaseImpl::name() const {
42 string16 result; 51 string16 result;
43 IndexedDBDispatcher::Send( 52 IndexedDBDispatcher::Send(
44 new IndexedDBHostMsg_DatabaseName(idb_database_id_, &result)); 53 new IndexedDBHostMsg_DatabaseName(idb_database_id_, &result));
45 return result; 54 return result;
46 } 55 }
47 56
48 WebString RendererWebIDBDatabaseImpl::version() const { 57 WebString RendererWebIDBDatabaseImpl::version() const {
49 string16 result; 58 string16 result;
50 IndexedDBDispatcher::Send( 59 IndexedDBDispatcher::Send(
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 IndexedDBDispatcher::ThreadSpecificInstance(); 138 IndexedDBDispatcher::ThreadSpecificInstance();
130 dispatcher->RequestIDBDatabaseClose(idb_database_id_); 139 dispatcher->RequestIDBDatabaseClose(idb_database_id_);
131 } 140 }
132 141
133 void RendererWebIDBDatabaseImpl::open(WebIDBDatabaseCallbacks* callbacks) { 142 void RendererWebIDBDatabaseImpl::open(WebIDBDatabaseCallbacks* callbacks) {
134 IndexedDBDispatcher* dispatcher = 143 IndexedDBDispatcher* dispatcher =
135 IndexedDBDispatcher::ThreadSpecificInstance(); 144 IndexedDBDispatcher::ThreadSpecificInstance();
136 DCHECK(dispatcher); 145 DCHECK(dispatcher);
137 dispatcher->RequestIDBDatabaseOpen(callbacks, idb_database_id_); 146 dispatcher->RequestIDBDatabaseOpen(callbacks, idb_database_id_);
138 } 147 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698