OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child/indexed_db/indexed_db_dispatcher.h" | 5 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
11 #include "content/child/indexed_db/indexed_db_key_builders.h" | 11 #include "content/child/indexed_db/indexed_db_key_builders.h" |
12 #include "content/child/indexed_db/proxy_webidbcursor_impl.h" | 12 #include "content/child/indexed_db/proxy_webidbcursor_impl.h" |
13 #include "content/child/indexed_db/proxy_webidbdatabase_impl.h" | 13 #include "content/child/indexed_db/proxy_webidbdatabase_impl.h" |
14 #include "content/child/thread_safe_sender.h" | 14 #include "content/child/thread_safe_sender.h" |
15 #include "content/common/indexed_db/indexed_db_messages.h" | 15 #include "content/common/indexed_db/indexed_db_messages.h" |
16 #include "ipc/ipc_channel.h" | 16 #include "ipc/ipc_channel.h" |
17 #include "third_party/WebKit/public/platform/WebIDBDatabaseCallbacks.h" | 17 #include "third_party/WebKit/public/platform/WebIDBDatabaseCallbacks.h" |
18 #include "third_party/WebKit/public/platform/WebIDBDatabaseError.h" | 18 #include "third_party/WebKit/public/platform/WebIDBDatabaseError.h" |
19 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h" | 19 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h" |
20 | 20 |
21 using WebKit::WebData; | 21 using blink::WebData; |
22 using WebKit::WebIDBCallbacks; | 22 using blink::WebIDBCallbacks; |
23 using WebKit::WebIDBDatabase; | 23 using blink::WebIDBDatabase; |
24 using WebKit::WebIDBDatabaseCallbacks; | 24 using blink::WebIDBDatabaseCallbacks; |
25 using WebKit::WebIDBDatabaseError; | 25 using blink::WebIDBDatabaseError; |
26 using WebKit::WebIDBKey; | 26 using blink::WebIDBKey; |
27 using WebKit::WebIDBMetadata; | 27 using blink::WebIDBMetadata; |
28 using WebKit::WebString; | 28 using blink::WebString; |
29 using WebKit::WebVector; | 29 using blink::WebVector; |
30 using base::ThreadLocalPointer; | 30 using base::ThreadLocalPointer; |
31 using webkit_glue::WorkerTaskRunner; | 31 using webkit_glue::WorkerTaskRunner; |
32 | 32 |
33 namespace content { | 33 namespace content { |
34 static base::LazyInstance<ThreadLocalPointer<IndexedDBDispatcher> >::Leaky | 34 static base::LazyInstance<ThreadLocalPointer<IndexedDBDispatcher> >::Leaky |
35 g_idb_dispatcher_tls = LAZY_INSTANCE_INITIALIZER; | 35 g_idb_dispatcher_tls = LAZY_INSTANCE_INITIALIZER; |
36 | 36 |
37 namespace { | 37 namespace { |
38 | 38 |
39 IndexedDBDispatcher* const kHasBeenDeleted = | 39 IndexedDBDispatcher* const kHasBeenDeleted = |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 int64 object_store_id, | 324 int64 object_store_id, |
325 const WebData& value, | 325 const WebData& value, |
326 const IndexedDBKey& key, | 326 const IndexedDBKey& key, |
327 WebIDBDatabase::PutMode put_mode, | 327 WebIDBDatabase::PutMode put_mode, |
328 WebIDBCallbacks* callbacks, | 328 WebIDBCallbacks* callbacks, |
329 const WebVector<long long>& index_ids, | 329 const WebVector<long long>& index_ids, |
330 const WebVector<WebVector<WebIDBKey> >& index_keys) { | 330 const WebVector<WebVector<WebIDBKey> >& index_keys) { |
331 | 331 |
332 if (value.size() > kMaxIDBValueSizeInBytes) { | 332 if (value.size() > kMaxIDBValueSizeInBytes) { |
333 callbacks->onError(WebIDBDatabaseError( | 333 callbacks->onError(WebIDBDatabaseError( |
334 WebKit::WebIDBDatabaseExceptionUnknownError, | 334 blink::WebIDBDatabaseExceptionUnknownError, |
335 WebString::fromUTF8(base::StringPrintf( | 335 WebString::fromUTF8(base::StringPrintf( |
336 "The serialized value is too large" | 336 "The serialized value is too large" |
337 " (size=%" PRIuS " bytes, max=%" PRIuS " bytes).", | 337 " (size=%" PRIuS " bytes, max=%" PRIuS " bytes).", |
338 value.size(), | 338 value.size(), |
339 kMaxIDBValueSizeInBytes).c_str()))); | 339 kMaxIDBValueSizeInBytes).c_str()))); |
340 return; | 340 return; |
341 } | 341 } |
342 | 342 |
343 ResetCursorPrefetchCaches(); | 343 ResetCursorPrefetchCaches(); |
344 IndexedDBHostMsg_DatabasePut_Params params; | 344 IndexedDBHostMsg_DatabasePut_Params params; |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 int32 ipc_exception_cursor_id) { | 714 int32 ipc_exception_cursor_id) { |
715 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; | 715 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; |
716 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 716 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
717 if (i->first == ipc_exception_cursor_id) | 717 if (i->first == ipc_exception_cursor_id) |
718 continue; | 718 continue; |
719 i->second->ResetPrefetchCache(); | 719 i->second->ResetPrefetchCache(); |
720 } | 720 } |
721 } | 721 } |
722 | 722 |
723 } // namespace content | 723 } // namespace content |
OLD | NEW |