| OLD | NEW |
| 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/platform/WebString.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
| 14 #include "webkit/glue/worker_task_runner.h" | 15 #include "webkit/glue/worker_task_runner.h" |
| 15 | 16 |
| 16 using WebKit::WebDOMStringList; | 17 using WebKit::WebDOMStringList; |
| 17 using WebKit::WebExceptionCode; | 18 using WebKit::WebExceptionCode; |
| 18 using WebKit::WebFrame; | 19 using WebKit::WebFrame; |
| 19 using WebKit::WebIDBCallbacks; | 20 using WebKit::WebIDBCallbacks; |
| 20 using WebKit::WebIDBDatabaseCallbacks; | 21 using WebKit::WebIDBDatabaseCallbacks; |
| 22 using WebKit::WebIDBKeyPath; |
| 21 using WebKit::WebIDBTransaction; | 23 using WebKit::WebIDBTransaction; |
| 22 using WebKit::WebString; | 24 using WebKit::WebString; |
| 23 using WebKit::WebVector; | 25 using WebKit::WebVector; |
| 24 using webkit_glue::WorkerTaskRunner; | 26 using webkit_glue::WorkerTaskRunner; |
| 25 | 27 |
| 26 RendererWebIDBDatabaseImpl::RendererWebIDBDatabaseImpl(int32 idb_database_id) | 28 RendererWebIDBDatabaseImpl::RendererWebIDBDatabaseImpl(int32 idb_database_id) |
| 27 : idb_database_id_(idb_database_id) { | 29 : idb_database_id_(idb_database_id) { |
| 28 } | 30 } |
| 29 | 31 |
| 30 RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() { | 32 RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 57 WebDOMStringList webResult; | 59 WebDOMStringList webResult; |
| 58 for (std::vector<string16>::const_iterator it = result.begin(); | 60 for (std::vector<string16>::const_iterator it = result.begin(); |
| 59 it != result.end(); ++it) { | 61 it != result.end(); ++it) { |
| 60 webResult.append(*it); | 62 webResult.append(*it); |
| 61 } | 63 } |
| 62 return webResult; | 64 return webResult; |
| 63 } | 65 } |
| 64 | 66 |
| 65 WebKit::WebIDBObjectStore* RendererWebIDBDatabaseImpl::createObjectStore( | 67 WebKit::WebIDBObjectStore* RendererWebIDBDatabaseImpl::createObjectStore( |
| 66 const WebKit::WebString& name, | 68 const WebKit::WebString& name, |
| 67 const WebKit::WebString& key_path, | 69 const WebKit::WebIDBKeyPath& key_path, |
| 68 bool auto_increment, | 70 bool auto_increment, |
| 69 const WebKit::WebIDBTransaction& transaction, | 71 const WebKit::WebIDBTransaction& transaction, |
| 70 WebExceptionCode& ec) { | 72 WebExceptionCode& ec) { |
| 71 IndexedDBHostMsg_DatabaseCreateObjectStore_Params params; | 73 IndexedDBHostMsg_DatabaseCreateObjectStore_Params params; |
| 72 params.name = name; | 74 params.name = name; |
| 73 params.key_path = key_path; | 75 params.key_path = content::IndexedDBKeyPath(key_path); |
| 74 params.auto_increment = auto_increment; | 76 params.auto_increment = auto_increment; |
| 75 params.transaction_id = IndexedDBDispatcher::TransactionId(transaction); | 77 params.transaction_id = IndexedDBDispatcher::TransactionId(transaction); |
| 76 params.idb_database_id = idb_database_id_; | 78 params.idb_database_id = idb_database_id_; |
| 77 | 79 |
| 78 int object_store; | 80 int object_store; |
| 79 IndexedDBDispatcher::Send( | 81 IndexedDBDispatcher::Send( |
| 80 new IndexedDBHostMsg_DatabaseCreateObjectStore( | 82 new IndexedDBHostMsg_DatabaseCreateObjectStore( |
| 81 params, &object_store, &ec)); | 83 params, &object_store, &ec)); |
| 82 if (!object_store) | 84 if (!object_store) |
| 83 return NULL; | 85 return NULL; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 IndexedDBDispatcher::ThreadSpecificInstance(); | 129 IndexedDBDispatcher::ThreadSpecificInstance(); |
| 128 dispatcher->RequestIDBDatabaseClose(idb_database_id_); | 130 dispatcher->RequestIDBDatabaseClose(idb_database_id_); |
| 129 } | 131 } |
| 130 | 132 |
| 131 void RendererWebIDBDatabaseImpl::open(WebIDBDatabaseCallbacks* callbacks) { | 133 void RendererWebIDBDatabaseImpl::open(WebIDBDatabaseCallbacks* callbacks) { |
| 132 IndexedDBDispatcher* dispatcher = | 134 IndexedDBDispatcher* dispatcher = |
| 133 IndexedDBDispatcher::ThreadSpecificInstance(); | 135 IndexedDBDispatcher::ThreadSpecificInstance(); |
| 134 DCHECK(dispatcher); | 136 DCHECK(dispatcher); |
| 135 dispatcher->RequestIDBDatabaseOpen(callbacks, idb_database_id_); | 137 dispatcher->RequestIDBDatabaseOpen(callbacks, idb_database_id_); |
| 136 } | 138 } |
| OLD | NEW |