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

Side by Side Diff: ppapi/native_client/src/trusted/plugin/plugin_error.h

Issue 311273007: Pepper: Clean up trusted plugin error reporting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
OLDNEW
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
11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_ERROR_H 11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_ERROR_H
12 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_ERROR_H 12 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_ERROR_H
13 13
14 #include <string> 14 #include <string>
15 15
16 #include "native_client/src/include/nacl_macros.h" 16 #include "native_client/src/include/nacl_macros.h"
17 #include "ppapi/c/private/ppb_nacl_private.h" 17 #include "ppapi/c/private/ppb_nacl_private.h"
18 18
19 namespace plugin { 19 namespace plugin {
20 20
21 class ErrorInfo { 21 class ErrorInfo {
22 public: 22 public:
23 ErrorInfo() { 23 ErrorInfo() {
24 Reset();
25 }
26
27 void Reset() {
28 SetReport(PP_NACL_ERROR_UNKNOWN, std::string()); 24 SetReport(PP_NACL_ERROR_UNKNOWN, std::string());
29 } 25 }
30 26
31 void SetReport(PP_NaClError error_code, const std::string& message) { 27 void SetReport(PP_NaClError error_code, const std::string& message) {
32 error_code_ = error_code; 28 error_code_ = error_code;
33 message_ = message; 29 message_ = message;
34 console_message_ = message;
35 } 30 }
36 31
37 PP_NaClError error_code() const { 32 PP_NaClError error_code() const {
38 return error_code_; 33 return error_code_;
39 } 34 }
40 35
41 void PrependMessage(const std::string& prefix) {
42 message_ = prefix + message_;
43 console_message_ = prefix + console_message_;
44 }
45
46 const std::string& message() const { 36 const std::string& message() const {
47 return message_; 37 return message_;
48 } 38 }
49 39
50 const std::string& console_message() const {
51 return console_message_;
52 }
53
54 private: 40 private:
55 PP_NaClError error_code_; 41 PP_NaClError error_code_;
56 std::string message_; 42 std::string message_;
57 std::string console_message_;
58 NACL_DISALLOW_COPY_AND_ASSIGN(ErrorInfo); 43 NACL_DISALLOW_COPY_AND_ASSIGN(ErrorInfo);
59 }; 44 };
60 45
61 } // namespace plugin 46 } // namespace plugin
62 47
63 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_ERROR_H 48 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_ERROR_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698