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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/idle_user_detector.cc
diff --git a/content/renderer/idle_user_detector.cc b/content/renderer/idle_user_detector.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5c8e1cdcedf0f5c57d80114547506504811ee876
--- /dev/null
+++ b/content/renderer/idle_user_detector.cc
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/renderer/idle_user_detector.h"
+
+#include "base/logging.h"
+#include "content/common/view_messages.h"
+#include "content/public/renderer/content_renderer_client.h"
+#include "content/public/renderer/render_thread.h"
+
+using content::RenderThread;
+
+IdleUserDetector::IdleUserDetector(content::RenderView* render_view)
+ : content::RenderViewObserver(render_view){
+}
+
+IdleUserDetector::~IdleUserDetector() {
+}
+
+bool IdleUserDetector::OnMessageReceived(const IPC::Message& message) {
+ IPC_BEGIN_MESSAGE_MAP(IdleUserDetector, message)
+ IPC_MESSAGE_HANDLER(ViewMsg_HandleInputEvent, OnHandleInputEvent)
+ IPC_END_MESSAGE_MAP()
+ return false;
+}
+
+void IdleUserDetector::OnHandleInputEvent(const IPC::Message& message) {
+ if (content::GetContentClient()->renderer()->
+ RunIdleHandlerWhenWidgetsHidden()) {
ulan 2011/11/16 14:14:46 I use "RunIdleHandlerWhenWidgetsHidden" as an indi
Matt Perry 2011/11/16 19:23:52 I think you can just call PostponeIdleNotification
ulan 2011/11/16 20:13:22 I will do it in the second CL which will simplify
+ RenderThread::Get()->PostponeIdleNotification();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698