OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/common/child_thread.h" | 5 #include "chrome/common/child_thread.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "chrome/common/child_process.h" | 9 #include "chrome/common/child_process.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
11 #include "chrome/common/ipc_logging.h" | 11 #include "chrome/common/ipc_logging.h" |
12 #include "webkit/glue/webkit_glue.h" | 12 #include "webkit/glue/webkit_glue.h" |
13 | 13 |
14 // V8 needs a 1MB stack size. | 14 // V8 needs a 1MB stack size. |
15 const size_t ChildThread::kV8StackSize = 1024 * 1024; | 15 const size_t ChildThread::kV8StackSize = 1024 * 1024; |
16 | 16 |
17 ChildThread::ChildThread(Thread::Options options) | 17 ChildThread::ChildThread(Thread::Options options) |
18 : Thread("Chrome_ChildThread"), | 18 : Thread("Chrome_ChildThread"), |
19 owner_loop_(MessageLoop::current()), | 19 owner_loop_(MessageLoop::current()), |
20 options_(options) { | 20 options_(options) { |
21 DCHECK(owner_loop_); | 21 DCHECK(owner_loop_); |
22 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValue( | 22 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValue( |
23 switches::kProcessChannelID); | 23 switches::kProcessChannelID); |
24 | 24 |
25 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserAgent)) { | 25 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserAgent)) { |
26 webkit_glue::SetUserAgent(WideToUTF8( | 26 webkit_glue::SetUserAgent(WideToUTF8( |
27 CommandLine::ForCurrentProcess()->GetSwitchValue(switches::kUserAgent)))
; | 27 CommandLine::ForCurrentProcess()->GetSwitchValue( |
| 28 switches::kUserAgent))); |
28 } | 29 } |
29 } | 30 } |
30 | 31 |
31 ChildThread::~ChildThread() { | 32 ChildThread::~ChildThread() { |
32 } | 33 } |
33 | 34 |
34 bool ChildThread::Run() { | 35 bool ChildThread::Run() { |
35 return StartWithOptions(options_); | 36 return StartWithOptions(options_); |
36 } | 37 } |
37 | 38 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 83 } |
83 | 84 |
84 void ChildThread::CleanUp() { | 85 void ChildThread::CleanUp() { |
85 #ifdef IPC_MESSAGE_LOG_ENABLED | 86 #ifdef IPC_MESSAGE_LOG_ENABLED |
86 IPC::Logging::current()->SetIPCSender(NULL); | 87 IPC::Logging::current()->SetIPCSender(NULL); |
87 #endif | 88 #endif |
88 // Need to destruct the SyncChannel to the browser before we go away because | 89 // Need to destruct the SyncChannel to the browser before we go away because |
89 // it caches a pointer to this thread. | 90 // it caches a pointer to this thread. |
90 channel_.reset(); | 91 channel_.reset(); |
91 } | 92 } |
OLD | NEW |