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

Side by Side Diff: base/android/application_status_listener.h

Issue 1447213002: Add stats to distinguish android renderer crashes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove comment and rebase. Created 5 years 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 | base/android/application_status_listener.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef BASE_ANDROID_APPLICATION_STATUS_LISTENER_H_ 5 #ifndef BASE_ANDROID_APPLICATION_STATUS_LISTENER_H_
6 #define BASE_ANDROID_APPLICATION_STATUS_LISTENER_H_ 6 #define BASE_ANDROID_APPLICATION_STATUS_LISTENER_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
11 #include "base/base_export.h" 11 #include "base/base_export.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "base/observer_list_threadsafe.h" 15 #include "base/observer_list_threadsafe.h"
16 16
17 namespace base { 17 namespace base {
18 namespace android { 18 namespace android {
19 19
20 // Define application state values like APPLICATION_STATE_VISIBLE in a 20 // Define application state values like APPLICATION_STATE_VISIBLE in a
21 // way that ensures they're always the same than their Java counterpart. 21 // way that ensures they're always the same than their Java counterpart.
22 // 22 //
23 // Note that these states represent the most visible Activity state. 23 // Note that these states represent the most visible Activity state.
24 // If there are activities with states paused and stopped, only 24 // If there are activities with states paused and stopped, only
25 // HAS_PAUSED_ACTIVITIES should be returned. 25 // HAS_PAUSED_ACTIVITIES should be returned.
26 // 26 //
27 // A Java counterpart will be generated for this enum. 27 // A Java counterpart will be generated for this enum.
28 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.base 28 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.base
29 enum ApplicationState { 29 enum ApplicationState {
30 APPLICATION_STATE_UNKNOWN = 0,
30 APPLICATION_STATE_HAS_RUNNING_ACTIVITIES = 1, 31 APPLICATION_STATE_HAS_RUNNING_ACTIVITIES = 1,
31 APPLICATION_STATE_HAS_PAUSED_ACTIVITIES = 2, 32 APPLICATION_STATE_HAS_PAUSED_ACTIVITIES = 2,
32 APPLICATION_STATE_HAS_STOPPED_ACTIVITIES = 3, 33 APPLICATION_STATE_HAS_STOPPED_ACTIVITIES = 3,
33 APPLICATION_STATE_HAS_DESTROYED_ACTIVITIES = 4 34 APPLICATION_STATE_HAS_DESTROYED_ACTIVITIES = 4
34 }; 35 };
35 36
36 // A native helper class to listen to state changes of the Android 37 // A native helper class to listen to state changes of the Android
37 // Application. This mirrors org.chromium.base.ApplicationStatus. 38 // Application. This mirrors org.chromium.base.ApplicationStatus.
38 // any thread. 39 // any thread.
39 // 40 //
(...skipping 26 matching lines...) Expand all
66 explicit ApplicationStatusListener( 67 explicit ApplicationStatusListener(
67 const ApplicationStateChangeCallback& callback); 68 const ApplicationStateChangeCallback& callback);
68 ~ApplicationStatusListener(); 69 ~ApplicationStatusListener();
69 70
70 // Internal use: must be public to be called from base_jni_registrar.cc 71 // Internal use: must be public to be called from base_jni_registrar.cc
71 static bool RegisterBindings(JNIEnv* env); 72 static bool RegisterBindings(JNIEnv* env);
72 73
73 // Internal use only: must be public to be called from JNI and unit tests. 74 // Internal use only: must be public to be called from JNI and unit tests.
74 static void NotifyApplicationStateChange(ApplicationState state); 75 static void NotifyApplicationStateChange(ApplicationState state);
75 76
77 // Expose jni call for ApplicationStatus.getStateForApplication.
78 static ApplicationState GetState();
79
76 private: 80 private:
77 void Notify(ApplicationState state); 81 void Notify(ApplicationState state);
78 82
79 ApplicationStateChangeCallback callback_; 83 ApplicationStateChangeCallback callback_;
80 84
81 DISALLOW_COPY_AND_ASSIGN(ApplicationStatusListener); 85 DISALLOW_COPY_AND_ASSIGN(ApplicationStatusListener);
82 }; 86 };
83 87
84 } // namespace android 88 } // namespace android
85 } // namespace base 89 } // namespace base
86 90
87 #endif // BASE_ANDROID_APPLICATION_STATUS_LISTENER_H_ 91 #endif // BASE_ANDROID_APPLICATION_STATUS_LISTENER_H_
OLDNEW
« no previous file with comments | « no previous file | base/android/application_status_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698