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

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

Issue 2304073003: Mojoify time zone update IPC from browser to renderer (Closed)
Patch Set: Rebase Created 4 years, 3 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') | device/time_zone_monitor/OWNERS » ('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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 const InProcessChildThreadParams& params, 577 const InProcessChildThreadParams& params,
578 std::unique_ptr<blink::scheduler::RendererScheduler> scheduler, 578 std::unique_ptr<blink::scheduler::RendererScheduler> scheduler,
579 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue) 579 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue)
580 : ChildThreadImpl(Options::Builder() 580 : ChildThreadImpl(Options::Builder()
581 .InBrowserProcess(params) 581 .InBrowserProcess(params)
582 .UseMojoChannel(true) 582 .UseMojoChannel(true)
583 .AutoStartMojoShellConnection(false) 583 .AutoStartMojoShellConnection(false)
584 .ConnectToBrowser(true) 584 .ConnectToBrowser(true)
585 .Build()), 585 .Build()),
586 renderer_scheduler_(std::move(scheduler)), 586 renderer_scheduler_(std::move(scheduler)),
587 time_zone_monitor_binding_(this),
587 categorized_worker_pool_(new CategorizedWorkerPool()) { 588 categorized_worker_pool_(new CategorizedWorkerPool()) {
588 Init(resource_task_queue); 589 Init(resource_task_queue);
589 } 590 }
590 591
591 // When we run plugins in process, we actually run them on the render thread, 592 // When we run plugins in process, we actually run them on the render thread,
592 // which means that we need to make the render thread pump UI events. 593 // which means that we need to make the render thread pump UI events.
593 RenderThreadImpl::RenderThreadImpl( 594 RenderThreadImpl::RenderThreadImpl(
594 std::unique_ptr<base::MessageLoop> main_message_loop, 595 std::unique_ptr<base::MessageLoop> main_message_loop,
595 std::unique_ptr<blink::scheduler::RendererScheduler> scheduler) 596 std::unique_ptr<blink::scheduler::RendererScheduler> scheduler)
596 : ChildThreadImpl(Options::Builder() 597 : ChildThreadImpl(Options::Builder()
597 .UseMojoChannel(true) 598 .UseMojoChannel(true)
598 .AutoStartMojoShellConnection(false) 599 .AutoStartMojoShellConnection(false)
599 .ConnectToBrowser(true) 600 .ConnectToBrowser(true)
600 .Build()), 601 .Build()),
601 renderer_scheduler_(std::move(scheduler)), 602 renderer_scheduler_(std::move(scheduler)),
603 time_zone_monitor_binding_(this),
602 main_message_loop_(std::move(main_message_loop)), 604 main_message_loop_(std::move(main_message_loop)),
603 categorized_worker_pool_(new CategorizedWorkerPool()) { 605 categorized_worker_pool_(new CategorizedWorkerPool()) {
604 scoped_refptr<base::SingleThreadTaskRunner> test_task_counter; 606 scoped_refptr<base::SingleThreadTaskRunner> test_task_counter;
605 Init(test_task_counter); 607 Init(test_task_counter);
606 } 608 }
607 609
608 void RenderThreadImpl::Init( 610 void RenderThreadImpl::Init(
609 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue) { 611 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue) {
610 TRACE_EVENT0("startup", "RenderThreadImpl::Init"); 612 TRACE_EVENT0("startup", "RenderThreadImpl::Init");
611 613
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 846
845 GetContentClient()->renderer()->ExposeInterfacesToBrowser( 847 GetContentClient()->renderer()->ExposeInterfacesToBrowser(
846 GetInterfaceRegistry()); 848 GetInterfaceRegistry());
847 849
848 GetInterfaceRegistry()->AddInterface(base::Bind(CreateFrameFactory)); 850 GetInterfaceRegistry()->AddInterface(base::Bind(CreateFrameFactory));
849 GetInterfaceRegistry()->AddInterface(base::Bind(CreateEmbeddedWorkerSetup)); 851 GetInterfaceRegistry()->AddInterface(base::Bind(CreateEmbeddedWorkerSetup));
850 852
851 GetRemoteInterfaces()->GetInterface( 853 GetRemoteInterfaces()->GetInterface(
852 mojo::GetProxy(&storage_partition_service_)); 854 mojo::GetProxy(&storage_partition_service_));
853 855
856 device::mojom::TimeZoneMonitorPtr time_zone_monitor;
857 GetRemoteInterfaces()->GetInterface(mojo::GetProxy(&time_zone_monitor));
858 time_zone_monitor->AddClient(
859 time_zone_monitor_binding_.CreateInterfacePtrAndBind());
860
854 is_renderer_suspended_ = false; 861 is_renderer_suspended_ = false;
855 } 862 }
856 863
857 RenderThreadImpl::~RenderThreadImpl() { 864 RenderThreadImpl::~RenderThreadImpl() {
858 } 865 }
859 866
860 void RenderThreadImpl::Shutdown() { 867 void RenderThreadImpl::Shutdown() {
861 FOR_EACH_OBSERVER( 868 FOR_EACH_OBSERVER(
862 RenderThreadObserver, observers_, OnRenderProcessShutdown()); 869 RenderThreadObserver, observers_, OnRenderProcessShutdown());
863 870
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 bool handled = true; 1684 bool handled = true;
1678 IPC_BEGIN_MESSAGE_MAP(RenderThreadImpl, msg) 1685 IPC_BEGIN_MESSAGE_MAP(RenderThreadImpl, msg)
1679 IPC_MESSAGE_HANDLER(FrameMsg_NewFrame, OnCreateNewFrame) 1686 IPC_MESSAGE_HANDLER(FrameMsg_NewFrame, OnCreateNewFrame)
1680 IPC_MESSAGE_HANDLER(FrameMsg_NewFrameProxy, OnCreateNewFrameProxy) 1687 IPC_MESSAGE_HANDLER(FrameMsg_NewFrameProxy, OnCreateNewFrameProxy)
1681 // TODO(port): removed from render_messages_internal.h; 1688 // TODO(port): removed from render_messages_internal.h;
1682 // is there a new non-windows message I should add here? 1689 // is there a new non-windows message I should add here?
1683 IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView) 1690 IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView)
1684 IPC_MESSAGE_HANDLER(ViewMsg_NetworkConnectionChanged, 1691 IPC_MESSAGE_HANDLER(ViewMsg_NetworkConnectionChanged,
1685 OnNetworkConnectionChanged) 1692 OnNetworkConnectionChanged)
1686 IPC_MESSAGE_HANDLER(WorkerProcessMsg_CreateWorker, OnCreateNewSharedWorker) 1693 IPC_MESSAGE_HANDLER(WorkerProcessMsg_CreateWorker, OnCreateNewSharedWorker)
1687 IPC_MESSAGE_HANDLER(ViewMsg_TimezoneChange, OnUpdateTimezone)
1688 #if defined(OS_ANDROID) 1694 #if defined(OS_ANDROID)
1689 IPC_MESSAGE_HANDLER(ViewMsg_SetWebKitSharedTimersSuspended, 1695 IPC_MESSAGE_HANDLER(ViewMsg_SetWebKitSharedTimersSuspended,
1690 OnSetWebKitSharedTimersSuspended) 1696 OnSetWebKitSharedTimersSuspended)
1691 #endif 1697 #endif
1692 #if defined(OS_MACOSX) 1698 #if defined(OS_MACOSX)
1693 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScrollbarTheme, OnUpdateScrollbarTheme) 1699 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScrollbarTheme, OnUpdateScrollbarTheme)
1694 IPC_MESSAGE_HANDLER(ViewMsg_SystemColorsChanged, OnSystemColorsChanged) 1700 IPC_MESSAGE_HANDLER(ViewMsg_SystemColorsChanged, OnSystemColorsChanged)
1695 #endif 1701 #endif
1696 #if defined(ENABLE_PLUGINS) 1702 #if defined(ENABLE_PLUGINS)
1697 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, OnPurgePluginListCache) 1703 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, OnPurgePluginListCache)
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2004 net::NetworkChangeNotifier::ConnectionType type, 2010 net::NetworkChangeNotifier::ConnectionType type,
2005 double max_bandwidth_mbps) { 2011 double max_bandwidth_mbps) {
2006 bool online = type != net::NetworkChangeNotifier::CONNECTION_NONE; 2012 bool online = type != net::NetworkChangeNotifier::CONNECTION_NONE;
2007 WebNetworkStateNotifier::setOnLine(online); 2013 WebNetworkStateNotifier::setOnLine(online);
2008 FOR_EACH_OBSERVER( 2014 FOR_EACH_OBSERVER(
2009 RenderThreadObserver, observers_, NetworkStateChanged(online)); 2015 RenderThreadObserver, observers_, NetworkStateChanged(online));
2010 WebNetworkStateNotifier::setWebConnection( 2016 WebNetworkStateNotifier::setWebConnection(
2011 NetConnectionTypeToWebConnectionType(type), max_bandwidth_mbps); 2017 NetConnectionTypeToWebConnectionType(type), max_bandwidth_mbps);
2012 } 2018 }
2013 2019
2014 void RenderThreadImpl::OnUpdateTimezone(const std::string& zone_id) { 2020 void RenderThreadImpl::OnTimeZoneChange(const std::string& zone_id) {
2015 if (!blink_platform_impl_) 2021 if (!blink_platform_impl_)
2016 return; 2022 return;
2017 if (!zone_id.empty()) { 2023 if (!zone_id.empty()) {
2018 icu::TimeZone *new_zone = icu::TimeZone::createTimeZone( 2024 icu::TimeZone *new_zone = icu::TimeZone::createTimeZone(
2019 icu::UnicodeString::fromUTF8(zone_id)); 2025 icu::UnicodeString::fromUTF8(zone_id));
2020 icu::TimeZone::adoptDefault(new_zone); 2026 icu::TimeZone::adoptDefault(new_zone);
2021 VLOG(1) << "ICU default timezone is set to " << zone_id; 2027 VLOG(1) << "ICU default timezone is set to " << zone_id;
2022 } 2028 }
2023 NotifyTimezoneChange(); 2029 NotifyTimezoneChange();
2024 } 2030 }
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
2265 if (blink::mainThreadIsolate()) { 2271 if (blink::mainThreadIsolate()) {
2266 blink::mainThreadIsolate()->MemoryPressureNotification( 2272 blink::mainThreadIsolate()->MemoryPressureNotification(
2267 v8::MemoryPressureLevel::kCritical); 2273 v8::MemoryPressureLevel::kCritical);
2268 blink::MemoryPressureNotificationToWorkerThreadIsolates( 2274 blink::MemoryPressureNotificationToWorkerThreadIsolates(
2269 v8::MemoryPressureLevel::kCritical); 2275 v8::MemoryPressureLevel::kCritical);
2270 } 2276 }
2271 } 2277 }
2272 2278
2273 2279
2274 } // namespace content 2280 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | device/time_zone_monitor/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698