| 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. |
| 15 const size_t ChildThread::kV8StackSize = 1024 * 1024; |
| 16 |
| 14 ChildThread::ChildThread(Thread::Options options) | 17 ChildThread::ChildThread(Thread::Options options) |
| 15 : Thread("Chrome_ChildThread"), | 18 : Thread("Chrome_ChildThread"), |
| 16 owner_loop_(MessageLoop::current()), | 19 owner_loop_(MessageLoop::current()), |
| 17 options_(options) { | 20 options_(options) { |
| 18 DCHECK(owner_loop_); | 21 DCHECK(owner_loop_); |
| 19 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValue( | 22 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValue( |
| 20 switches::kProcessChannelID); | 23 switches::kProcessChannelID); |
| 21 | 24 |
| 22 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserAgent)) { | 25 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserAgent)) { |
| 23 webkit_glue::SetUserAgent(WideToUTF8( | 26 webkit_glue::SetUserAgent(WideToUTF8( |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 82 } |
| 80 | 83 |
| 81 void ChildThread::CleanUp() { | 84 void ChildThread::CleanUp() { |
| 82 #ifdef IPC_MESSAGE_LOG_ENABLED | 85 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 83 IPC::Logging::current()->SetIPCSender(NULL); | 86 IPC::Logging::current()->SetIPCSender(NULL); |
| 84 #endif | 87 #endif |
| 85 // Need to destruct the SyncChannel to the browser before we go away because | 88 // Need to destruct the SyncChannel to the browser before we go away because |
| 86 // it caches a pointer to this thread. | 89 // it caches a pointer to this thread. |
| 87 channel_.reset(); | 90 channel_.reset(); |
| 88 } | 91 } |
| OLD | NEW |