OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/renderer_webidbdatabase_impl.h" | 5 #include "chrome/renderer/renderer_webidbdatabase_impl.h" |
6 | 6 |
7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
8 #include "chrome/renderer/render_thread.h" | 8 #include "chrome/renderer/render_thread.h" |
9 #include "chrome/renderer/indexed_db_dispatcher.h" | 9 #include "chrome/renderer/indexed_db_dispatcher.h" |
| 10 #include "chrome/renderer/renderer_webidbtransaction_impl.h" |
10 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
11 | 12 |
12 using WebKit::WebDOMStringList; | 13 using WebKit::WebDOMStringList; |
13 using WebKit::WebFrame; | 14 using WebKit::WebFrame; |
14 using WebKit::WebIDBCallbacks; | 15 using WebKit::WebIDBCallbacks; |
| 16 using WebKit::WebIDBTransaction; |
15 using WebKit::WebString; | 17 using WebKit::WebString; |
16 using WebKit::WebVector; | 18 using WebKit::WebVector; |
17 | 19 |
18 RendererWebIDBDatabaseImpl::RendererWebIDBDatabaseImpl(int32 idb_database_id) | 20 RendererWebIDBDatabaseImpl::RendererWebIDBDatabaseImpl(int32 idb_database_id) |
19 : idb_database_id_(idb_database_id) { | 21 : idb_database_id_(idb_database_id) { |
20 } | 22 } |
21 | 23 |
22 RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() { | 24 RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() { |
23 // TODO(jorlow): Is it possible for this to be destroyed but still have | 25 // TODO(jorlow): Is it possible for this to be destroyed but still have |
24 // pending callbacks? If so, fix! | 26 // pending callbacks? If so, fix! |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 62 } |
61 | 63 |
62 void RendererWebIDBDatabaseImpl::createObjectStore( | 64 void RendererWebIDBDatabaseImpl::createObjectStore( |
63 const WebString& name, const WebString& key_path, bool auto_increment, | 65 const WebString& name, const WebString& key_path, bool auto_increment, |
64 WebIDBCallbacks* callbacks) { | 66 WebIDBCallbacks* callbacks) { |
65 IndexedDBDispatcher* dispatcher = | 67 IndexedDBDispatcher* dispatcher = |
66 RenderThread::current()->indexed_db_dispatcher(); | 68 RenderThread::current()->indexed_db_dispatcher(); |
67 dispatcher->RequestIDBDatabaseCreateObjectStore( | 69 dispatcher->RequestIDBDatabaseCreateObjectStore( |
68 name, key_path, auto_increment, callbacks, idb_database_id_); | 70 name, key_path, auto_increment, callbacks, idb_database_id_); |
69 } | 71 } |
| 72 |
| 73 WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::transaction( |
| 74 const WebDOMStringList& names, unsigned short mode, |
| 75 unsigned long timeout) { |
| 76 std::vector<string16> object_stores(names.length()); |
| 77 for (unsigned int i = 0; i < names.length(); ++i) { |
| 78 object_stores.push_back(names.item(i)); |
| 79 } |
| 80 |
| 81 int transaction_id; |
| 82 RenderThread::current()->Send( |
| 83 new ViewHostMsg_IDBDatabaseTransaction( |
| 84 idb_database_id_, object_stores, mode, timeout, &transaction_id)); |
| 85 return new RendererWebIDBTransactionImpl(transaction_id); |
| 86 } |
OLD | NEW |