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/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 Loading... | |
49 channel()->AddFilter(db_message_filter_.get()); | 49 channel()->AddFilter(db_message_filter_.get()); |
50 | 50 |
51 indexed_db_message_filter_ = new IndexedDBMessageFilter( | 51 indexed_db_message_filter_ = new IndexedDBMessageFilter( |
52 thread_safe_sender()); | 52 thread_safe_sender()); |
53 channel()->AddFilter(indexed_db_message_filter_.get()); | 53 channel()->AddFilter(indexed_db_message_filter_.get()); |
54 | 54 |
55 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 55 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
56 SetRuntimeFeaturesDefaultsAndUpdateFromArgs(command_line); | 56 SetRuntimeFeaturesDefaultsAndUpdateFromArgs(command_line); |
57 } | 57 } |
58 | 58 |
59 void WorkerThread::OnProcessFinalRelease() { | |
60 // The worker process is to be shut down gracefully. Ask the browser | |
61 // process to shut it down forcefully instead and wait on the message, so that | |
62 // there are no races between threads when the process is shutting down. | |
63 Send(new WorkerProcessHostMsg_ForceKillWorker()); | |
michaeln
2013/09/16 22:00:41
Does it not work to have this line as the first an
Mustafa Acer
2013/09/16 22:08:44
It doesn't work.
| |
64 } | |
65 | |
59 WorkerThread::~WorkerThread() { | 66 WorkerThread::~WorkerThread() { |
60 } | 67 } |
61 | 68 |
62 void WorkerThread::Shutdown() { | 69 void WorkerThread::Shutdown() { |
63 ChildThread::Shutdown(); | 70 ChildThread::Shutdown(); |
64 | 71 |
65 // Shutdown in reverse of the initialization order. | 72 // Shutdown in reverse of the initialization order. |
66 channel()->RemoveFilter(indexed_db_message_filter_.get()); | 73 channel()->RemoveFilter(indexed_db_message_filter_.get()); |
67 indexed_db_message_filter_ = NULL; | 74 indexed_db_message_filter_ = NULL; |
68 | 75 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 | 119 |
113 void WorkerThread::RemoveWorkerStub(WebSharedWorkerStub* stub) { | 120 void WorkerThread::RemoveWorkerStub(WebSharedWorkerStub* stub) { |
114 worker_stubs_.erase(stub); | 121 worker_stubs_.erase(stub); |
115 } | 122 } |
116 | 123 |
117 void WorkerThread::AddWorkerStub(WebSharedWorkerStub* stub) { | 124 void WorkerThread::AddWorkerStub(WebSharedWorkerStub* stub) { |
118 worker_stubs_.insert(stub); | 125 worker_stubs_.insert(stub); |
119 } | 126 } |
120 | 127 |
121 } // namespace content | 128 } // namespace content |
OLD | NEW |