Chromium Code Reviews| 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/browser/worker_host/worker_process_host.h" | 5 #include "chrome/browser/worker_host/worker_process_host.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 | 98 |
| 99 bool WorkerProcessHost::Init() { | 99 bool WorkerProcessHost::Init() { |
| 100 if (!CreateChannel()) | 100 if (!CreateChannel()) |
| 101 return false; | 101 return false; |
| 102 | 102 |
| 103 FilePath exe_path = GetChildPath(true); | 103 FilePath exe_path = GetChildPath(true); |
| 104 if (exe_path.empty()) | 104 if (exe_path.empty()) |
| 105 return false; | 105 return false; |
| 106 | 106 |
| 107 CommandLine* cmd_line = new CommandLine(exe_path); | 107 CommandLine* cmd_line = new CommandLine(exe_path); |
| 108 cmd_line->AppendSwitchWithValue(switches::kProcessType, | 108 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kWorkerProcess); |
| 109 switches::kWorkerProcess); | 109 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); |
| 110 cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, channel_id()); | |
| 111 SetCrashReporterCommandLine(cmd_line); | 110 SetCrashReporterCommandLine(cmd_line); |
| 112 | 111 |
| 113 if (CommandLine::ForCurrentProcess()->HasSwitch( | 112 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 114 switches::kEnableNativeWebWorkers)) { | 113 switches::kEnableNativeWebWorkers)) { |
|
viettrungluu
2010/07/30 02:33:16
Couldn't you convert most of these to CopyWhatever
| |
| 115 cmd_line->AppendSwitch(switches::kEnableNativeWebWorkers); | 114 cmd_line->AppendSwitch(switches::kEnableNativeWebWorkers); |
| 116 } | 115 } |
| 117 | 116 |
| 118 if (CommandLine::ForCurrentProcess()->HasSwitch( | 117 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 119 switches::kWebWorkerShareProcesses)) { | 118 switches::kWebWorkerShareProcesses)) { |
| 120 cmd_line->AppendSwitch(switches::kWebWorkerShareProcesses); | 119 cmd_line->AppendSwitch(switches::kWebWorkerShareProcesses); |
| 121 } | 120 } |
| 122 | 121 |
| 123 if (CommandLine::ForCurrentProcess()->HasSwitch( | 122 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 124 switches::kDisableApplicationCache)) { | 123 switches::kDisableApplicationCache)) { |
| 125 cmd_line->AppendSwitch(switches::kDisableApplicationCache); | 124 cmd_line->AppendSwitch(switches::kDisableApplicationCache); |
| 126 } | 125 } |
| 127 | 126 |
| 128 if (CommandLine::ForCurrentProcess()->HasSwitch( | 127 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 129 switches::kDisableDatabases)) { | 128 switches::kDisableDatabases)) { |
| 130 cmd_line->AppendSwitch(switches::kDisableDatabases); | 129 cmd_line->AppendSwitch(switches::kDisableDatabases); |
| 131 } | 130 } |
| 132 | 131 |
| 133 if (CommandLine::ForCurrentProcess()->HasSwitch( | 132 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 134 switches::kEnableLogging)) { | 133 switches::kEnableLogging)) { |
| 135 cmd_line->AppendSwitch(switches::kEnableLogging); | 134 cmd_line->AppendSwitch(switches::kEnableLogging); |
| 136 } | 135 } |
| 137 if (CommandLine::ForCurrentProcess()->HasSwitch( | 136 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 138 switches::kLoggingLevel)) { | 137 switches::kLoggingLevel)) { |
| 139 const std::wstring level = | 138 const std::string level = |
| 140 CommandLine::ForCurrentProcess()->GetSwitchValue( | 139 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 141 switches::kLoggingLevel); | 140 switches::kLoggingLevel); |
| 142 cmd_line->AppendSwitchWithValue(switches::kLoggingLevel, level); | 141 cmd_line->AppendSwitchASCII(switches::kLoggingLevel, level); |
| 143 } | 142 } |
| 144 | 143 |
| 145 if (CommandLine::ForCurrentProcess()->HasSwitch( | 144 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 146 switches::kDisableWebSockets)) { | 145 switches::kDisableWebSockets)) { |
| 147 cmd_line->AppendSwitch(switches::kDisableWebSockets); | 146 cmd_line->AppendSwitch(switches::kDisableWebSockets); |
| 148 } | 147 } |
| 149 | 148 |
| 150 #if defined(OS_WIN) | 149 #if defined(OS_WIN) |
| 151 if (CommandLine::ForCurrentProcess()->HasSwitch( | 150 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 152 switches::kDisableDesktopNotifications)) { | 151 switches::kDisableDesktopNotifications)) { |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 627 } | 626 } |
| 628 } | 627 } |
| 629 return false; | 628 return false; |
| 630 } | 629 } |
| 631 | 630 |
| 632 WorkerProcessHost::WorkerInstance::SenderInfo | 631 WorkerProcessHost::WorkerInstance::SenderInfo |
| 633 WorkerProcessHost::WorkerInstance::GetSender() const { | 632 WorkerProcessHost::WorkerInstance::GetSender() const { |
| 634 DCHECK(NumSenders() == 1); | 633 DCHECK(NumSenders() == 1); |
| 635 return *senders_.begin(); | 634 return *senders_.begin(); |
| 636 } | 635 } |
| OLD | NEW |