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

Side by Side Diff: extensions/renderer/console.cc

Issue 2561963002: base: Remove the string logging from CHECK(). (Closed)
Patch Set: checkstring: rebase Created 4 years 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
OLDNEW
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 "extensions/renderer/console.h" 5 #include "extensions/renderer/console.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/debug/alias.h" 8 #include "base/debug/alias.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 13 matching lines...) Expand all
24 using namespace v8_helpers; 24 using namespace v8_helpers;
25 25
26 namespace { 26 namespace {
27 27
28 // Writes |message| to stack to show up in minidump, then crashes. 28 // Writes |message| to stack to show up in minidump, then crashes.
29 void CheckWithMinidump(const std::string& message) { 29 void CheckWithMinidump(const std::string& message) {
30 char minidump[1024]; 30 char minidump[1024];
31 base::debug::Alias(&minidump); 31 base::debug::Alias(&minidump);
32 base::snprintf( 32 base::snprintf(
33 minidump, arraysize(minidump), "e::console: %s", message.c_str()); 33 minidump, arraysize(minidump), "e::console: %s", message.c_str());
34 CHECK(false) << message; 34 CHECK(false);
35 } 35 }
36 36
37 typedef void (*LogMethod)(content::RenderFrame* render_frame, 37 typedef void (*LogMethod)(content::RenderFrame* render_frame,
38 const std::string& message); 38 const std::string& message);
39 39
40 void BoundLogMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { 40 void BoundLogMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
41 std::string message; 41 std::string message;
42 for (int i = 0; i < info.Length(); ++i) { 42 for (int i = 0; i < info.Length(); ++i) {
43 if (i > 0) 43 if (i > 0)
44 message += " "; 44 message += " ";
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 v8::Local<v8::Object> console_object = v8::Object::New(isolate); 126 v8::Local<v8::Object> console_object = v8::Object::New(isolate);
127 BindLogMethod(isolate, console_object, "debug", &Debug); 127 BindLogMethod(isolate, console_object, "debug", &Debug);
128 BindLogMethod(isolate, console_object, "log", &Log); 128 BindLogMethod(isolate, console_object, "log", &Log);
129 BindLogMethod(isolate, console_object, "warn", &Warn); 129 BindLogMethod(isolate, console_object, "warn", &Warn);
130 BindLogMethod(isolate, console_object, "error", &Error); 130 BindLogMethod(isolate, console_object, "error", &Error);
131 return handle_scope.Escape(console_object); 131 return handle_scope.Escape(console_object);
132 } 132 }
133 133
134 } // namespace console 134 } // namespace console
135 } // namespace extensions 135 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698