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

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

Issue 2137303002: Allow ChildThreadImpl subclasses to manually start MojoShellConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | no next file » | 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 return lazy_tls.Pointer()->Get(); 604 return lazy_tls.Pointer()->Get();
605 } 605 }
606 606
607 RenderThreadImpl::RenderThreadImpl( 607 RenderThreadImpl::RenderThreadImpl(
608 const InProcessChildThreadParams& params, 608 const InProcessChildThreadParams& params,
609 std::unique_ptr<scheduler::RendererScheduler> scheduler, 609 std::unique_ptr<scheduler::RendererScheduler> scheduler,
610 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue) 610 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue)
611 : ChildThreadImpl(Options::Builder() 611 : ChildThreadImpl(Options::Builder()
612 .InBrowserProcess(params) 612 .InBrowserProcess(params)
613 .UseMojoChannel(true) 613 .UseMojoChannel(true)
614 .AutoStartMojoShellConnection(false)
614 .Build()), 615 .Build()),
615 renderer_scheduler_(std::move(scheduler)), 616 renderer_scheduler_(std::move(scheduler)),
616 categorized_worker_pool_(new CategorizedWorkerPool()) { 617 categorized_worker_pool_(new CategorizedWorkerPool()) {
617 Init(resource_task_queue); 618 Init(resource_task_queue);
618 } 619 }
619 620
620 // When we run plugins in process, we actually run them on the render thread, 621 // When we run plugins in process, we actually run them on the render thread,
621 // which means that we need to make the render thread pump UI events. 622 // which means that we need to make the render thread pump UI events.
622 RenderThreadImpl::RenderThreadImpl( 623 RenderThreadImpl::RenderThreadImpl(
623 std::unique_ptr<base::MessageLoop> main_message_loop, 624 std::unique_ptr<base::MessageLoop> main_message_loop,
624 std::unique_ptr<scheduler::RendererScheduler> scheduler) 625 std::unique_ptr<scheduler::RendererScheduler> scheduler)
625 : ChildThreadImpl(Options::Builder().UseMojoChannel(true).Build()), 626 : ChildThreadImpl(Options::Builder()
627 .UseMojoChannel(true)
628 .AutoStartMojoShellConnection(false)
629 .Build()),
626 renderer_scheduler_(std::move(scheduler)), 630 renderer_scheduler_(std::move(scheduler)),
627 main_message_loop_(std::move(main_message_loop)), 631 main_message_loop_(std::move(main_message_loop)),
628 categorized_worker_pool_(new CategorizedWorkerPool()) { 632 categorized_worker_pool_(new CategorizedWorkerPool()) {
629 scoped_refptr<base::SingleThreadTaskRunner> test_task_counter; 633 scoped_refptr<base::SingleThreadTaskRunner> test_task_counter;
630 Init(test_task_counter); 634 Init(test_task_counter);
631 } 635 }
632 636
633 void RenderThreadImpl::Init( 637 void RenderThreadImpl::Init(
634 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue) { 638 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue) {
635 TRACE_EVENT0("startup", "RenderThreadImpl::Init"); 639 TRACE_EVENT0("startup", "RenderThreadImpl::Init");
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 723
720 midi_message_filter_ = new MidiMessageFilter(GetIOTaskRunner()); 724 midi_message_filter_ = new MidiMessageFilter(GetIOTaskRunner());
721 AddFilter(midi_message_filter_.get()); 725 AddFilter(midi_message_filter_.get());
722 726
723 AddFilter((new IndexedDBMessageFilter(thread_safe_sender()))->GetFilter()); 727 AddFilter((new IndexedDBMessageFilter(thread_safe_sender()))->GetFilter());
724 728
725 AddFilter((new CacheStorageMessageFilter(thread_safe_sender()))->GetFilter()); 729 AddFilter((new CacheStorageMessageFilter(thread_safe_sender()))->GetFilter());
726 730
727 AddFilter((new ServiceWorkerContextMessageFilter())->GetFilter()); 731 AddFilter((new ServiceWorkerContextMessageFilter())->GetFilter());
728 732
733 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA)
734 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
735 switches::kUseMusInRenderer)) {
736 CreateRenderWidgetWindowTreeClientFactory(GetMojoShellConnection());
737 }
738 #endif
739
740 // Must be called before RenderThreadStarted() below.
741 StartMojoShellConnection();
742
729 GetContentClient()->renderer()->RenderThreadStarted(); 743 GetContentClient()->renderer()->RenderThreadStarted();
730 744
731 InitSkiaEventTracer(); 745 InitSkiaEventTracer();
732 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 746 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
733 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); 747 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr);
734 748
735 const base::CommandLine& command_line = 749 const base::CommandLine& command_line =
736 *base::CommandLine::ForCurrentProcess(); 750 *base::CommandLine::ForCurrentProcess();
737 751
738 #if defined(ENABLE_IPC_FUZZER) 752 #if defined(ENABLE_IPC_FUZZER)
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); 994 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager();
981 995
982 // The message loop must be cleared after shutting down 996 // The message loop must be cleared after shutting down
983 // the DiscardableSharedMemoryManager, which needs to send messages 997 // the DiscardableSharedMemoryManager, which needs to send messages
984 // to the browser process. 998 // to the browser process.
985 main_message_loop_.reset(); 999 main_message_loop_.reset();
986 1000
987 lazy_tls.Pointer()->Set(nullptr); 1001 lazy_tls.Pointer()->Set(nullptr);
988 } 1002 }
989 1003
990 void RenderThreadImpl::AddConnectionFilters(MojoShellConnection* connection) {
991 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA)
992 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
993 switches::kUseMusInRenderer)) {
994 CreateRenderWidgetWindowTreeClientFactory(connection);
995 }
996 #endif
997 }
998
999 bool RenderThreadImpl::Send(IPC::Message* msg) { 1004 bool RenderThreadImpl::Send(IPC::Message* msg) {
1000 // There are cases where we want to pump asynchronous messages while waiting 1005 // There are cases where we want to pump asynchronous messages while waiting
1001 // synchronously for the replies to the message to be sent here. However, this 1006 // synchronously for the replies to the message to be sent here. However, this
1002 // may create an opportunity for re-entrancy into WebKit and other subsystems, 1007 // may create an opportunity for re-entrancy into WebKit and other subsystems,
1003 // so we need to take care to disable callbacks, timers, and pending network 1008 // so we need to take care to disable callbacks, timers, and pending network
1004 // loads that could trigger such callbacks. 1009 // loads that could trigger such callbacks.
1005 bool pumping_events = false; 1010 bool pumping_events = false;
1006 if (msg->is_sync()) { 1011 if (msg->is_sync()) {
1007 if (msg->is_caller_pumping_messages()) { 1012 if (msg->is_caller_pumping_messages()) {
1008 pumping_events = true; 1013 pumping_events = true;
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2241 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) 2246 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical)
2242 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; 2247 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate;
2243 2248
2244 blink::mainThreadIsolate()->MemoryPressureNotification( 2249 blink::mainThreadIsolate()->MemoryPressureNotification(
2245 v8_memory_pressure_level); 2250 v8_memory_pressure_level);
2246 blink::MemoryPressureNotificationToWorkerThreadIsolates( 2251 blink::MemoryPressureNotificationToWorkerThreadIsolates(
2247 v8_memory_pressure_level); 2252 v8_memory_pressure_level);
2248 } 2253 }
2249 2254
2250 } // namespace content 2255 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698