OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <windows.h> | |
6 | |
7 #include "chrome/common/child_process.h" | 5 #include "chrome/common/child_process.h" |
8 | 6 |
9 #include "base/atomic_ref_count.h" | 7 #include "base/atomic_ref_count.h" |
10 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
11 #include "base/command_line.h" | 9 #include "base/command_line.h" |
12 #include "base/string_util.h" | 10 #include "base/string_util.h" |
13 #include "base/waitable_event.h" | 11 #include "base/waitable_event.h" |
14 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
15 #include "webkit/glue/webkit_glue.h" | 13 #include "webkit/glue/webkit_glue.h" |
16 | 14 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // again when we need to shutdown (see ReleaseProcess). | 72 // again when we need to shutdown (see ReleaseProcess). |
75 main_thread_loop_ = MessageLoop::current(); | 73 main_thread_loop_ = MessageLoop::current(); |
76 | 74 |
77 // An event that will be signalled when we shutdown. | 75 // An event that will be signalled when we shutdown. |
78 shutdown_event_ = new base::WaitableEvent(true, false); | 76 shutdown_event_ = new base::WaitableEvent(true, false); |
79 | 77 |
80 child_process_ = factory->Create(channel_name); | 78 child_process_ = factory->Create(channel_name); |
81 | 79 |
82 CommandLine command_line; | 80 CommandLine command_line; |
83 if (command_line.HasSwitch(switches::kUserAgent)) { | 81 if (command_line.HasSwitch(switches::kUserAgent)) { |
| 82 #if defined(OS_WIN) |
| 83 // TODO(port): calling this connects an, otherwise disconnected, subgraph |
| 84 // of symbols, causing huge numbers of linker errors. |
84 webkit_glue::SetUserAgent(WideToUTF8( | 85 webkit_glue::SetUserAgent(WideToUTF8( |
85 command_line.GetSwitchValue(switches::kUserAgent))); | 86 command_line.GetSwitchValue(switches::kUserAgent))); |
| 87 #endif |
86 } | 88 } |
87 | 89 |
88 return true; | 90 return true; |
89 } | 91 } |
90 | 92 |
91 void ChildProcess::GlobalCleanup() { | 93 void ChildProcess::GlobalCleanup() { |
92 // Signal this event before destroying the child process. That way all | 94 // Signal this event before destroying the child process. That way all |
93 // background threads. | 95 // background threads. |
94 // For example, in the renderer the RenderThread instances will be able to | 96 // For example, in the renderer the RenderThread instances will be able to |
95 // notice shutdown before the render process begins waiting for them to exit. | 97 // notice shutdown before the render process begins waiting for them to exit. |
96 shutdown_event_->Signal(); | 98 shutdown_event_->Signal(); |
97 | 99 |
98 // Destroy the child process first to force all background threads to | 100 // Destroy the child process first to force all background threads to |
99 // terminate before we bring down other resources. (We null pointers | 101 // terminate before we bring down other resources. (We null pointers |
100 // just in case.) | 102 // just in case.) |
101 child_process_->Cleanup(); | 103 child_process_->Cleanup(); |
102 delete child_process_; | 104 delete child_process_; |
103 child_process_ = NULL; | 105 child_process_ = NULL; |
104 | 106 |
105 main_thread_loop_ = NULL; | 107 main_thread_loop_ = NULL; |
106 | 108 |
107 delete shutdown_event_; | 109 delete shutdown_event_; |
108 shutdown_event_ = NULL; | 110 shutdown_event_ = NULL; |
109 } | 111 } |
110 | 112 |
OLD | NEW |