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

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

Issue 181823006: Add DCHECK for shared_timer_suspended_ which shouldn't be negative (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Take review comment into consideration Created 6 years, 9 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
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 25 matching lines...) Expand all
36 // Note that this vector is only accessed from the UI thread. 36 // Note that this vector is only accessed from the UI thread.
37 base::LazyInstance<std::vector<int /* process id */> > g_suspended_processes = 37 base::LazyInstance<std::vector<int /* process id */> > g_suspended_processes =
38 LAZY_INSTANCE_INITIALIZER; 38 LAZY_INSTANCE_INITIALIZER;
39 39
40 // Suspends timers in all current render processes. 40 // Suspends timers in all current render processes.
41 void SuspendWebKitSharedTimers(std::vector<int>* suspended_processes) { 41 void SuspendWebKitSharedTimers(std::vector<int>* suspended_processes) {
42 for (content::RenderProcessHost::iterator i( 42 for (content::RenderProcessHost::iterator i(
43 content::RenderProcessHost::AllHostsIterator()); 43 content::RenderProcessHost::AllHostsIterator());
44 !i.IsAtEnd(); i.Advance()) { 44 !i.IsAtEnd(); i.Advance()) {
45 content::RenderProcessHost* host = i.GetCurrentValue(); 45 content::RenderProcessHost* host = i.GetCurrentValue();
46 suspended_processes->push_back(host->GetID()); 46 if (host && host->HasConnection()) {
47 host->Send(new ViewMsg_SetWebKitSharedTimersSuspended(true)); 47 suspended_processes->push_back(host->GetID());
48 host->Send(new ViewMsg_SetWebKitSharedTimersSuspended(true));
49 }
48 } 50 }
49 } 51 }
50 52
51 // Resumes timers in processes that were previously stopped. 53 // Resumes timers in processes that were previously stopped.
52 void ResumeWebkitSharedTimers(const std::vector<int>& suspended_processes) { 54 void ResumeWebkitSharedTimers(const std::vector<int>& suspended_processes) {
53 for (std::vector<int>::const_iterator it = suspended_processes.begin(); 55 for (std::vector<int>::const_iterator it = suspended_processes.begin();
54 it != suspended_processes.end(); ++it) { 56 it != suspended_processes.end(); ++it) {
55 content::RenderProcessHost* host = content::RenderProcessHost::FromID(*it); 57 content::RenderProcessHost* host = content::RenderProcessHost::FromID(*it);
56 if (host) // The process might have been killed since it was suspended. 58 if (host && host->HasConnection()) // The process might have been killed si nce it was suspended.
57 host->Send(new ViewMsg_SetWebKitSharedTimersSuspended(false)); 59 host->Send(new ViewMsg_SetWebKitSharedTimersSuspended(false));
58 } 60 }
59 } 61 }
60 62
61 } // namespace 63 } // namespace
62 64
63 // Returns the first substring consisting of the address of a physical location. 65 // Returns the first substring consisting of the address of a physical location.
64 static jstring FindAddress(JNIEnv* env, jclass clazz, jstring addr) { 66 static jstring FindAddress(JNIEnv* env, jclass clazz, jstring addr) {
65 base::string16 content_16 = ConvertJavaStringToUTF16(env, addr); 67 base::string16 content_16 = ConvertJavaStringToUTF16(env, addr);
66 base::string16 result_16; 68 base::string16 result_16;
(...skipping 15 matching lines...) Expand all
82 } 84 }
83 } 85 }
84 86
85 namespace content { 87 namespace content {
86 88
87 bool RegisterWebViewStatics(JNIEnv* env) { 89 bool RegisterWebViewStatics(JNIEnv* env) {
88 return RegisterNativesImpl(env) >= 0; 90 return RegisterNativesImpl(env) >= 0;
89 } 91 }
90 92
91 } // namespace content 93 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | webkit/child/webkitplatformsupport_impl.cc » ('j') | webkit/child/webkitplatformsupport_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698