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 // 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
351 bool g_run_renderer_in_process_ = false; | 351 bool g_run_renderer_in_process_ = false; |
352 | 352 |
353 // static | 353 // static |
354 void RenderProcessHost::SetMaxRendererProcessCount(size_t count) { | 354 void RenderProcessHost::SetMaxRendererProcessCount(size_t count) { |
355 g_max_renderer_count_override = count; | 355 g_max_renderer_count_override = count; |
356 } | 356 } |
357 | 357 |
358 RenderProcessHostImpl::RenderProcessHostImpl( | 358 RenderProcessHostImpl::RenderProcessHostImpl( |
359 BrowserContext* browser_context, | 359 BrowserContext* browser_context, |
360 StoragePartitionImpl* storage_partition_impl, | 360 StoragePartitionImpl* storage_partition_impl, |
361 bool supports_browser_plugin, | |
361 bool is_guest) | 362 bool is_guest) |
362 : fast_shutdown_started_(false), | 363 : fast_shutdown_started_(false), |
363 deleting_soon_(false), | 364 deleting_soon_(false), |
364 pending_views_(0), | 365 pending_views_(0), |
365 visible_widgets_(0), | 366 visible_widgets_(0), |
366 backgrounded_(true), | 367 backgrounded_(true), |
367 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( | 368 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( |
368 FROM_HERE, base::TimeDelta::FromSeconds(5), | 369 FROM_HERE, base::TimeDelta::FromSeconds(5), |
369 this, &RenderProcessHostImpl::ClearTransportDIBCache)), | 370 this, &RenderProcessHostImpl::ClearTransportDIBCache)), |
370 is_initialized_(false), | 371 is_initialized_(false), |
371 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 372 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
372 browser_context_(browser_context), | 373 browser_context_(browser_context), |
373 storage_partition_impl_(storage_partition_impl), | 374 storage_partition_impl_(storage_partition_impl), |
374 sudden_termination_allowed_(true), | 375 sudden_termination_allowed_(true), |
375 ignore_input_events_(false), | 376 ignore_input_events_(false), |
376 #if defined(OS_ANDROID) | 377 #if defined(OS_ANDROID) |
377 dummy_shutdown_event_(false, false), | 378 dummy_shutdown_event_(false, false), |
378 #endif | 379 #endif |
380 supports_browser_plugin_(supports_browser_plugin), | |
Charlie Reis
2013/03/21 01:09:39
Can you add a CHECK(!is_guest || supports_browser_
Fady Samuel
2013/03/21 02:51:13
No, unfortunately.
is_guest does not imply suppor
| |
379 is_guest_(is_guest) { | 381 is_guest_(is_guest) { |
380 widget_helper_ = new RenderWidgetHelper(); | 382 widget_helper_ = new RenderWidgetHelper(); |
381 | 383 |
382 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); | 384 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
383 | 385 |
384 CHECK(!g_exited_main_message_loop); | 386 CHECK(!g_exited_main_message_loop); |
385 RegisterHost(GetID(), this); | 387 RegisterHost(GetID(), this); |
386 g_all_hosts.Get().set_check_on_null_data(true); | 388 g_all_hosts.Get().set_check_on_null_data(true); |
387 // Initialize |child_process_activity_time_| to a reasonable value. | 389 // Initialize |child_process_activity_time_| to a reasonable value. |
388 mark_child_process_activity_time(); | 390 mark_child_process_activity_time(); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
522 is_initialized_ = true; | 524 is_initialized_ = true; |
523 return true; | 525 return true; |
524 } | 526 } |
525 | 527 |
526 void RenderProcessHostImpl::CreateMessageFilters() { | 528 void RenderProcessHostImpl::CreateMessageFilters() { |
527 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 529 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
528 channel_->AddFilter(new ResourceSchedulerFilter(GetID())); | 530 channel_->AddFilter(new ResourceSchedulerFilter(GetID())); |
529 MediaInternals* media_internals = MediaInternals::GetInstance();; | 531 MediaInternals* media_internals = MediaInternals::GetInstance();; |
530 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages | 532 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages |
531 // from guests. | 533 // from guests. |
532 // TODO(fsamuel): Call out to the ContentBrowserClient to decide whether or | 534 if (supports_browser_plugin_) { |
533 // not to install the BrowserPluginMessageFilter. | 535 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( |
534 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( | 536 new BrowserPluginMessageFilter(GetID(), IsGuest())); |
535 new BrowserPluginMessageFilter(GetID(), IsGuest())); | 537 channel_->AddFilter(bp_message_filter); |
536 channel_->AddFilter(bp_message_filter); | 538 } |
537 | 539 |
538 scoped_refptr<RenderMessageFilter> render_message_filter( | 540 scoped_refptr<RenderMessageFilter> render_message_filter( |
539 new RenderMessageFilter( | 541 new RenderMessageFilter( |
540 GetID(), | 542 GetID(), |
541 #if defined(ENABLE_PLUGINS) | 543 #if defined(ENABLE_PLUGINS) |
542 PluginServiceImpl::GetInstance(), | 544 PluginServiceImpl::GetInstance(), |
543 #else | 545 #else |
544 NULL, | 546 NULL, |
545 #endif | 547 #endif |
546 GetBrowserContext(), | 548 GetBrowserContext(), |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
711 DCHECK(!backgrounded_); | 713 DCHECK(!backgrounded_); |
712 SetBackgrounded(true); | 714 SetBackgrounded(true); |
713 } | 715 } |
714 } | 716 } |
715 | 717 |
716 int RenderProcessHostImpl::VisibleWidgetCount() const { | 718 int RenderProcessHostImpl::VisibleWidgetCount() const { |
717 return visible_widgets_; | 719 return visible_widgets_; |
718 } | 720 } |
719 | 721 |
720 bool RenderProcessHostImpl::IsGuest() const { | 722 bool RenderProcessHostImpl::IsGuest() const { |
721 return is_guest_; | 723 return is_guest_; |
Charlie Reis
2013/03/21 01:09:39
Maybe this should be supports_browser_plugin_ && i
Fady Samuel
2013/03/21 02:51:13
No, guests don't support browser plugin.
| |
722 } | 724 } |
723 | 725 |
724 StoragePartition* RenderProcessHostImpl::GetStoragePartition() const { | 726 StoragePartition* RenderProcessHostImpl::GetStoragePartition() const { |
725 return storage_partition_impl_; | 727 return storage_partition_impl_; |
726 } | 728 } |
727 | 729 |
728 void RenderProcessHostImpl::AppendRendererCommandLine( | 730 void RenderProcessHostImpl::AppendRendererCommandLine( |
729 CommandLine* command_line) const { | 731 CommandLine* command_line) const { |
730 // Pass the process type first, so it shows first in process listings. | 732 // Pass the process type first, so it shows first in process listings. |
731 command_line->AppendSwitchASCII(switches::kProcessType, | 733 command_line->AppendSwitchASCII(switches::kProcessType, |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1693 TRACE_EVENT0("renderer_host", | 1695 TRACE_EVENT0("renderer_host", |
1694 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1696 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
1695 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 1697 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
1696 ack_params.sync_point = 0; | 1698 ack_params.sync_point = 0; |
1697 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1699 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
1698 gpu_process_host_id, | 1700 gpu_process_host_id, |
1699 ack_params); | 1701 ack_params); |
1700 } | 1702 } |
1701 | 1703 |
1702 } // namespace content | 1704 } // namespace content |
OLD | NEW |