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

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

Issue 1133143003: [Android] Suspend shared timers for hidden renderers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@input_remove_suspend
Patch Set: Use ContentRendererClient Created 5 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') | content/test/fake_renderer_scheduler.h » ('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 <vector> 10 #include <vector>
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 FOR_EACH_OBSERVER(RenderProcessObserver, observers_, WebKitInitialized()); 1149 FOR_EACH_OBSERVER(RenderProcessObserver, observers_, WebKitInitialized());
1150 1150
1151 devtools_agent_message_filter_ = new DevToolsAgentFilter(); 1151 devtools_agent_message_filter_ = new DevToolsAgentFilter();
1152 AddFilter(devtools_agent_message_filter_.get()); 1152 AddFilter(devtools_agent_message_filter_.get());
1153 1153
1154 v8_sampling_profiler_.reset(new V8SamplingProfiler()); 1154 v8_sampling_profiler_.reset(new V8SamplingProfiler());
1155 1155
1156 if (GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) 1156 if (GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden())
1157 ScheduleIdleHandler(kLongIdleHandlerDelayMs); 1157 ScheduleIdleHandler(kLongIdleHandlerDelayMs);
1158 1158
1159 renderer_scheduler_->SetTimerQueueSuspensionWhenBackgroundedEnabled(
1160 GetContentClient()
1161 ->renderer()
1162 ->AllowTimerSuspensionWhenProcessBackgrounded());
1163
1159 cc_blink::SetSharedBitmapAllocationFunction(AllocateSharedBitmapFunction); 1164 cc_blink::SetSharedBitmapAllocationFunction(AllocateSharedBitmapFunction);
1160 1165
1161 SkGraphics::SetResourceCacheSingleAllocationByteLimit( 1166 SkGraphics::SetResourceCacheSingleAllocationByteLimit(
1162 kImageCacheSingleAllocationByteLimit); 1167 kImageCacheSingleAllocationByteLimit);
1163 1168
1164 // Hook up blink's codecs so skia can call them 1169 // Hook up blink's codecs so skia can call them
1165 SkGraphics::SetImageGeneratorFromEncodedFactory( 1170 SkGraphics::SetImageGeneratorFromEncodedFactory(
1166 blink::WebImageGenerator::create); 1171 blink::WebImageGenerator::create);
1167 1172
1168 if (command_line.HasSwitch(switches::kMemoryMetrics)) { 1173 if (command_line.HasSwitch(switches::kMemoryMetrics)) {
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScrollbarTheme, OnUpdateScrollbarTheme) 1617 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScrollbarTheme, OnUpdateScrollbarTheme)
1613 #endif 1618 #endif
1614 #if defined(ENABLE_PLUGINS) 1619 #if defined(ENABLE_PLUGINS)
1615 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, OnPurgePluginListCache) 1620 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, OnPurgePluginListCache)
1616 #endif 1621 #endif
1617 IPC_MESSAGE_UNHANDLED(handled = false) 1622 IPC_MESSAGE_UNHANDLED(handled = false)
1618 IPC_END_MESSAGE_MAP() 1623 IPC_END_MESSAGE_MAP()
1619 return handled; 1624 return handled;
1620 } 1625 }
1621 1626
1627 void RenderThreadImpl::OnProcessBackgrounded(bool backgrounded) {
1628 ChildThreadImpl::OnProcessBackgrounded(backgrounded);
1629
1630 if (backgrounded)
1631 renderer_scheduler_->OnRendererBackgrounded();
1632 else
1633 renderer_scheduler_->OnRendererForegrounded();
1634 }
1635
1622 void RenderThreadImpl::OnCreateNewFrame(FrameMsg_NewFrame_Params params) { 1636 void RenderThreadImpl::OnCreateNewFrame(FrameMsg_NewFrame_Params params) {
1623 CompositorDependencies* compositor_deps = this; 1637 CompositorDependencies* compositor_deps = this;
1624 RenderFrameImpl::CreateFrame( 1638 RenderFrameImpl::CreateFrame(
1625 params.routing_id, params.proxy_routing_id, params.opener_routing_id, 1639 params.routing_id, params.proxy_routing_id, params.opener_routing_id,
1626 params.parent_routing_id, params.previous_sibling_routing_id, 1640 params.parent_routing_id, params.previous_sibling_routing_id,
1627 params.replication_state, compositor_deps, params.widget_params); 1641 params.replication_state, compositor_deps, params.widget_params);
1628 } 1642 }
1629 1643
1630 void RenderThreadImpl::OnCreateNewFrameProxy( 1644 void RenderThreadImpl::OnCreateNewFrameProxy(
1631 int routing_id, 1645 int routing_id,
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 } 1967 }
1954 1968
1955 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { 1969 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() {
1956 size_t erased = 1970 size_t erased =
1957 RenderThreadImpl::current()->pending_render_frame_connects_.erase( 1971 RenderThreadImpl::current()->pending_render_frame_connects_.erase(
1958 routing_id_); 1972 routing_id_);
1959 DCHECK_EQ(1u, erased); 1973 DCHECK_EQ(1u, erased);
1960 } 1974 }
1961 1975
1962 } // namespace content 1976 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/test/fake_renderer_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698