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/public/app/content_main_runner.h" | 5 #include "content/public/app/content_main_runner.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // all processes except the browser process (where we call system | 190 // all processes except the browser process (where we call system |
191 // APIs that may rely on the correct locale for formatting numbers | 191 // APIs that may rely on the correct locale for formatting numbers |
192 // when presenting them to the user), reset the locale for numeric | 192 // when presenting them to the user), reset the locale for numeric |
193 // formatting. | 193 // formatting. |
194 // Note that this is not correct for plugin processes -- they can | 194 // Note that this is not correct for plugin processes -- they can |
195 // surface UI -- but it's likely they get this wrong too so why not. | 195 // surface UI -- but it's likely they get this wrong too so why not. |
196 setlocale(LC_NUMERIC, "C"); | 196 setlocale(LC_NUMERIC, "C"); |
197 #endif | 197 #endif |
198 } | 198 } |
199 | 199 |
200 // Only needed on Windows for creating stats tables. | |
201 #if defined(OS_WIN) | |
202 static base::ProcessId GetBrowserPid(const base::CommandLine& command_line) { | |
203 base::ProcessId browser_pid = base::GetCurrentProcId(); | |
204 if (command_line.HasSwitch(switches::kProcessChannelID)) { | |
205 std::string channel_name = | |
206 command_line.GetSwitchValueASCII(switches::kProcessChannelID); | |
207 | |
208 int browser_pid_int; | |
209 base::StringToInt(channel_name, &browser_pid_int); | |
210 browser_pid = static_cast<base::ProcessId>(browser_pid_int); | |
211 DCHECK_NE(browser_pid_int, 0); | |
212 } | |
213 return browser_pid; | |
214 } | |
215 #endif | |
216 | |
217 class ContentClientInitializer { | 200 class ContentClientInitializer { |
218 public: | 201 public: |
219 static void Set(const std::string& process_type, | 202 static void Set(const std::string& process_type, |
220 ContentMainDelegate* delegate) { | 203 ContentMainDelegate* delegate) { |
221 ContentClient* content_client = GetContentClient(); | 204 ContentClient* content_client = GetContentClient(); |
222 #if !defined(CHROME_MULTIPLE_DLL_CHILD) | 205 #if !defined(CHROME_MULTIPLE_DLL_CHILD) |
223 if (process_type.empty()) { | 206 if (process_type.empty()) { |
224 if (delegate) | 207 if (delegate) |
225 content_client->browser_ = delegate->CreateContentBrowserClient(); | 208 content_client->browser_ = delegate->CreateContentBrowserClient(); |
226 if (!content_client->browser_) | 209 if (!content_client->browser_) |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 | 851 |
869 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 852 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
870 }; | 853 }; |
871 | 854 |
872 // static | 855 // static |
873 ContentMainRunner* ContentMainRunner::Create() { | 856 ContentMainRunner* ContentMainRunner::Create() { |
874 return new ContentMainRunnerImpl(); | 857 return new ContentMainRunnerImpl(); |
875 } | 858 } |
876 | 859 |
877 } // namespace content | 860 } // namespace content |
OLD | NEW |