| OLD | NEW |
| 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 #include "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "extensions/renderer/logging_native_handler.h" | 7 #include "extensions/renderer/logging_native_handler.h" |
| 8 #include "extensions/renderer/script_context.h" | 8 #include "extensions/renderer/script_context.h" |
| 9 | 9 |
| 10 namespace extensions { | 10 namespace extensions { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 base::Bind(&LoggingNativeHandler::Warning, base::Unretained(this))); | 27 base::Bind(&LoggingNativeHandler::Warning, base::Unretained(this))); |
| 28 } | 28 } |
| 29 | 29 |
| 30 LoggingNativeHandler::~LoggingNativeHandler() {} | 30 LoggingNativeHandler::~LoggingNativeHandler() {} |
| 31 | 31 |
| 32 void LoggingNativeHandler::Check( | 32 void LoggingNativeHandler::Check( |
| 33 const v8::FunctionCallbackInfo<v8::Value>& args) { | 33 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 34 bool check_value; | 34 bool check_value; |
| 35 std::string error_message; | 35 std::string error_message; |
| 36 ParseArgs(args, &check_value, &error_message); | 36 ParseArgs(args, &check_value, &error_message); |
| 37 CHECK(check_value) << error_message; | 37 CHECK(check_value); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void LoggingNativeHandler::Dcheck( | 40 void LoggingNativeHandler::Dcheck( |
| 41 const v8::FunctionCallbackInfo<v8::Value>& args) { | 41 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 42 bool check_value; | 42 bool check_value; |
| 43 std::string error_message; | 43 std::string error_message; |
| 44 ParseArgs(args, &check_value, &error_message); | 44 ParseArgs(args, &check_value, &error_message); |
| 45 DCHECK(check_value) << error_message; | 45 DCHECK(check_value) << error_message; |
| 46 } | 46 } |
| 47 | 47 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 70 *check_value = args[0]->BooleanValue(); | 70 *check_value = args[0]->BooleanValue(); |
| 71 if (args.Length() == 2) { | 71 if (args.Length() == 2) { |
| 72 *error_message = "Error: " + std::string(*v8::String::Utf8Value(args[1])); | 72 *error_message = "Error: " + std::string(*v8::String::Utf8Value(args[1])); |
| 73 } | 73 } |
| 74 | 74 |
| 75 if (!check_value) | 75 if (!check_value) |
| 76 *error_message += "\n" + context()->GetStackTraceAsString(); | 76 *error_message += "\n" + context()->GetStackTraceAsString(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace extensions | 79 } // namespace extensions |
| OLD | NEW |