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

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

Issue 8513008: Schedule idle handler in the foreground tab based on CPU usage and user activity. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Move PostponeIdleNotification to RenderThreadImpl Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/idle_user_detector.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/renderer/idle_user_detector.h"
6
7 #include "base/logging.h"
8 #include "content/common/view_messages.h"
9 #include "content/public/renderer/content_renderer_client.h"
10 #include "content/renderer/render_thread_impl.h"
11
12 using content::RenderThread;
jam 2011/11/23 18:42:42 nit: not needed
13
14 IdleUserDetector::IdleUserDetector(content::RenderView* render_view)
15 : content::RenderViewObserver(render_view){
16 }
17
18 IdleUserDetector::~IdleUserDetector() {
19 }
20
21 bool IdleUserDetector::OnMessageReceived(const IPC::Message& message) {
22 IPC_BEGIN_MESSAGE_MAP(IdleUserDetector, message)
23 IPC_MESSAGE_HANDLER(ViewMsg_HandleInputEvent, OnHandleInputEvent)
24 IPC_END_MESSAGE_MAP()
25 return false;
26 }
27
28 void IdleUserDetector::OnHandleInputEvent(const IPC::Message& message) {
29 if (content::GetContentClient()->renderer()->
30 RunIdleHandlerWhenWidgetsHidden()) {
31 RenderThreadImpl* render_thread = RenderThreadImpl::current();
32 if (render_thread != NULL) {
33 render_thread->PostponeIdleNotification();
34 }
35 }
36 }
OLDNEW
« no previous file with comments | « content/renderer/idle_user_detector.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698