Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: content/child/indexed_db/indexed_db_dispatcher.cc

Issue 165373004: Move WorkerTaskRunner to content/child. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 14 matching lines...) Expand all
25 using blink::WebIDBCallbacks; 25 using blink::WebIDBCallbacks;
26 using blink::WebIDBCursor; 26 using blink::WebIDBCursor;
27 using blink::WebIDBDatabase; 27 using blink::WebIDBDatabase;
28 using blink::WebIDBDatabaseCallbacks; 28 using blink::WebIDBDatabaseCallbacks;
29 using blink::WebIDBDatabaseError; 29 using blink::WebIDBDatabaseError;
30 using blink::WebIDBKey; 30 using blink::WebIDBKey;
31 using blink::WebIDBMetadata; 31 using blink::WebIDBMetadata;
32 using blink::WebString; 32 using blink::WebString;
33 using blink::WebVector; 33 using blink::WebVector;
34 using base::ThreadLocalPointer; 34 using base::ThreadLocalPointer;
35 using webkit_glue::WorkerTaskRunner;
36 35
37 namespace content { 36 namespace content {
38 static base::LazyInstance<ThreadLocalPointer<IndexedDBDispatcher> >::Leaky 37 static base::LazyInstance<ThreadLocalPointer<IndexedDBDispatcher> >::Leaky
39 g_idb_dispatcher_tls = LAZY_INSTANCE_INITIALIZER; 38 g_idb_dispatcher_tls = LAZY_INSTANCE_INITIALIZER;
40 39
41 namespace { 40 namespace {
42 41
43 IndexedDBDispatcher* const kHasBeenDeleted = 42 IndexedDBDispatcher* const kHasBeenDeleted =
44 reinterpret_cast<IndexedDBDispatcher*>(0x1); 43 reinterpret_cast<IndexedDBDispatcher*>(0x1);
45 44
(...skipping 22 matching lines...) Expand all
68 ThreadSafeSender* thread_safe_sender) { 67 ThreadSafeSender* thread_safe_sender) {
69 if (g_idb_dispatcher_tls.Pointer()->Get() == kHasBeenDeleted) { 68 if (g_idb_dispatcher_tls.Pointer()->Get() == kHasBeenDeleted) {
70 NOTREACHED() << "Re-instantiating TLS IndexedDBDispatcher."; 69 NOTREACHED() << "Re-instantiating TLS IndexedDBDispatcher.";
71 g_idb_dispatcher_tls.Pointer()->Set(NULL); 70 g_idb_dispatcher_tls.Pointer()->Set(NULL);
72 } 71 }
73 if (g_idb_dispatcher_tls.Pointer()->Get()) 72 if (g_idb_dispatcher_tls.Pointer()->Get())
74 return g_idb_dispatcher_tls.Pointer()->Get(); 73 return g_idb_dispatcher_tls.Pointer()->Get();
75 74
76 IndexedDBDispatcher* dispatcher = new IndexedDBDispatcher(thread_safe_sender); 75 IndexedDBDispatcher* dispatcher = new IndexedDBDispatcher(thread_safe_sender);
77 if (WorkerTaskRunner::Instance()->CurrentWorkerId()) 76 if (WorkerTaskRunner::Instance()->CurrentWorkerId())
78 webkit_glue::WorkerTaskRunner::Instance()->AddStopObserver(dispatcher); 77 WorkerTaskRunner::Instance()->AddStopObserver(dispatcher);
79 return dispatcher; 78 return dispatcher;
80 } 79 }
81 80
82 void IndexedDBDispatcher::OnWorkerRunLoopStopped() { delete this; } 81 void IndexedDBDispatcher::OnWorkerRunLoopStopped() { delete this; }
83 82
84 WebIDBMetadata IndexedDBDispatcher::ConvertMetadata( 83 WebIDBMetadata IndexedDBDispatcher::ConvertMetadata(
85 const IndexedDBDatabaseMetadata& idb_metadata) { 84 const IndexedDBDatabaseMetadata& idb_metadata) {
86 WebIDBMetadata web_metadata; 85 WebIDBMetadata web_metadata;
87 web_metadata.id = idb_metadata.id; 86 web_metadata.id = idb_metadata.id;
88 web_metadata.name = idb_metadata.name; 87 web_metadata.name = idb_metadata.name;
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 typedef std::map<int32, WebIDBCursorImpl*>::iterator Iterator; 731 typedef std::map<int32, WebIDBCursorImpl*>::iterator Iterator;
733 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { 732 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) {
734 if (i->first == ipc_exception_cursor_id || 733 if (i->first == ipc_exception_cursor_id ||
735 i->second->transaction_id() != transaction_id) 734 i->second->transaction_id() != transaction_id)
736 continue; 735 continue;
737 i->second->ResetPrefetchCache(); 736 i->second->ResetPrefetchCache();
738 } 737 }
739 } 738 }
740 739
741 } // namespace content 740 } // namespace content
OLDNEW
« no previous file with comments | « content/child/indexed_db/indexed_db_dispatcher.h ('k') | content/child/indexed_db/webidbdatabase_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698