Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: chrome/browser/renderer_host/browser_render_process_host.cc

Issue 164177: Provide a separate app bundle for subprocesses like the renderer on the Mac.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "chrome/browser/renderer_host/browser_render_process_host.h" 8 #include "chrome/browser/renderer_host/browser_render_process_host.h"
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 29 matching lines...) Expand all
40 #include "chrome/browser/profile.h" 40 #include "chrome/browser/profile.h"
41 #include "chrome/browser/renderer_host/render_view_host.h" 41 #include "chrome/browser/renderer_host/render_view_host.h"
42 #include "chrome/browser/renderer_host/render_widget_helper.h" 42 #include "chrome/browser/renderer_host/render_widget_helper.h"
43 #include "chrome/browser/renderer_host/render_widget_host.h" 43 #include "chrome/browser/renderer_host/render_widget_host.h"
44 #include "chrome/browser/renderer_host/resource_message_filter.h" 44 #include "chrome/browser/renderer_host/resource_message_filter.h"
45 #include "chrome/browser/renderer_host/web_cache_manager.h" 45 #include "chrome/browser/renderer_host/web_cache_manager.h"
46 #include "chrome/browser/spellchecker.h" 46 #include "chrome/browser/spellchecker.h"
47 #include "chrome/browser/visitedlink_master.h" 47 #include "chrome/browser/visitedlink_master.h"
48 #include "chrome/common/chrome_switches.h" 48 #include "chrome/common/chrome_switches.h"
49 #include "chrome/common/child_process_info.h" 49 #include "chrome/common/child_process_info.h"
50 #include "chrome/common/child_process_host.h"
50 #include "chrome/common/chrome_descriptors.h" 51 #include "chrome/common/chrome_descriptors.h"
51 #include "chrome/common/logging_chrome.h" 52 #include "chrome/common/logging_chrome.h"
52 #include "chrome/common/notification_service.h" 53 #include "chrome/common/notification_service.h"
53 #include "chrome/common/process_watcher.h" 54 #include "chrome/common/process_watcher.h"
54 #include "chrome/common/render_messages.h" 55 #include "chrome/common/render_messages.h"
55 #include "chrome/common/result_codes.h" 56 #include "chrome/common/result_codes.h"
56 #include "chrome/renderer/render_process.h" 57 #include "chrome/renderer/render_process.h"
57 #include "chrome/renderer/render_thread.h" 58 #include "chrome/renderer/render_thread.h"
58 #include "chrome/installer/util/google_update_settings.h" 59 #include "chrome/installer/util/google_update_settings.h"
59 #include "grit/generated_resources.h" 60 #include "grit/generated_resources.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // Go ahead and send whatever we already have buffered up. 195 // Go ahead and send whatever we already have buffered up.
195 Update(sender); 196 Update(sender);
196 } 197 }
197 198
198 private: 199 private:
199 bool reset_needed_; 200 bool reset_needed_;
200 bool has_receiver_; 201 bool has_receiver_;
201 VisitedLinkCommon::Fingerprints pending_; 202 VisitedLinkCommon::Fingerprints pending_;
202 }; 203 };
203 204
204
205 // Used for a View_ID where the renderer has not been attached yet
206 const int32 kInvalidViewID = -1;
207
208 // Get the path to the renderer executable, which is the same as the
209 // current executable.
210 bool GetRendererPath(std::wstring* cmd_line) {
211 return PathService::Get(base::FILE_EXE, cmd_line);
212 }
213
214 BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile) 205 BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile)
215 : RenderProcessHost(profile), 206 : RenderProcessHost(profile),
216 visible_widgets_(0), 207 visible_widgets_(0),
217 backgrounded_(true), 208 backgrounded_(true),
218 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( 209 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_(
219 base::TimeDelta::FromSeconds(5), 210 base::TimeDelta::FromSeconds(5),
220 this, &BrowserRenderProcessHost::ClearTransportDIBCache)), 211 this, &BrowserRenderProcessHost::ClearTransportDIBCache)),
221 zygote_child_(false) { 212 zygote_child_(false) {
222 widget_helper_ = new RenderWidgetHelper(); 213 widget_helper_ = new RenderWidgetHelper();
223 214
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 resource_message_filter, 291 resource_message_filter,
301 io_thread->message_loop(), true, 292 io_thread->message_loop(), true,
302 g_browser_process->shutdown_event())); 293 g_browser_process->shutdown_event()));
303 // As a preventive mesure, we DCHECK if someone sends a synchronous message 294 // As a preventive mesure, we DCHECK if someone sends a synchronous message
304 // with no time-out, which in the context of the browser process we should not 295 // with no time-out, which in the context of the browser process we should not
305 // be doing. 296 // be doing.
306 channel_->set_sync_messages_with_no_timeout_allowed(false); 297 channel_->set_sync_messages_with_no_timeout_allowed(false);
307 298
308 // Build command line for renderer, we have to quote the executable name to 299 // Build command line for renderer, we have to quote the executable name to
309 // deal with spaces. 300 // deal with spaces.
310 std::wstring renderer_path = 301 std::wstring renderer_path = ChildProcessHost::GetChildPath();
311 browser_command_line.GetSwitchValue(switches::kBrowserSubprocessPath);
312 if (renderer_path.empty()) { 302 if (renderer_path.empty()) {
313 if (!GetRendererPath(&renderer_path)) { 303 // Need to reset the channel we created above or others might think the
314 // Need to reset the channel we created above or others might think the 304 // connection is live.
315 // connection is live. 305 channel_.reset();
316 channel_.reset(); 306 return false;
317 return false;
318 }
319 } 307 }
320 CommandLine cmd_line(renderer_path); 308 CommandLine cmd_line(renderer_path);
321 if (logging::DialogsAreSuppressed()) 309 if (logging::DialogsAreSuppressed())
322 cmd_line.AppendSwitch(switches::kNoErrorDialogs); 310 cmd_line.AppendSwitch(switches::kNoErrorDialogs);
323 311
324 // propagate the following switches to the renderer command line 312 // propagate the following switches to the renderer command line
325 // (along with any associated values) if present in the browser command line 313 // (along with any associated values) if present in the browser command line
326 static const wchar_t* const switch_names[] = { 314 static const wchar_t* const switch_names[] = {
327 switches::kRendererAssertTest, 315 switches::kRendererAssertTest,
328 switches::kRendererCrashTest, 316 switches::kRendererCrashTest,
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 profile()->GetExtensionMessageService()->RemoveEventListener(event_name, 994 profile()->GetExtensionMessageService()->RemoveEventListener(event_name,
1007 pid()); 995 pid());
1008 } 996 }
1009 } 997 }
1010 998
1011 void BrowserRenderProcessHost::OnExtensionCloseChannel(int port_id) { 999 void BrowserRenderProcessHost::OnExtensionCloseChannel(int port_id) {
1012 if (profile()->GetExtensionMessageService()) { 1000 if (profile()->GetExtensionMessageService()) {
1013 profile()->GetExtensionMessageService()->CloseChannel(port_id); 1001 profile()->GetExtensionMessageService()->CloseChannel(port_id);
1014 } 1002 }
1015 } 1003 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698