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 ChildThread::ChildThread(Thread::Options options) | 14 ChildThread::ChildThread(Thread::Options options) |
15 : Thread("Chrome_ChildThread"), | 15 : Thread("Chrome_ChildThread"), |
16 owner_loop_(MessageLoop::current()), | 16 owner_loop_(MessageLoop::current()), |
17 in_send_(0), | 17 in_send_(0), |
18 options_(options) { | 18 options_(options) { |
19 DCHECK(owner_loop_); | 19 DCHECK(owner_loop_); |
20 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValue( | 20 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValue( |
21 switches::kProcessChannelID); | 21 switches::kProcessChannelID); |
22 | 22 |
23 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserAgent)) { | 23 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserAgent)) { |
24 #if defined(OS_WIN) | |
25 // TODO(port): calling this connects an, otherwise disconnected, subgraph | |
26 // of symbols, causing huge numbers of linker errors. | |
27 webkit_glue::SetUserAgent(WideToUTF8( | 24 webkit_glue::SetUserAgent(WideToUTF8( |
28 CommandLine::ForCurrentProcess()->GetSwitchValue(switches::kUserAgent)))
; | 25 CommandLine::ForCurrentProcess()->GetSwitchValue(switches::kUserAgent)))
; |
29 #endif | |
30 } | 26 } |
31 } | 27 } |
32 | 28 |
33 ChildThread::~ChildThread() { | 29 ChildThread::~ChildThread() { |
34 } | 30 } |
35 | 31 |
36 bool ChildThread::Run() { | 32 bool ChildThread::Run() { |
37 return StartWithOptions(options_); | 33 return StartWithOptions(options_); |
38 } | 34 } |
39 | 35 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 83 } |
88 | 84 |
89 void ChildThread::CleanUp() { | 85 void ChildThread::CleanUp() { |
90 #ifdef IPC_MESSAGE_LOG_ENABLED | 86 #ifdef IPC_MESSAGE_LOG_ENABLED |
91 IPC::Logging::current()->SetIPCSender(NULL); | 87 IPC::Logging::current()->SetIPCSender(NULL); |
92 #endif | 88 #endif |
93 // 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 |
94 // it caches a pointer to this thread. | 90 // it caches a pointer to this thread. |
95 channel_.reset(); | 91 channel_.reset(); |
96 } | 92 } |
OLD | NEW |