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

Side by Side Diff: extensions/renderer/safe_builtins.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/safe_builtins.h" 5 #include "extensions/renderer/safe_builtins.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "extensions/renderer/script_context.h" 10 #include "extensions/renderer/script_context.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 v8::Local<v8::Private> MakeKey(const char* name, v8::Isolate* isolate) { 132 v8::Local<v8::Private> MakeKey(const char* name, v8::Isolate* isolate) {
133 return v8::Private::ForApi( 133 return v8::Private::ForApi(
134 isolate, ToV8StringUnsafe( 134 isolate, ToV8StringUnsafe(
135 isolate, base::StringPrintf("%s::%s", kClassName, name))); 135 isolate, base::StringPrintf("%s::%s", kClassName, name)));
136 } 136 }
137 137
138 void SaveImpl(const char* name, 138 void SaveImpl(const char* name,
139 v8::Local<v8::Value> value, 139 v8::Local<v8::Value> value,
140 v8::Local<v8::Context> context) { 140 v8::Local<v8::Context> context) {
141 CHECK(!value.IsEmpty() && value->IsObject()) << name; 141 CHECK(!value.IsEmpty() && value->IsObject());
142 context->Global() 142 context->Global()
143 ->SetPrivate(context, MakeKey(name, context->GetIsolate()), value) 143 ->SetPrivate(context, MakeKey(name, context->GetIsolate()), value)
144 .FromJust(); 144 .FromJust();
145 } 145 }
146 146
147 v8::Local<v8::Object> Load(const char* name, v8::Local<v8::Context> context) { 147 v8::Local<v8::Object> Load(const char* name, v8::Local<v8::Context> context) {
148 v8::Local<v8::Value> value = 148 v8::Local<v8::Value> value =
149 context->Global() 149 context->Global()
150 ->GetPrivate(context, MakeKey(name, context->GetIsolate())) 150 ->GetPrivate(context, MakeKey(name, context->GetIsolate()))
151 .ToLocalChecked(); 151 .ToLocalChecked();
152 CHECK(value->IsObject()) << name; 152 CHECK(value->IsObject());
153 return v8::Local<v8::Object>::Cast(value); 153 return v8::Local<v8::Object>::Cast(value);
154 } 154 }
155 155
156 class ExtensionImpl : public v8::Extension { 156 class ExtensionImpl : public v8::Extension {
157 public: 157 public:
158 ExtensionImpl() : v8::Extension(kClassName, kScript) {} 158 ExtensionImpl() : v8::Extension(kClassName, kScript) {}
159 159
160 private: 160 private:
161 v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( 161 v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(
162 v8::Isolate* isolate, 162 v8::Isolate* isolate,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 v8::Local<v8::Object> SafeBuiltins::GetString() const { 252 v8::Local<v8::Object> SafeBuiltins::GetString() const {
253 return Load("String", context_->v8_context()); 253 return Load("String", context_->v8_context());
254 } 254 }
255 255
256 v8::Local<v8::Object> SafeBuiltins::GetError() const { 256 v8::Local<v8::Object> SafeBuiltins::GetError() const {
257 return Load("Error", context_->v8_context()); 257 return Load("Error", context_->v8_context());
258 } 258 }
259 259
260 } // namespace extensions 260 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698