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

Side by Side Diff: content/worker/worker_thread.cc

Issue 63843002: Add ChildMessageFilter, a base class for renderer/worker cross-thread MessageFilter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cross thread -> child message filter Created 7 years, 1 month 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 (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/worker/worker_thread.h" 5 #include "content/worker/worker_thread.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/threading/thread_local.h" 9 #include "base/threading/thread_local.h"
10 #include "content/child/appcache/appcache_dispatcher.h" 10 #include "content/child/appcache/appcache_dispatcher.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 blink::initialize(webkit_platform_support_.get()); 49 blink::initialize(webkit_platform_support_.get());
50 50
51 appcache_dispatcher_.reset( 51 appcache_dispatcher_.reset(
52 new AppCacheDispatcher(this, new AppCacheFrontendImpl())); 52 new AppCacheDispatcher(this, new AppCacheFrontendImpl()));
53 53
54 db_message_filter_ = new DBMessageFilter(); 54 db_message_filter_ = new DBMessageFilter();
55 channel()->AddFilter(db_message_filter_.get()); 55 channel()->AddFilter(db_message_filter_.get());
56 56
57 indexed_db_message_filter_ = new IndexedDBMessageFilter( 57 indexed_db_message_filter_ = new IndexedDBMessageFilter(
58 thread_safe_sender()); 58 thread_safe_sender());
59 channel()->AddFilter(indexed_db_message_filter_.get()); 59 channel()->AddFilter(indexed_db_message_filter_->GetFilter());
60 60
61 } 61 }
62 62
63 void WorkerThread::OnShutdown() { 63 void WorkerThread::OnShutdown() {
64 // The worker process is to be shut down gracefully. Ask the browser 64 // The worker process is to be shut down gracefully. Ask the browser
65 // process to shut it down forcefully instead and wait on the message, so that 65 // process to shut it down forcefully instead and wait on the message, so that
66 // there are no races between threads when the process is shutting down. 66 // there are no races between threads when the process is shutting down.
67 Send(new WorkerProcessHostMsg_ForceKillWorker()); 67 Send(new WorkerProcessHostMsg_ForceKillWorker());
68 } 68 }
69 69
70 WorkerThread::~WorkerThread() { 70 WorkerThread::~WorkerThread() {
71 } 71 }
72 72
73 void WorkerThread::Shutdown() { 73 void WorkerThread::Shutdown() {
74 ChildThread::Shutdown(); 74 ChildThread::Shutdown();
75 75
76 if (webkit_platform_support_) { 76 if (webkit_platform_support_) {
77 webkit_platform_support_->web_database_observer_impl()-> 77 webkit_platform_support_->web_database_observer_impl()->
78 WaitForAllDatabasesToClose(); 78 WaitForAllDatabasesToClose();
79 } 79 }
80 80
81 // Shutdown in reverse of the initialization order. 81 // Shutdown in reverse of the initialization order.
82 channel()->RemoveFilter(indexed_db_message_filter_.get()); 82 channel()->RemoveFilter(indexed_db_message_filter_->GetFilter());
83 indexed_db_message_filter_ = NULL; 83 indexed_db_message_filter_ = NULL;
84 84
85 channel()->RemoveFilter(db_message_filter_.get()); 85 channel()->RemoveFilter(db_message_filter_.get());
86 db_message_filter_ = NULL; 86 db_message_filter_ = NULL;
87 87
88 blink::shutdown(); 88 blink::shutdown();
89 lazy_tls.Pointer()->Set(NULL); 89 lazy_tls.Pointer()->Set(NULL);
90 } 90 }
91 91
92 WorkerThread* WorkerThread::current() { 92 WorkerThread* WorkerThread::current() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 void WorkerThread::RemoveWorkerStub(WebSharedWorkerStub* stub) { 138 void WorkerThread::RemoveWorkerStub(WebSharedWorkerStub* stub) {
139 worker_stubs_.erase(stub); 139 worker_stubs_.erase(stub);
140 } 140 }
141 141
142 void WorkerThread::AddWorkerStub(WebSharedWorkerStub* stub) { 142 void WorkerThread::AddWorkerStub(WebSharedWorkerStub* stub) {
143 worker_stubs_.insert(stub); 143 worker_stubs_.insert(stub);
144 } 144 }
145 145
146 } // namespace content 146 } // namespace content
OLDNEW
« content/child/worker_thread_task_runner.cc ('K') | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698