| 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/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; | |
| 25 using content::IndexedDBKeyPath; | |
| 26 using content::IndexedDBKeyRange; | |
| 27 using content::SerializedScriptValue; | |
| 28 using WebKit::WebDOMStringList; | 24 using WebKit::WebDOMStringList; |
| 29 using WebKit::WebExceptionCode; | 25 using WebKit::WebExceptionCode; |
| 30 using WebKit::WebFrame; | 26 using WebKit::WebFrame; |
| 31 using WebKit::WebIDBCallbacks; | 27 using WebKit::WebIDBCallbacks; |
| 32 using WebKit::WebIDBKeyRange; | 28 using WebKit::WebIDBKeyRange; |
| 33 using WebKit::WebIDBDatabase; | 29 using WebKit::WebIDBDatabase; |
| 34 using WebKit::WebIDBDatabaseCallbacks; | 30 using WebKit::WebIDBDatabaseCallbacks; |
| 35 using WebKit::WebIDBDatabaseError; | 31 using WebKit::WebIDBDatabaseError; |
| 36 using WebKit::WebIDBTransaction; | 32 using WebKit::WebIDBTransaction; |
| 37 using WebKit::WebIDBTransactionCallbacks; | 33 using WebKit::WebIDBTransactionCallbacks; |
| 38 using webkit_glue::WorkerTaskRunner; | 34 using webkit_glue::WorkerTaskRunner; |
| 39 | 35 |
| 36 namespace content { |
| 40 static base::LazyInstance<ThreadLocalPointer<IndexedDBDispatcher> >::Leaky | 37 static base::LazyInstance<ThreadLocalPointer<IndexedDBDispatcher> >::Leaky |
| 41 g_idb_dispatcher_tls = LAZY_INSTANCE_INITIALIZER; | 38 g_idb_dispatcher_tls = LAZY_INSTANCE_INITIALIZER; |
| 42 | 39 |
| 43 namespace { | 40 namespace { |
| 44 | 41 |
| 45 IndexedDBDispatcher* const kHasBeenDeleted = | 42 IndexedDBDispatcher* const kHasBeenDeleted = |
| 46 reinterpret_cast<IndexedDBDispatcher*>(0x1); | 43 reinterpret_cast<IndexedDBDispatcher*>(0x1); |
| 47 | 44 |
| 48 int32 CurrentWorkerId() { | 45 int32 CurrentWorkerId() { |
| 49 return WorkerTaskRunner::Instance()->CurrentWorkerId(); | 46 return WorkerTaskRunner::Instance()->CurrentWorkerId(); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 params.transaction_id = TransactionId(transaction); | 409 params.transaction_id = TransactionId(transaction); |
| 413 params.index_names.resize(index_names.size()); | 410 params.index_names.resize(index_names.size()); |
| 414 for (size_t i = 0; i < index_names.size(); ++i) { | 411 for (size_t i = 0; i < index_names.size(); ++i) { |
| 415 params.index_names[i] = index_names[i]; | 412 params.index_names[i] = index_names[i]; |
| 416 } | 413 } |
| 417 | 414 |
| 418 params.index_keys.resize(index_keys.size()); | 415 params.index_keys.resize(index_keys.size()); |
| 419 for (size_t i = 0; i < index_keys.size(); ++i) { | 416 for (size_t i = 0; i < index_keys.size(); ++i) { |
| 420 params.index_keys[i].resize(index_keys[i].size()); | 417 params.index_keys[i].resize(index_keys[i].size()); |
| 421 for (size_t j = 0; j < index_keys[i].size(); ++j) { | 418 for (size_t j = 0; j < index_keys[i].size(); ++j) { |
| 422 params.index_keys[i][j] = content::IndexedDBKey(index_keys[i][j]); | 419 params.index_keys[i][j] = IndexedDBKey(index_keys[i][j]); |
| 423 } | 420 } |
| 424 } | 421 } |
| 425 Send(new IndexedDBHostMsg_ObjectStorePut(params)); | 422 Send(new IndexedDBHostMsg_ObjectStorePut(params)); |
| 426 } | 423 } |
| 427 | 424 |
| 428 void IndexedDBDispatcher::RequestIDBObjectStoreDelete( | 425 void IndexedDBDispatcher::RequestIDBObjectStoreDelete( |
| 429 const IndexedDBKeyRange& key_range, | 426 const IndexedDBKeyRange& key_range, |
| 430 WebIDBCallbacks* callbacks_ptr, | 427 WebIDBCallbacks* callbacks_ptr, |
| 431 int32 idb_object_store_id, | 428 int32 idb_object_store_id, |
| 432 const WebIDBTransaction& transaction, | 429 const WebIDBTransaction& transaction, |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 } | 767 } |
| 771 | 768 |
| 772 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { | 769 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { |
| 773 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; | 770 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; |
| 774 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 771 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
| 775 if (i->first == exception_cursor_id) | 772 if (i->first == exception_cursor_id) |
| 776 continue; | 773 continue; |
| 777 i->second->ResetPrefetchCache(); | 774 i->second->ResetPrefetchCache(); |
| 778 } | 775 } |
| 779 } | 776 } |
| 777 |
| 778 } // namespace content |
| OLD | NEW |