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

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

Issue 2548423002: Hosting the discardable memory service in the mus process (Closed)
Patch Set: Rebase Created 4 years 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
« no previous file with comments | « content/public/app/mojo/content_renderer_manifest.json ('k') | services/ui/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 #include "media/base/media.h" 134 #include "media/base/media.h"
135 #include "media/media_features.h" 135 #include "media/media_features.h"
136 #include "media/renderers/gpu_video_accelerator_factories.h" 136 #include "media/renderers/gpu_video_accelerator_factories.h"
137 #include "mojo/common/common_type_converters.h" 137 #include "mojo/common/common_type_converters.h"
138 #include "mojo/public/cpp/bindings/strong_binding.h" 138 #include "mojo/public/cpp/bindings/strong_binding.h"
139 #include "net/base/net_errors.h" 139 #include "net/base/net_errors.h"
140 #include "net/base/port_util.h" 140 #include "net/base/port_util.h"
141 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 141 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
142 #include "net/base/url_util.h" 142 #include "net/base/url_util.h"
143 #include "ppapi/features/features.h" 143 #include "ppapi/features/features.h"
144 #include "services/service_manager/public/cpp/connector.h"
144 #include "services/service_manager/public/cpp/interface_provider.h" 145 #include "services/service_manager/public/cpp/interface_provider.h"
145 #include "services/service_manager/public/cpp/interface_registry.h" 146 #include "services/service_manager/public/cpp/interface_registry.h"
147 #include "services/ui/public/interfaces/constants.mojom.h"
146 #include "skia/ext/event_tracer_impl.h" 148 #include "skia/ext/event_tracer_impl.h"
147 #include "skia/ext/skia_memory_dump_provider.h" 149 #include "skia/ext/skia_memory_dump_provider.h"
148 #include "third_party/WebKit/public/platform/WebImageGenerator.h" 150 #include "third_party/WebKit/public/platform/WebImageGenerator.h"
149 #include "third_party/WebKit/public/platform/WebMemoryCoordinator.h" 151 #include "third_party/WebKit/public/platform/WebMemoryCoordinator.h"
150 #include "third_party/WebKit/public/platform/WebString.h" 152 #include "third_party/WebKit/public/platform/WebString.h"
151 #include "third_party/WebKit/public/platform/WebThread.h" 153 #include "third_party/WebKit/public/platform/WebThread.h"
152 #include "third_party/WebKit/public/platform/scheduler/child/compositor_worker_s cheduler.h" 154 #include "third_party/WebKit/public/platform/scheduler/child/compositor_worker_s cheduler.h"
153 #include "third_party/WebKit/public/platform/scheduler/child/webthread_impl_for_ worker_scheduler.h" 155 #include "third_party/WebKit/public/platform/scheduler/child/webthread_impl_for_ worker_scheduler.h"
154 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h" 156 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h"
155 #include "third_party/WebKit/public/web/WebCache.h" 157 #include "third_party/WebKit/public/web/WebCache.h"
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 blink::WebView::setUseExternalPopupMenus(true); 647 blink::WebView::setUseExternalPopupMenus(true);
646 #endif 648 #endif
647 649
648 lazy_tls.Pointer()->Set(this); 650 lazy_tls.Pointer()->Set(this);
649 651
650 // Register this object as the main thread. 652 // Register this object as the main thread.
651 ChildProcess::current()->set_main_thread(this); 653 ChildProcess::current()->set_main_thread(this);
652 654
653 if (IsRunningInMash()) { 655 if (IsRunningInMash()) {
654 gpu_ = ui::Gpu::Create(GetServiceManagerConnection()->GetConnector(), 656 gpu_ = ui::Gpu::Create(GetServiceManagerConnection()->GetConnector(),
655 ChildProcess::current()->io_task_runner()); 657 GetIOTaskRunner());
656 } else { 658 } else {
657 gpu_ = ui::Gpu::Create(GetRemoteInterfaces(), 659 gpu_ = ui::Gpu::Create(GetRemoteInterfaces(), GetIOTaskRunner());
658 ChildProcess::current()->io_task_runner());
659 } 660 }
660 661
661 thread_safe_associated_interface_ptr_provider_ = 662 thread_safe_associated_interface_ptr_provider_ =
662 base::MakeUnique<ThreadSafeAssociatedInterfacePtrProvider>(channel()); 663 base::MakeUnique<ThreadSafeAssociatedInterfacePtrProvider>(channel());
663 thread_safe_render_message_filter_ = 664 thread_safe_render_message_filter_ =
664 thread_safe_associated_interface_ptr_provider_ 665 thread_safe_associated_interface_ptr_provider_
665 ->CreateInterfacePtr<mojom::RenderMessageFilter>(); 666 ->CreateInterfacePtr<mojom::RenderMessageFilter>();
666 shared_bitmap_manager_.reset( 667 shared_bitmap_manager_.reset(
667 new ChildSharedBitmapManager(thread_safe_render_message_filter_)); 668 new ChildSharedBitmapManager(thread_safe_render_message_filter_));
668 669
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 DCHECK(parsed_num_raster_threads) << string_value; 873 DCHECK(parsed_num_raster_threads) << string_value;
873 DCHECK_GT(num_raster_threads, 0); 874 DCHECK_GT(num_raster_threads, 0);
874 875
875 // TODO(vmpstr): If the flag sticks, we should clean it up and always have 876 // TODO(vmpstr): If the flag sticks, we should clean it up and always have
876 // image decode tasks. 877 // image decode tasks.
877 are_image_decode_tasks_enabled_ = true; 878 are_image_decode_tasks_enabled_ = true;
878 879
879 categorized_worker_pool_->Start(num_raster_threads); 880 categorized_worker_pool_->Start(num_raster_threads);
880 881
881 discardable_memory::mojom::DiscardableSharedMemoryManagerPtr manager_ptr; 882 discardable_memory::mojom::DiscardableSharedMemoryManagerPtr manager_ptr;
882 ChildThread::Get()->GetRemoteInterfaces()->GetInterface( 883 if (IsRunningInMash()) {
883 mojo::GetProxy(&manager_ptr)); 884 #if defined(USE_AURA)
885 GetServiceManagerConnection()->GetConnector()->ConnectToInterface(
886 ui::mojom::kServiceName, &manager_ptr);
887 #else
888 NOTREACHED();
889 #endif
890 } else {
891 ChildThread::Get()->GetRemoteInterfaces()->GetInterface(
892 mojo::GetProxy(&manager_ptr));
893 }
894
884 discardable_shared_memory_manager_ = base::MakeUnique< 895 discardable_shared_memory_manager_ = base::MakeUnique<
885 discardable_memory::ClientDiscardableSharedMemoryManager>( 896 discardable_memory::ClientDiscardableSharedMemoryManager>(
886 std::move(manager_ptr), GetIOTaskRunner()); 897 std::move(manager_ptr), GetIOTaskRunner());
887 898
888 // TODO(boliu): In single process, browser main loop should set up the 899 // TODO(boliu): In single process, browser main loop should set up the
889 // discardable memory manager, and should skip this if kSingleProcess. 900 // discardable memory manager, and should skip this if kSingleProcess.
890 // See crbug.com/503724. 901 // See crbug.com/503724.
891 base::DiscardableMemoryAllocator::SetInstance( 902 base::DiscardableMemoryAllocator::SetInstance(
892 discardable_shared_memory_manager_.get()); 903 discardable_shared_memory_manager_.get());
893 904
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after
2460 } 2471 }
2461 } 2472 }
2462 2473
2463 void RenderThreadImpl::OnRendererInterfaceRequest( 2474 void RenderThreadImpl::OnRendererInterfaceRequest(
2464 mojom::RendererAssociatedRequest request) { 2475 mojom::RendererAssociatedRequest request) {
2465 DCHECK(!renderer_binding_.is_bound()); 2476 DCHECK(!renderer_binding_.is_bound());
2466 renderer_binding_.Bind(std::move(request)); 2477 renderer_binding_.Bind(std::move(request));
2467 } 2478 }
2468 2479
2469 } // namespace content 2480 } // namespace content
OLDNEW
« no previous file with comments | « content/public/app/mojo/content_renderer_manifest.json ('k') | services/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698