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

Side by Side Diff: Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp

Issue 1021713003: [bindings] Let NativeValueTraits<T>::nativeValue be variadic function and merge various convers… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed the compiler error behind ASSERT flag Created 5 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 349
350 v8SetReturnValue(info, result); 350 v8SetReturnValue(info, result);
351 } 351 }
352 352
353 void V8InjectedScriptHost::inspectMethodCustom(const v8::FunctionCallbackInfo<v8 ::Value>& info) 353 void V8InjectedScriptHost::inspectMethodCustom(const v8::FunctionCallbackInfo<v8 ::Value>& info)
354 { 354 {
355 if (info.Length() < 2) 355 if (info.Length() < 2)
356 return; 356 return;
357 357
358 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); 358 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder());
359 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); 359 v8::Isolate* isolate = info.GetIsolate();
360 ScriptState* scriptState = ScriptState::current(isolate);
360 ScriptValue object(scriptState, info[0]); 361 ScriptValue object(scriptState, info[0]);
361 ScriptValue hints(scriptState, info[1]); 362 ScriptValue hints(scriptState, info[1]);
362 host->inspectImpl(object.toJSONValue(scriptState), hints.toJSONValue(scriptS tate)); 363 ScriptState::Scope scope(scriptState);
364 NonThrowableExceptionState exceptionState;
365 RefPtr<JSONValue> jsonObject = ScriptValue::to<JSONValuePtr>(isolate, object , exceptionState);
366 RefPtr<JSONValue> jsonHints = ScriptValue::to<JSONValuePtr>(isolate, hints, exceptionState);
367 host->inspectImpl(jsonObject, jsonHints);
363 } 368 }
364 369
365 void V8InjectedScriptHost::evalMethodCustom(const v8::FunctionCallbackInfo<v8::V alue>& info) 370 void V8InjectedScriptHost::evalMethodCustom(const v8::FunctionCallbackInfo<v8::V alue>& info)
366 { 371 {
367 v8::Isolate* isolate = info.GetIsolate(); 372 v8::Isolate* isolate = info.GetIsolate();
368 if (info.Length() < 1) { 373 if (info.Length() < 1) {
369 isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(iso late, "One argument expected."))); 374 isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(iso late, "One argument expected.")));
370 return; 375 return;
371 } 376 }
372 377
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec tedScriptHost(info.Holder()); 590 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec tedScriptHost(info.Holder());
586 if (!injectedScriptNative) 591 if (!injectedScriptNative)
587 return; 592 return;
588 int id = info[0]->ToInt32(info.GetIsolate())->Value(); 593 int id = info[0]->ToInt32(info.GetIsolate())->Value();
589 String groupName = injectedScriptNative->groupName(id); 594 String groupName = injectedScriptNative->groupName(id);
590 if (!groupName.isEmpty()) 595 if (!groupName.isEmpty())
591 info.GetReturnValue().Set(v8String(info.GetIsolate(), groupName)); 596 info.GetReturnValue().Set(v8String(info.GetIsolate(), groupName));
592 } 597 }
593 598
594 } // namespace blink 599 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698