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

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

Issue 10412045: Add java exception information to BuildInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Jay's comment Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/android/build_info.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 (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 #ifndef BASE_ANDROID_BUILD_INFO_H_ 5 #ifndef BASE_ANDROID_BUILD_INFO_H_
6 #define BASE_ANDROID_BUILD_INFO_H_ 6 #define BASE_ANDROID_BUILD_INFO_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 13
14 namespace base { 14 namespace base {
15 namespace android { 15 namespace android {
16 16
17 // BuildInfo is a singleton class that stores android build and device 17 // BuildInfo is a singleton class that stores android build and device
18 // information. It will be called from Android specific java code and gets used 18 // information. It will be called from Android specific java code and gets used
19 // primarily in crash reporting. 19 // primarily in crash reporting.
20
21 // It is also used to store the last java exception seen during JNI.
22 // TODO(nileshagrawal): Find a better place to store this info.
20 class BuildInfo { 23 class BuildInfo {
21 public: 24 public:
22 25
23 ~BuildInfo() {} 26 ~BuildInfo() {}
24 27
25 // Static factory method for getting the singleton BuildInfo instance. 28 // Static factory method for getting the singleton BuildInfo instance.
26 // Note that ownership is not conferred on the caller and the BuildInfo in 29 // Note that ownership is not conferred on the caller and the BuildInfo in
27 // question isn't actually freed until shutdown. This is ok because there 30 // question isn't actually freed until shutdown. This is ok because there
28 // should only be one instance of BuildInfo ever created. 31 // should only be one instance of BuildInfo ever created.
29 static BuildInfo* GetInstance(); 32 static BuildInfo* GetInstance();
(...skipping 23 matching lines...) Expand all
53 } 56 }
54 57
55 const char* package_version_code() const { 58 const char* package_version_code() const {
56 return package_version_code_; 59 return package_version_code_;
57 } 60 }
58 61
59 const char* package_version_name() const { 62 const char* package_version_name() const {
60 return package_version_name_; 63 return package_version_name_;
61 } 64 }
62 65
66 const char* java_exception_info() const {
67 return java_exception_info_;
68 }
69
70 void set_java_exception_info(const std::string& info);
71
63 private: 72 private:
64 BuildInfo(); 73 BuildInfo();
65 74
66 friend struct DefaultSingletonTraits<BuildInfo>; 75 friend struct DefaultSingletonTraits<BuildInfo>;
67 76
68 // Const char* is used instead of std::strings because these values must be 77 // Const char* is used instead of std::strings because these values must be
69 // available even if the process is in a crash state. Sadly 78 // available even if the process is in a crash state. Sadly
70 // std::string.c_str() doesn't guarantee that memory won't be allocated when 79 // std::string.c_str() doesn't guarantee that memory won't be allocated when
71 // it is called. 80 // it is called.
72 char* device_; 81 char* device_;
73 char* model_; 82 char* model_;
74 char* brand_; 83 char* brand_;
75 char* android_build_id_; 84 char* android_build_id_;
76 char* android_build_fp_; 85 char* android_build_fp_;
77 char* package_version_code_; 86 char* package_version_code_;
78 char* package_version_name_; 87 char* package_version_name_;
88 char* java_exception_info_;
79 89
80 DISALLOW_COPY_AND_ASSIGN(BuildInfo); 90 DISALLOW_COPY_AND_ASSIGN(BuildInfo);
81 }; 91 };
82 92
83 bool RegisterBuildInfo(JNIEnv* env); 93 bool RegisterBuildInfo(JNIEnv* env);
84 94
85 } // namespace android 95 } // namespace android
86 } // namespace base 96 } // namespace base
87 97
88 #endif // BASE_ANDROID_BUILD_INFO_H_ 98 #endif // BASE_ANDROID_BUILD_INFO_H_
OLDNEW
« no previous file with comments | « no previous file | base/android/build_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698