| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 #include "content/browser/renderer_host/render_widget_host.h" | 71 #include "content/browser/renderer_host/render_widget_host.h" |
| 72 #include "content/browser/renderer_host/resource_message_filter.h" | 72 #include "content/browser/renderer_host/resource_message_filter.h" |
| 73 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" | 73 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" |
| 74 #include "content/browser/renderer_host/text_input_client_message_filter.h" | 74 #include "content/browser/renderer_host/text_input_client_message_filter.h" |
| 75 #include "content/browser/resolve_proxy_msg_helper.h" | 75 #include "content/browser/resolve_proxy_msg_helper.h" |
| 76 #include "content/browser/speech/speech_input_dispatcher_host.h" | 76 #include "content/browser/speech/speech_input_dispatcher_host.h" |
| 77 #include "content/browser/trace_message_filter.h" | 77 #include "content/browser/trace_message_filter.h" |
| 78 #include "content/browser/user_metrics.h" | 78 #include "content/browser/user_metrics.h" |
| 79 #include "content/browser/webui/web_ui_factory.h" | 79 #include "content/browser/webui/web_ui_factory.h" |
| 80 #include "content/browser/worker_host/worker_message_filter.h" | 80 #include "content/browser/worker_host/worker_message_filter.h" |
| 81 #include "content/common/child_process_host.h" | 81 #include "content/common/child_process_host_impl.h" |
| 82 #include "content/common/child_process_messages.h" | 82 #include "content/common/child_process_messages.h" |
| 83 #include "content/common/gpu/gpu_messages.h" | 83 #include "content/common/gpu/gpu_messages.h" |
| 84 #include "content/public/browser/notification_service.h" | 84 #include "content/public/browser/notification_service.h" |
| 85 #include "content/common/resource_messages.h" | 85 #include "content/common/resource_messages.h" |
| 86 #include "content/common/view_messages.h" | 86 #include "content/common/view_messages.h" |
| 87 #include "content/public/browser/content_browser_client.h" | 87 #include "content/public/browser/content_browser_client.h" |
| 88 #include "content/public/common/content_constants.h" | 88 #include "content/public/common/content_constants.h" |
| 89 #include "content/public/common/content_switches.h" | 89 #include "content/public/common/content_switches.h" |
| 90 #include "content/public/common/process_type.h" | 90 #include "content/public/common/process_type.h" |
| 91 #include "content/public/common/result_codes.h" | 91 #include "content/public/common/result_codes.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 105 | 105 |
| 106 #if defined(OS_WIN) | 106 #if defined(OS_WIN) |
| 107 #include <objbase.h> | 107 #include <objbase.h> |
| 108 #include "base/synchronization/waitable_event.h" | 108 #include "base/synchronization/waitable_event.h" |
| 109 #include "content/common/font_cache_dispatcher_win.h" | 109 #include "content/common/font_cache_dispatcher_win.h" |
| 110 #endif | 110 #endif |
| 111 | 111 |
| 112 #include "third_party/skia/include/core/SkBitmap.h" | 112 #include "third_party/skia/include/core/SkBitmap.h" |
| 113 | 113 |
| 114 using content::BrowserThread; | 114 using content::BrowserThread; |
| 115 using content::ChildProcessHost; |
| 116 using content::ChildProcessHostImpl; |
| 115 | 117 |
| 116 // This class creates the IO thread for the renderer when running in | 118 // This class creates the IO thread for the renderer when running in |
| 117 // single-process mode. It's not used in multi-process mode. | 119 // single-process mode. It's not used in multi-process mode. |
| 118 class RendererMainThread : public base::Thread { | 120 class RendererMainThread : public base::Thread { |
| 119 public: | 121 public: |
| 120 explicit RendererMainThread(const std::string& channel_id) | 122 explicit RendererMainThread(const std::string& channel_id) |
| 121 : base::Thread("Chrome_InProcRendererThread"), | 123 : base::Thread("Chrome_InProcRendererThread"), |
| 122 channel_id_(channel_id), | 124 channel_id_(channel_id), |
| 123 render_process_(NULL) { | 125 render_process_(NULL) { |
| 124 } | 126 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 fast_shutdown_started_(false), | 278 fast_shutdown_started_(false), |
| 277 deleting_soon_(false), | 279 deleting_soon_(false), |
| 278 pending_views_(0), | 280 pending_views_(0), |
| 279 visible_widgets_(0), | 281 visible_widgets_(0), |
| 280 backgrounded_(true), | 282 backgrounded_(true), |
| 281 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( | 283 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( |
| 282 FROM_HERE, base::TimeDelta::FromSeconds(5), | 284 FROM_HERE, base::TimeDelta::FromSeconds(5), |
| 283 this, &RenderProcessHostImpl::ClearTransportDIBCache)), | 285 this, &RenderProcessHostImpl::ClearTransportDIBCache)), |
| 284 accessibility_enabled_(false), | 286 accessibility_enabled_(false), |
| 285 is_initialized_(false), | 287 is_initialized_(false), |
| 286 id_(ChildProcessHost::GenerateChildProcessUniqueId()), | 288 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
| 287 browser_context_(browser_context), | 289 browser_context_(browser_context), |
| 288 sudden_termination_allowed_(true), | 290 sudden_termination_allowed_(true), |
| 289 ignore_input_events_(false) { | 291 ignore_input_events_(false) { |
| 290 widget_helper_ = new RenderWidgetHelper(); | 292 widget_helper_ = new RenderWidgetHelper(); |
| 291 | 293 |
| 292 ChildProcessSecurityPolicy::GetInstance()->Add(GetID()); | 294 ChildProcessSecurityPolicy::GetInstance()->Add(GetID()); |
| 293 | 295 |
| 294 // Grant most file permissions to this renderer. | 296 // Grant most file permissions to this renderer. |
| 295 // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and | 297 // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and |
| 296 // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API | 298 // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 #endif | 382 #endif |
| 381 | 383 |
| 382 // Find the renderer before creating the channel so if this fails early we | 384 // Find the renderer before creating the channel so if this fails early we |
| 383 // return without creating the channel. | 385 // return without creating the channel. |
| 384 FilePath renderer_path = ChildProcessHost::GetChildPath(flags); | 386 FilePath renderer_path = ChildProcessHost::GetChildPath(flags); |
| 385 if (renderer_path.empty()) | 387 if (renderer_path.empty()) |
| 386 return false; | 388 return false; |
| 387 | 389 |
| 388 // Setup the IPC channel. | 390 // Setup the IPC channel. |
| 389 const std::string channel_id = | 391 const std::string channel_id = |
| 390 ChildProcessHost::GenerateRandomChannelID(this); | 392 ChildProcessHostImpl::GenerateRandomChannelID(this); |
| 391 channel_.reset(new IPC::ChannelProxy( | 393 channel_.reset(new IPC::ChannelProxy( |
| 392 channel_id, IPC::Channel::MODE_SERVER, this, | 394 channel_id, IPC::Channel::MODE_SERVER, this, |
| 393 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 395 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
| 394 | 396 |
| 395 // Call the embedder first so that their IPC filters have priority. | 397 // Call the embedder first so that their IPC filters have priority. |
| 396 content::GetContentClient()->browser()->RenderProcessHostCreated( | 398 content::GetContentClient()->browser()->RenderProcessHostCreated( |
| 397 this); | 399 this); |
| 398 | 400 |
| 399 CreateMessageFilters(); | 401 CreateMessageFilters(); |
| 400 | 402 |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { | 1322 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { |
| 1321 // Only honor the request if appropriate persmissions are granted. | 1323 // Only honor the request if appropriate persmissions are granted. |
| 1322 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) | 1324 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) |
| 1323 content::GetContentClient()->browser()->OpenItem(path); | 1325 content::GetContentClient()->browser()->OpenItem(path); |
| 1324 } | 1326 } |
| 1325 | 1327 |
| 1326 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 1328 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
| 1327 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> | 1329 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
| 1328 MHTMLGenerated(job_id, data_size); | 1330 MHTMLGenerated(job_id, data_size); |
| 1329 } | 1331 } |
| OLD | NEW |