OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 // important on resume to only resume the renderer processes that were actually | 33 // important on resume to only resume the renderer processes that were actually |
34 // suspended as opposed to all the current renderer processes because the | 34 // suspended as opposed to all the current renderer processes because the |
35 // suspend calls are refcounted within BlinkPlatformImpl and it expects a | 35 // suspend calls are refcounted within BlinkPlatformImpl and it expects a |
36 // perfectly matched number of resume calls. | 36 // perfectly matched number of resume calls. |
37 // Note that this class is only accessed from the UI thread. | 37 // Note that this class is only accessed from the UI thread. |
38 class SuspendedProcessWatcher : public content::RenderProcessHostObserver { | 38 class SuspendedProcessWatcher : public content::RenderProcessHostObserver { |
39 public: | 39 public: |
40 | 40 |
41 // If the process crashes, stop watching the corresponding RenderProcessHost | 41 // If the process crashes, stop watching the corresponding RenderProcessHost |
42 // and ensure it doesn't get over-resumed. | 42 // and ensure it doesn't get over-resumed. |
43 virtual void RenderProcessExited(content::RenderProcessHost* host, | 43 void RenderProcessExited(content::RenderProcessHost* host, |
44 base::TerminationStatus status, | 44 base::TerminationStatus status, |
45 int exit_code) override { | 45 int exit_code) override { |
46 StopWatching(host); | 46 StopWatching(host); |
47 } | 47 } |
48 | 48 |
49 virtual void RenderProcessHostDestroyed( | 49 void RenderProcessHostDestroyed(content::RenderProcessHost* host) override { |
50 content::RenderProcessHost* host) override { | |
51 StopWatching(host); | 50 StopWatching(host); |
52 } | 51 } |
53 | 52 |
54 // Suspends timers in all current render processes. | 53 // Suspends timers in all current render processes. |
55 void SuspendWebKitSharedTimers() { | 54 void SuspendWebKitSharedTimers() { |
56 DCHECK(suspended_processes_.empty()); | 55 DCHECK(suspended_processes_.empty()); |
57 | 56 |
58 for (content::RenderProcessHost::iterator i( | 57 for (content::RenderProcessHost::iterator i( |
59 content::RenderProcessHost::AllHostsIterator()); | 58 content::RenderProcessHost::AllHostsIterator()); |
60 !i.IsAtEnd(); i.Advance()) { | 59 !i.IsAtEnd(); i.Advance()) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 114 } |
116 } | 115 } |
117 | 116 |
118 namespace content { | 117 namespace content { |
119 | 118 |
120 bool RegisterWebViewStatics(JNIEnv* env) { | 119 bool RegisterWebViewStatics(JNIEnv* env) { |
121 return RegisterNativesImpl(env); | 120 return RegisterNativesImpl(env); |
122 } | 121 } |
123 | 122 |
124 } // namespace content | 123 } // namespace content |
OLD | NEW |