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

Side by Side Diff: content/browser/android/content_view_statics.cc

Issue 341583003: [Android] Allow Disconnected RVH to suspend the shared timer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 | « no previous file | 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 <jni.h> 5 #include <jni.h>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 54
55 // Suspends timers in all current render processes. 55 // Suspends timers in all current render processes.
56 void SuspendWebKitSharedTimers() { 56 void SuspendWebKitSharedTimers() {
57 DCHECK(suspended_processes_.empty()); 57 DCHECK(suspended_processes_.empty());
58 58
59 for (content::RenderProcessHost::iterator i( 59 for (content::RenderProcessHost::iterator i(
60 content::RenderProcessHost::AllHostsIterator()); 60 content::RenderProcessHost::AllHostsIterator());
61 !i.IsAtEnd(); i.Advance()) { 61 !i.IsAtEnd(); i.Advance()) {
62 content::RenderProcessHost* host = i.GetCurrentValue(); 62 content::RenderProcessHost* host = i.GetCurrentValue();
63 if (host->HasConnection()) { 63 host->AddObserver(this);
Yaron 2014/06/18 00:41:17 This was done per Grace's comment: https://coderev
64 host->AddObserver(this); 64 host->Send(new ViewMsg_SetWebKitSharedTimersSuspended(true));
65 host->Send(new ViewMsg_SetWebKitSharedTimersSuspended(true)); 65 suspended_processes_.push_back(host->GetID());
66 suspended_processes_.push_back(host->GetID());
67 }
68 } 66 }
69 } 67 }
70 68
71 // Resumes timers in processes that were previously stopped. 69 // Resumes timers in processes that were previously stopped.
72 void ResumeWebkitSharedTimers() { 70 void ResumeWebkitSharedTimers() {
73 for (std::vector<int>::const_iterator it = suspended_processes_.begin(); 71 for (std::vector<int>::const_iterator it = suspended_processes_.begin();
74 it != suspended_processes_.end(); ++it) { 72 it != suspended_processes_.end(); ++it) {
75 content::RenderProcessHost* host = 73 content::RenderProcessHost* host =
76 content::RenderProcessHost::FromID(*it); 74 content::RenderProcessHost::FromID(*it);
77 DCHECK(host); 75 DCHECK(host);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 116 }
119 } 117 }
120 118
121 namespace content { 119 namespace content {
122 120
123 bool RegisterWebViewStatics(JNIEnv* env) { 121 bool RegisterWebViewStatics(JNIEnv* env) {
124 return RegisterNativesImpl(env); 122 return RegisterNativesImpl(env);
125 } 123 }
126 124
127 } // namespace content 125 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698