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

Side by Side Diff: content/renderer/render_thread_impl.cc

Issue 2717213004: Move SharedBitmapManager implementation out of content/ (Closed)
Patch Set: rebase Created 3 years, 9 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
OLDNEW
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/renderer/render_thread_impl.h" 5 #include "content/renderer/render_thread_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "cc/base/switches.h" 44 #include "cc/base/switches.h"
45 #include "cc/blink/web_layer_impl.h" 45 #include "cc/blink/web_layer_impl.h"
46 #include "cc/output/buffer_to_texture_target_map.h" 46 #include "cc/output/buffer_to_texture_target_map.h"
47 #include "cc/output/compositor_frame_sink.h" 47 #include "cc/output/compositor_frame_sink.h"
48 #include "cc/output/copy_output_request.h" 48 #include "cc/output/copy_output_request.h"
49 #include "cc/output/vulkan_in_process_context_provider.h" 49 #include "cc/output/vulkan_in_process_context_provider.h"
50 #include "cc/raster/task_graph_runner.h" 50 #include "cc/raster/task_graph_runner.h"
51 #include "cc/trees/layer_tree_host_common.h" 51 #include "cc/trees/layer_tree_host_common.h"
52 #include "cc/trees/layer_tree_settings.h" 52 #include "cc/trees/layer_tree_settings.h"
53 #include "components/discardable_memory/client/client_discardable_shared_memory_ manager.h" 53 #include "components/discardable_memory/client/client_discardable_shared_memory_ manager.h"
54 #include "components/display_compositor/child/child_shared_bitmap_manager.h"
54 #include "content/child/appcache/appcache_dispatcher.h" 55 #include "content/child/appcache/appcache_dispatcher.h"
55 #include "content/child/appcache/appcache_frontend_impl.h" 56 #include "content/child/appcache/appcache_frontend_impl.h"
56 #include "content/child/blob_storage/blob_message_filter.h" 57 #include "content/child/blob_storage/blob_message_filter.h"
57 #include "content/child/child_histogram_message_filter.h" 58 #include "content/child/child_histogram_message_filter.h"
58 #include "content/child/child_resource_message_filter.h" 59 #include "content/child/child_resource_message_filter.h"
59 #include "content/child/child_shared_bitmap_manager.h"
60 #include "content/child/content_child_helpers.h" 60 #include "content/child/content_child_helpers.h"
61 #include "content/child/db_message_filter.h" 61 #include "content/child/db_message_filter.h"
62 #include "content/child/indexed_db/indexed_db_dispatcher.h" 62 #include "content/child/indexed_db/indexed_db_dispatcher.h"
63 #include "content/child/memory/child_memory_coordinator_impl.h" 63 #include "content/child/memory/child_memory_coordinator_impl.h"
64 #include "content/child/resource_dispatcher.h" 64 #include "content/child/resource_dispatcher.h"
65 #include "content/child/resource_scheduling_filter.h" 65 #include "content/child/resource_scheduling_filter.h"
66 #include "content/child/runtime_features.h" 66 #include "content/child/runtime_features.h"
67 #include "content/child/thread_safe_sender.h" 67 #include "content/child/thread_safe_sender.h"
68 #include "content/child/web_database_observer_impl.h" 68 #include "content/child/web_database_observer_impl.h"
69 #include "content/child/worker_thread_registry.h" 69 #include "content/child/worker_thread_registry.h"
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 543
544 // static 544 // static
545 mojom::RenderMessageFilter* RenderThreadImpl::current_render_message_filter() { 545 mojom::RenderMessageFilter* RenderThreadImpl::current_render_message_filter() {
546 if (g_render_message_filter_for_testing) 546 if (g_render_message_filter_for_testing)
547 return g_render_message_filter_for_testing; 547 return g_render_message_filter_for_testing;
548 DCHECK(current()); 548 DCHECK(current());
549 return current()->render_message_filter(); 549 return current()->render_message_filter();
550 } 550 }
551 551
552 // static 552 // static
553 const scoped_refptr<mojom::ThreadSafeRenderMessageFilterAssociatedPtr>&
554 RenderThreadImpl::current_thread_safe_render_message_filter() {
555 DCHECK(current());
556 return current()->thread_safe_render_message_filter();
557 }
558
559 // static
560 void RenderThreadImpl::SetRenderMessageFilterForTesting( 553 void RenderThreadImpl::SetRenderMessageFilterForTesting(
561 mojom::RenderMessageFilter* render_message_filter) { 554 mojom::RenderMessageFilter* render_message_filter) {
562 g_render_message_filter_for_testing = render_message_filter; 555 g_render_message_filter_for_testing = render_message_filter;
563 } 556 }
564 557
565 // In single-process mode used for debugging, we don't pass a renderer client 558 // In single-process mode used for debugging, we don't pass a renderer client
566 // ID via command line because RenderThreadImpl lives in the same process as 559 // ID via command line because RenderThreadImpl lives in the same process as
567 // the browser 560 // the browser
568 RenderThreadImpl::RenderThreadImpl( 561 RenderThreadImpl::RenderThreadImpl(
569 const InProcessChildThreadParams& params, 562 const InProcessChildThreadParams& params,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 ChildProcess::current()->set_main_thread(this); 616 ChildProcess::current()->set_main_thread(this);
624 617
625 if (IsRunningInMash()) { 618 if (IsRunningInMash()) {
626 gpu_ = ui::Gpu::Create(GetServiceManagerConnection()->GetConnector(), 619 gpu_ = ui::Gpu::Create(GetServiceManagerConnection()->GetConnector(),
627 GetIOTaskRunner()); 620 GetIOTaskRunner());
628 } else { 621 } else {
629 gpu_ = ui::Gpu::Create(GetRemoteInterfaces(), GetIOTaskRunner()); 622 gpu_ = ui::Gpu::Create(GetRemoteInterfaces(), GetIOTaskRunner());
630 } 623 }
631 624
632 channel()->GetThreadSafeRemoteAssociatedInterface( 625 channel()->GetThreadSafeRemoteAssociatedInterface(
633 &thread_safe_render_message_filter_); 626 &thread_safe_shared_bitmap_manager_ptr_);
634 shared_bitmap_manager_.reset( 627 shared_bitmap_manager_.reset(new display_compositor::ChildSharedBitmapManager(
635 new ChildSharedBitmapManager(thread_safe_render_message_filter_)); 628 thread_safe_shared_bitmap_manager_ptr_));
636 629
637 InitializeWebKit(resource_task_queue); 630 InitializeWebKit(resource_task_queue);
638 631
639 // In single process the single process is all there is. 632 // In single process the single process is all there is.
640 webkit_shared_timer_suspended_ = false; 633 webkit_shared_timer_suspended_ = false;
641 widget_count_ = 0; 634 widget_count_ = 0;
642 hidden_widget_count_ = 0; 635 hidden_widget_count_ = 0;
643 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; 636 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs;
644 idle_notifications_to_skip_ = 0; 637 idle_notifications_to_skip_ = 0;
645 638
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 void RenderThreadImpl::RecordAction(const base::UserMetricsAction& action) { 1229 void RenderThreadImpl::RecordAction(const base::UserMetricsAction& action) {
1237 Send(new ViewHostMsg_UserMetricsRecordAction(action.str_)); 1230 Send(new ViewHostMsg_UserMetricsRecordAction(action.str_));
1238 } 1231 }
1239 1232
1240 void RenderThreadImpl::RecordComputedAction(const std::string& action) { 1233 void RenderThreadImpl::RecordComputedAction(const std::string& action) {
1241 Send(new ViewHostMsg_UserMetricsRecordAction(action)); 1234 Send(new ViewHostMsg_UserMetricsRecordAction(action));
1242 } 1235 }
1243 1236
1244 std::unique_ptr<base::SharedMemory> 1237 std::unique_ptr<base::SharedMemory>
1245 RenderThreadImpl::HostAllocateSharedMemoryBuffer(size_t size) { 1238 RenderThreadImpl::HostAllocateSharedMemoryBuffer(size_t size) {
1246 return ChildThreadImpl::AllocateSharedMemory(size); 1239 return display_compositor::ChildSharedBitmapManager::AllocateSharedMemory(
1240 size);
1247 } 1241 }
1248 1242
1249 cc::SharedBitmapManager* RenderThreadImpl::GetSharedBitmapManager() { 1243 cc::SharedBitmapManager* RenderThreadImpl::GetSharedBitmapManager() {
1250 return shared_bitmap_manager(); 1244 return shared_bitmap_manager();
1251 } 1245 }
1252 1246
1253 void RenderThreadImpl::RegisterExtension(v8::Extension* extension) { 1247 void RenderThreadImpl::RegisterExtension(v8::Extension* extension) {
1254 WebScriptController::registerExtension(extension); 1248 WebScriptController::registerExtension(extension);
1255 } 1249 }
1256 1250
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 GetChannel()->GetRemoteAssociatedInterface(&render_frame_message_filter_); 2001 GetChannel()->GetRemoteAssociatedInterface(&render_frame_message_filter_);
2008 return render_frame_message_filter_.get(); 2002 return render_frame_message_filter_.get();
2009 } 2003 }
2010 2004
2011 mojom::RenderMessageFilter* RenderThreadImpl::render_message_filter() { 2005 mojom::RenderMessageFilter* RenderThreadImpl::render_message_filter() {
2012 if (!render_message_filter_) 2006 if (!render_message_filter_)
2013 GetChannel()->GetRemoteAssociatedInterface(&render_message_filter_); 2007 GetChannel()->GetRemoteAssociatedInterface(&render_message_filter_);
2014 return render_message_filter_.get(); 2008 return render_message_filter_.get();
2015 } 2009 }
2016 2010
2017 const scoped_refptr<mojom::ThreadSafeRenderMessageFilterAssociatedPtr>&
2018 RenderThreadImpl::thread_safe_render_message_filter() {
2019 return thread_safe_render_message_filter_;
2020 }
2021
2022 gpu::GpuChannelHost* RenderThreadImpl::GetGpuChannel() { 2011 gpu::GpuChannelHost* RenderThreadImpl::GetGpuChannel() {
2023 if (!gpu_channel_) 2012 if (!gpu_channel_)
2024 return nullptr; 2013 return nullptr;
2025 if (gpu_channel_->IsLost()) 2014 if (gpu_channel_->IsLost())
2026 return nullptr; 2015 return nullptr;
2027 return gpu_channel_.get(); 2016 return gpu_channel_.get();
2028 } 2017 }
2029 2018
2030 void RenderThreadImpl::CreateView(mojom::CreateViewParamsPtr params) { 2019 void RenderThreadImpl::CreateView(mojom::CreateViewParamsPtr params) {
2031 CompositorDependencies* compositor_deps = this; 2020 CompositorDependencies* compositor_deps = this;
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 } 2369 }
2381 } 2370 }
2382 2371
2383 void RenderThreadImpl::OnRendererInterfaceRequest( 2372 void RenderThreadImpl::OnRendererInterfaceRequest(
2384 mojom::RendererAssociatedRequest request) { 2373 mojom::RendererAssociatedRequest request) {
2385 DCHECK(!renderer_binding_.is_bound()); 2374 DCHECK(!renderer_binding_.is_bound());
2386 renderer_binding_.Bind(std::move(request)); 2375 renderer_binding_.Bind(std::move(request));
2387 } 2376 }
2388 2377
2389 } // namespace content 2378 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698