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

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

Issue 282683002: Pepper: Simplify LaunchSelLdr error reporting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 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
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
(...skipping 16 matching lines...) Expand all
27 void Reset() { 27 void Reset() {
28 SetReport(PP_NACL_ERROR_UNKNOWN, std::string()); 28 SetReport(PP_NACL_ERROR_UNKNOWN, std::string());
29 } 29 }
30 30
31 void SetReport(PP_NaClError error_code, const std::string& message) { 31 void SetReport(PP_NaClError error_code, const std::string& message) {
32 error_code_ = error_code; 32 error_code_ = error_code;
33 message_ = message; 33 message_ = message;
34 console_message_ = message; 34 console_message_ = message;
35 } 35 }
36 36
37 // console_message is a part of the error that is logged to
38 // the JavaScript console but is not reported to JavaScript via
39 // the lastError property. This is used to report internal errors which
40 // may easily change in new versions of the browser and we don't want apps
41 // to come to depend on the details of these errors.
42 void SetReportWithConsoleOnlyError(PP_NaClError error_code,
43 const std::string& message,
44 const std::string& console_message) {
45 error_code_ = error_code;
46 message_ = message;
47 console_message_ = message + "; " + console_message;
48 }
49
50 PP_NaClError error_code() const { 37 PP_NaClError error_code() const {
51 return error_code_; 38 return error_code_;
52 } 39 }
53 40
54 void PrependMessage(const std::string& prefix) { 41 void PrependMessage(const std::string& prefix) {
55 message_ = prefix + message_; 42 message_ = prefix + message_;
56 console_message_ = prefix + console_message_; 43 console_message_ = prefix + console_message_;
57 } 44 }
58 45
59 const std::string& message() const { 46 const std::string& message() const {
60 return message_; 47 return message_;
61 } 48 }
62 49
63 const std::string& console_message() const { 50 const std::string& console_message() const {
64 return console_message_; 51 return console_message_;
65 } 52 }
66 53
67 private: 54 private:
68 PP_NaClError error_code_; 55 PP_NaClError error_code_;
69 std::string message_; 56 std::string message_;
70 std::string console_message_; 57 std::string console_message_;
71 NACL_DISALLOW_COPY_AND_ASSIGN(ErrorInfo); 58 NACL_DISALLOW_COPY_AND_ASSIGN(ErrorInfo);
72 }; 59 };
73 60
74 } // namespace plugin 61 } // namespace plugin
75 62
76 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_ERROR_H 63 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PLUGIN_ERROR_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698