| 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" | |
| 11 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
| 12 | 11 |
| 13 using WebKit::WebDOMStringList; | 12 using WebKit::WebDOMStringList; |
| 14 using WebKit::WebFrame; | 13 using WebKit::WebFrame; |
| 15 using WebKit::WebIDBCallbacks; | 14 using WebKit::WebIDBCallbacks; |
| 16 using WebKit::WebIDBTransaction; | |
| 17 using WebKit::WebString; | 15 using WebKit::WebString; |
| 18 using WebKit::WebVector; | 16 using WebKit::WebVector; |
| 19 | 17 |
| 20 RendererWebIDBDatabaseImpl::RendererWebIDBDatabaseImpl(int32 idb_database_id) | 18 RendererWebIDBDatabaseImpl::RendererWebIDBDatabaseImpl(int32 idb_database_id) |
| 21 : idb_database_id_(idb_database_id) { | 19 : idb_database_id_(idb_database_id) { |
| 22 } | 20 } |
| 23 | 21 |
| 24 RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() { | 22 RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() { |
| 25 // TODO(jorlow): Is it possible for this to be destroyed but still have | 23 // TODO(jorlow): Is it possible for this to be destroyed but still have |
| 26 // pending callbacks? If so, fix! | 24 // pending callbacks? If so, fix! |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 60 } |
| 63 | 61 |
| 64 void RendererWebIDBDatabaseImpl::createObjectStore( | 62 void RendererWebIDBDatabaseImpl::createObjectStore( |
| 65 const WebString& name, const WebString& key_path, bool auto_increment, | 63 const WebString& name, const WebString& key_path, bool auto_increment, |
| 66 WebIDBCallbacks* callbacks) { | 64 WebIDBCallbacks* callbacks) { |
| 67 IndexedDBDispatcher* dispatcher = | 65 IndexedDBDispatcher* dispatcher = |
| 68 RenderThread::current()->indexed_db_dispatcher(); | 66 RenderThread::current()->indexed_db_dispatcher(); |
| 69 dispatcher->RequestIDBDatabaseCreateObjectStore( | 67 dispatcher->RequestIDBDatabaseCreateObjectStore( |
| 70 name, key_path, auto_increment, callbacks, idb_database_id_); | 68 name, key_path, auto_increment, callbacks, idb_database_id_); |
| 71 } | 69 } |
| 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 |