OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /* | 7 /* |
8 * Error codes and data structures used to report errors when loading a nexe. | 8 * Error codes and data structures used to report errors when loading a nexe. |
9 */ | 9 */ |
10 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 ERROR_MAX | 102 ERROR_MAX |
103 }; | 103 }; |
104 | 104 |
105 class ErrorInfo { | 105 class ErrorInfo { |
106 public: | 106 public: |
107 ErrorInfo() { | 107 ErrorInfo() { |
108 Reset(); | 108 Reset(); |
109 } | 109 } |
110 | 110 |
111 void Reset() { | 111 void Reset() { |
112 SetReport(ERROR_UNKNOWN, ""); | 112 SetReport(ERROR_UNKNOWN, std::string()); |
113 } | 113 } |
114 | 114 |
115 void SetReport(PluginErrorCode error_code, const std::string& message) { | 115 void SetReport(PluginErrorCode error_code, const std::string& message) { |
116 error_code_ = error_code; | 116 error_code_ = error_code; |
117 message_ = message; | 117 message_ = message; |
118 } | 118 } |
119 | 119 |
120 PluginErrorCode error_code() const { | 120 PluginErrorCode error_code() const { |
121 return error_code_; | 121 return error_code_; |
122 } | 122 } |
123 | 123 |
124 void PrependMessage(const std::string& prefix) { | 124 void PrependMessage(const std::string& prefix) { |
125 message_ = prefix + message_; | 125 message_ = prefix + message_; |
126 } | 126 } |
127 | 127 |
128 const std::string& message() const { | 128 const std::string& message() const { |
129 return message_; | 129 return message_; |
130 } | 130 } |
131 | 131 |
132 private: | 132 private: |
133 PluginErrorCode error_code_; | 133 PluginErrorCode error_code_; |
134 std::string message_; | 134 std::string message_; |
135 NACL_DISALLOW_COPY_AND_ASSIGN(ErrorInfo); | 135 NACL_DISALLOW_COPY_AND_ASSIGN(ErrorInfo); |
136 }; | 136 }; |
137 | 137 |
138 } // namespace plugin | 138 } // namespace plugin |
139 | 139 |
140 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_ERROR_H | 140 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_ERROR_H |
OLD | NEW |