Commit a261b771 authored by dcarney's avatar dcarney Committed by Commit bot

remove some calls to to-be-deprecated v8::Value::To* functions

TBR=eroman@chromium.org, kalman@chromium.org, jamesr@chromium.org
BUG=

Review URL: https://codereview.chromium.org/744723002

Cr-Commit-Position: refs/heads/master@{#305034}
parent 6730701c
...@@ -86,7 +86,7 @@ class BenchmarkingWrapper : public v8::Extension { ...@@ -86,7 +86,7 @@ class BenchmarkingWrapper : public v8::Extension {
size_t capacity) { size_t capacity) {
name[0] = 'c'; name[0] = 'c';
name[1] = ':'; name[1] = ':';
args[0]->ToString()->WriteUtf8(&name[2], capacity - 3); args[0]->ToString(args.GetIsolate())->WriteUtf8(&name[2], capacity - 3);
} }
static void GetCounter(const v8::FunctionCallbackInfo<v8::Value>& args) { static void GetCounter(const v8::FunctionCallbackInfo<v8::Value>& args) {
......
...@@ -96,12 +96,9 @@ void EnterprisePlatformKeysNatives::NormalizeAlgorithm( ...@@ -96,12 +96,9 @@ void EnterprisePlatformKeysNatives::NormalizeAlgorithm(
blink::WebString error_details; blink::WebString error_details;
int exception_code = 0; int exception_code = 0;
blink::WebCryptoAlgorithm algorithm = blink::WebCryptoAlgorithm algorithm = blink::normalizeCryptoAlgorithm(
blink::normalizeCryptoAlgorithm(call_info[0]->ToObject(), v8::Local<v8::Object>::Cast(call_info[0]), operation, &exception_code,
operation, &error_details, call_info.GetIsolate());
&exception_code,
&error_details,
call_info.GetIsolate());
scoped_ptr<base::DictionaryValue> algorithm_dict; scoped_ptr<base::DictionaryValue> algorithm_dict;
if (!algorithm.isNull()) if (!algorithm.isNull())
......
...@@ -18,7 +18,7 @@ v8::Handle<v8::Object> GetOrCreateChromeObject( ...@@ -18,7 +18,7 @@ v8::Handle<v8::Object> GetOrCreateChromeObject(
chrome = v8::Object::New(isolate); chrome = v8::Object::New(isolate);
global->Set(gin::StringToSymbol(isolate, "chrome"), chrome); global->Set(gin::StringToSymbol(isolate, "chrome"), chrome);
} else { } else {
chrome = chrome_value->ToObject(); chrome = v8::Handle<v8::Object>::Cast(chrome_value);
} }
return chrome; return chrome;
} }
......
...@@ -92,7 +92,8 @@ MessageChannel* MessageChannel::Create(PepperPluginInstanceImpl* instance, ...@@ -92,7 +92,8 @@ MessageChannel* MessageChannel::Create(PepperPluginInstanceImpl* instance,
v8::Context::Scope context_scope(instance->GetMainWorldContext()); v8::Context::Scope context_scope(instance->GetMainWorldContext());
gin::Handle<MessageChannel> handle = gin::Handle<MessageChannel> handle =
gin::CreateHandle(instance->GetIsolate(), message_channel); gin::CreateHandle(instance->GetIsolate(), message_channel);
result->Reset(instance->GetIsolate(), handle.ToV8()->ToObject()); result->Reset(instance->GetIsolate(),
handle.ToV8()->ToObject(instance->GetIsolate()));
return message_channel; return message_channel;
} }
......
...@@ -199,34 +199,34 @@ bool GetOrCreateVar(v8::Handle<v8::Value> val, ...@@ -199,34 +199,34 @@ bool GetOrCreateVar(v8::Handle<v8::Value> val,
CHECK(!val.IsEmpty()); CHECK(!val.IsEmpty());
*did_create = false; *did_create = false;
v8::Isolate* isolate = context->GetIsolate();
// Even though every v8 string primitive encountered will be a unique object, // Even though every v8 string primitive encountered will be a unique object,
// we still add them to |visited_handles| so that the corresponding string // we still add them to |visited_handles| so that the corresponding string
// PP_Var created will be properly refcounted. // PP_Var created will be properly refcounted.
if (val->IsObject() || val->IsString()) { if (val->IsObject() || val->IsString()) {
if (parent_handles->count(HashedHandle(val->ToObject())) != 0) if (parent_handles->count(HashedHandle(val->ToObject(isolate))) != 0)
return false; return false;
HandleVarMap::const_iterator it = HandleVarMap::const_iterator it =
visited_handles->find(HashedHandle(val->ToObject())); visited_handles->find(HashedHandle(val->ToObject(isolate)));
if (it != visited_handles->end()) { if (it != visited_handles->end()) {
*result = it->second.get(); *result = it->second.get();
return true; return true;
} }
} }
v8::Isolate* isolate = context->GetIsolate();
if (val->IsUndefined()) { if (val->IsUndefined()) {
*result = PP_MakeUndefined(); *result = PP_MakeUndefined();
} else if (val->IsNull()) { } else if (val->IsNull()) {
*result = PP_MakeNull(); *result = PP_MakeNull();
} else if (val->IsBoolean() || val->IsBooleanObject()) { } else if (val->IsBoolean() || val->IsBooleanObject()) {
*result = PP_MakeBool(PP_FromBool(val->ToBoolean()->Value())); *result = PP_MakeBool(PP_FromBool(val->ToBoolean(isolate)->Value()));
} else if (val->IsInt32()) { } else if (val->IsInt32()) {
*result = PP_MakeInt32(val->ToInt32()->Value()); *result = PP_MakeInt32(val->ToInt32(isolate)->Value());
} else if (val->IsNumber() || val->IsNumberObject()) { } else if (val->IsNumber() || val->IsNumberObject()) {
*result = PP_MakeDouble(val->ToNumber()->Value()); *result = PP_MakeDouble(val->ToNumber(isolate)->Value());
} else if (val->IsString() || val->IsStringObject()) { } else if (val->IsString() || val->IsStringObject()) {
v8::String::Utf8Value utf8(val->ToString()); v8::String::Utf8Value utf8(val->ToString(isolate));
*result = StringVar::StringToPPVar(std::string(*utf8, utf8.length())); *result = StringVar::StringToPPVar(std::string(*utf8, utf8.length()));
} else if (val->IsObject()) { } else if (val->IsObject()) {
// For any other v8 objects, the conversion happens as follows: // For any other v8 objects, the conversion happens as follows:
......
...@@ -18,17 +18,17 @@ v8::Handle<v8::Object> BindingGeneratingNativeHandler::NewInstance() { ...@@ -18,17 +18,17 @@ v8::Handle<v8::Object> BindingGeneratingNativeHandler::NewInstance() {
v8::Isolate* isolate = module_system_->GetIsolate(); v8::Isolate* isolate = module_system_->GetIsolate();
v8::EscapableHandleScope scope(isolate); v8::EscapableHandleScope scope(isolate);
v8::Handle<v8::Object> binding_module = v8::Handle<v8::Object> binding_module =
module_system_->Require("binding")->ToObject(); module_system_->Require("binding")->ToObject(isolate);
v8::Handle<v8::Object> binding = v8::Handle<v8::Object> binding =
binding_module->Get(v8::String::NewFromUtf8(isolate, "Binding")) binding_module->Get(v8::String::NewFromUtf8(isolate, "Binding"))
->ToObject(); ->ToObject(isolate);
v8::Handle<v8::Function> create_binding = v8::Handle<v8::Function> create_binding =
binding->Get(v8::String::NewFromUtf8(isolate, "create")) binding->Get(v8::String::NewFromUtf8(isolate, "create"))
.As<v8::Function>(); .As<v8::Function>();
v8::Handle<v8::Value> argv[] = { v8::Handle<v8::Value> argv[] = {
v8::String::NewFromUtf8(isolate, api_name_.c_str())}; v8::String::NewFromUtf8(isolate, api_name_.c_str())};
v8::Handle<v8::Object> binding_instance = v8::Handle<v8::Object> binding_instance =
create_binding->Call(binding, arraysize(argv), argv)->ToObject(); create_binding->Call(binding, arraysize(argv), argv)->ToObject(isolate);
v8::Handle<v8::Function> generate = v8::Handle<v8::Function> generate =
binding_instance->Get(v8::String::NewFromUtf8(isolate, "generate")) binding_instance->Get(v8::String::NewFromUtf8(isolate, "generate"))
.As<v8::Function>(); .As<v8::Function>();
......
...@@ -28,8 +28,8 @@ void TakeBrowserProcessBlob(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -28,8 +28,8 @@ void TakeBrowserProcessBlob(const v8::FunctionCallbackInfo<v8::Value>& args) {
DCHECK(args[0]->IsString()); DCHECK(args[0]->IsString());
DCHECK(args[1]->IsString()); DCHECK(args[1]->IsString());
DCHECK(args[2]->IsInt32()); DCHECK(args[2]->IsInt32());
std::string uuid(*v8::String::Utf8Value(args[0]->ToString())); std::string uuid(*v8::String::Utf8Value(args[0]));
std::string type(*v8::String::Utf8Value(args[1]->ToString())); std::string type(*v8::String::Utf8Value(args[1]));
blink::WebBlob blob = blink::WebBlob blob =
blink::WebBlob::createFromUUID(blink::WebString::fromUTF8(uuid), blink::WebBlob::createFromUUID(blink::WebString::fromUTF8(uuid),
blink::WebString::fromUTF8(type), blink::WebString::fromUTF8(type),
......
...@@ -30,7 +30,7 @@ void DocumentCustomBindings::RegisterElement( ...@@ -30,7 +30,7 @@ void DocumentCustomBindings::RegisterElement(
} }
std::string element_name(*v8::String::Utf8Value(args[0])); std::string element_name(*v8::String::Utf8Value(args[0]));
v8::Local<v8::Object> options = args[1]->ToObject(); v8::Local<v8::Object> options = v8::Local<v8::Object>::Cast(args[1]);
blink::WebExceptionCode ec = 0; blink::WebExceptionCode ec = 0;
blink::WebDocument document = context()->web_frame()->document(); blink::WebDocument document = context()->web_frame()->document();
......
...@@ -142,7 +142,7 @@ void EventBindings::AttachEvent( ...@@ -142,7 +142,7 @@ void EventBindings::AttachEvent(
CHECK_EQ(1, args.Length()); CHECK_EQ(1, args.Length());
CHECK(args[0]->IsString()); CHECK(args[0]->IsString());
std::string event_name = *v8::String::Utf8Value(args[0]->ToString()); std::string event_name = *v8::String::Utf8Value(args[0]);
if (!dispatcher_->CheckContextAccessToExtensionAPI(event_name, context())) if (!dispatcher_->CheckContextAccessToExtensionAPI(event_name, context()))
return; return;
...@@ -216,8 +216,8 @@ void EventBindings::AttachFilteredEvent( ...@@ -216,8 +216,8 @@ void EventBindings::AttachFilteredEvent(
content::V8ValueConverter::create()); content::V8ValueConverter::create());
base::DictionaryValue* filter_dict = NULL; base::DictionaryValue* filter_dict = NULL;
base::Value* filter_value = base::Value* filter_value = converter->FromV8Value(
converter->FromV8Value(args[1]->ToObject(), context()->v8_context()); v8::Local<v8::Object>::Cast(args[1]), context()->v8_context());
if (!filter_value) { if (!filter_value) {
args.GetReturnValue().Set(static_cast<int32_t>(-1)); args.GetReturnValue().Set(static_cast<int32_t>(-1));
return; return;
...@@ -276,8 +276,9 @@ void EventBindings::MatchAgainstEventFilter( ...@@ -276,8 +276,9 @@ void EventBindings::MatchAgainstEventFilter(
v8::Isolate* isolate = args.GetIsolate(); v8::Isolate* isolate = args.GetIsolate();
typedef std::set<EventFilter::MatcherID> MatcherIDs; typedef std::set<EventFilter::MatcherID> MatcherIDs;
EventFilter& event_filter = g_event_filter.Get(); EventFilter& event_filter = g_event_filter.Get();
std::string event_name = *v8::String::Utf8Value(args[0]->ToString()); std::string event_name = *v8::String::Utf8Value(args[0]);
EventFilteringInfo info = ParseFromObject(args[1]->ToObject(), isolate); EventFilteringInfo info =
ParseFromObject(args[1]->ToObject(isolate), isolate);
// Only match events routed to this context's RenderView or ones that don't // Only match events routed to this context's RenderView or ones that don't
// have a routingId in their filter. // have a routingId in their filter.
MatcherIDs matched_event_filters = event_filter.MatchEvent( MatcherIDs matched_event_filters = event_filter.MatchEvent(
......
...@@ -72,7 +72,7 @@ void FileSystemNatives::GetFileEntry( ...@@ -72,7 +72,7 @@ void FileSystemNatives::GetFileEntry(
const v8::FunctionCallbackInfo<v8::Value>& args) { const v8::FunctionCallbackInfo<v8::Value>& args) {
DCHECK(args.Length() == 5); DCHECK(args.Length() == 5);
DCHECK(args[0]->IsString()); DCHECK(args[0]->IsString());
std::string type_string = *v8::String::Utf8Value(args[0]->ToString()); std::string type_string = *v8::String::Utf8Value(args[0]);
blink::WebFileSystemType type; blink::WebFileSystemType type;
bool is_valid_type = storage::GetFileSystemPublicType(type_string, &type); bool is_valid_type = storage::GetFileSystemPublicType(type_string, &type);
DCHECK(is_valid_type); DCHECK(is_valid_type);
...@@ -83,9 +83,9 @@ void FileSystemNatives::GetFileEntry( ...@@ -83,9 +83,9 @@ void FileSystemNatives::GetFileEntry(
DCHECK(args[1]->IsString()); DCHECK(args[1]->IsString());
DCHECK(args[2]->IsString()); DCHECK(args[2]->IsString());
DCHECK(args[3]->IsString()); DCHECK(args[3]->IsString());
std::string file_system_name(*v8::String::Utf8Value(args[1]->ToString())); std::string file_system_name(*v8::String::Utf8Value(args[1]));
GURL file_system_root_url(*v8::String::Utf8Value(args[2]->ToString())); GURL file_system_root_url(*v8::String::Utf8Value(args[2]));
std::string file_path_string(*v8::String::Utf8Value(args[3]->ToString())); std::string file_path_string(*v8::String::Utf8Value(args[3]));
base::FilePath file_path = base::FilePath::FromUTF8Unsafe(file_path_string); base::FilePath file_path = base::FilePath::FromUTF8Unsafe(file_path_string);
DCHECK(storage::VirtualPath::IsAbsolute(file_path.value())); DCHECK(storage::VirtualPath::IsAbsolute(file_path.value()));
...@@ -113,7 +113,7 @@ void FileSystemNatives::CrackIsolatedFileSystemName( ...@@ -113,7 +113,7 @@ void FileSystemNatives::CrackIsolatedFileSystemName(
const v8::FunctionCallbackInfo<v8::Value>& args) { const v8::FunctionCallbackInfo<v8::Value>& args) {
DCHECK_EQ(args.Length(), 1); DCHECK_EQ(args.Length(), 1);
DCHECK(args[0]->IsString()); DCHECK(args[0]->IsString());
std::string filesystem_name = *v8::String::Utf8Value(args[0]->ToString()); std::string filesystem_name = *v8::String::Utf8Value(args[0]);
std::string filesystem_id; std::string filesystem_id;
if (!storage::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id)) if (!storage::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id))
return; return;
......
...@@ -34,7 +34,7 @@ void I18NCustomBindings::GetL10nMessage( ...@@ -34,7 +34,7 @@ void I18NCustomBindings::GetL10nMessage(
if (args[2]->IsNull() || !args[2]->IsString()) { if (args[2]->IsNull() || !args[2]->IsString()) {
return; return;
} else { } else {
extension_id = *v8::String::Utf8Value(args[2]->ToString()); extension_id = *v8::String::Utf8Value(args[2]);
if (extension_id.empty()) if (extension_id.empty())
return; return;
} }
...@@ -73,13 +73,12 @@ void I18NCustomBindings::GetL10nMessage( ...@@ -73,13 +73,12 @@ void I18NCustomBindings::GetL10nMessage(
if (count > 9) if (count > 9)
return; return;
for (uint32_t i = 0; i < count; ++i) { for (uint32_t i = 0; i < count; ++i) {
substitutions.push_back( substitutions.push_back(*v8::String::Utf8Value(placeholders->Get(
*v8::String::Utf8Value( v8::Integer::New(isolate, i))));
placeholders->Get(v8::Integer::New(isolate, i))->ToString()));
} }
} else if (args[1]->IsString()) { } else if (args[1]->IsString()) {
// chrome.i18n.getMessage("message_name", "one param"); // chrome.i18n.getMessage("message_name", "one param");
substitutions.push_back(*v8::String::Utf8Value(args[1]->ToString())); substitutions.push_back(*v8::String::Utf8Value(args[1]));
} }
args.GetReturnValue().Set(v8::String::NewFromUtf8( args.GetReturnValue().Set(v8::String::NewFromUtf8(
......
...@@ -102,7 +102,7 @@ std::string ModuleSystem::ExceptionHandler::CreateExceptionString( ...@@ -102,7 +102,7 @@ std::string ModuleSystem::ExceptionHandler::CreateExceptionString(
std::string resource_name = "<unknown resource>"; std::string resource_name = "<unknown resource>";
if (!message->GetScriptOrigin().ResourceName().IsEmpty()) { if (!message->GetScriptOrigin().ResourceName().IsEmpty()) {
v8::String::Utf8Value resource_name_v8( v8::String::Utf8Value resource_name_v8(
message->GetScriptOrigin().ResourceName()->ToString()); message->GetScriptOrigin().ResourceName());
resource_name.assign(*resource_name_v8, resource_name_v8.length()); resource_name.assign(*resource_name_v8, resource_name_v8.length());
} }
...@@ -201,7 +201,7 @@ v8::Handle<v8::Value> ModuleSystem::Require(const std::string& module_name) { ...@@ -201,7 +201,7 @@ v8::Handle<v8::Value> ModuleSystem::Require(const std::string& module_name) {
void ModuleSystem::RequireForJs( void ModuleSystem::RequireForJs(
const v8::FunctionCallbackInfo<v8::Value>& args) { const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Handle<v8::String> module_name = args[0]->ToString(); v8::Handle<v8::String> module_name = args[0]->ToString(args.GetIsolate());
args.GetReturnValue().Set(RequireForJsInner(module_name)); args.GetReturnValue().Set(RequireForJsInner(module_name));
} }
...@@ -354,10 +354,8 @@ void ModuleSystem::LazyFieldGetterInner( ...@@ -354,10 +354,8 @@ void ModuleSystem::LazyFieldGetterInner(
ModuleSystem* module_system = static_cast<ModuleSystem*>( ModuleSystem* module_system = static_cast<ModuleSystem*>(
v8::Handle<v8::External>::Cast(module_system_value)->Value()); v8::Handle<v8::External>::Cast(module_system_value)->Value());
std::string name = std::string name = *v8::String::Utf8Value(parameters->Get(
*v8::String::Utf8Value( v8::String::NewFromUtf8(info.GetIsolate(), kModuleName)));
parameters->Get(v8::String::NewFromUtf8(info.GetIsolate(),
kModuleName))->ToString());
// Switch to our v8 context because we need functions created while running // Switch to our v8 context because we need functions created while running
// the require()d module to belong to our context, not the current one. // the require()d module to belong to our context, not the current one.
...@@ -378,7 +376,7 @@ void ModuleSystem::LazyFieldGetterInner( ...@@ -378,7 +376,7 @@ void ModuleSystem::LazyFieldGetterInner(
v8::Handle<v8::Object> module = v8::Handle<v8::Object>::Cast(module_value); v8::Handle<v8::Object> module = v8::Handle<v8::Object>::Cast(module_value);
v8::Handle<v8::String> field = v8::Handle<v8::String> field =
parameters->Get(v8::String::NewFromUtf8(info.GetIsolate(), kModuleField)) parameters->Get(v8::String::NewFromUtf8(info.GetIsolate(), kModuleField))
->ToString(); ->ToString(info.GetIsolate());
if (!module->Has(field)) { if (!module->Has(field)) {
std::string field_str = *v8::String::Utf8Value(field); std::string field_str = *v8::String::Utf8Value(field);
...@@ -491,7 +489,7 @@ v8::Handle<v8::Value> ModuleSystem::GetSource(const std::string& module_name) { ...@@ -491,7 +489,7 @@ v8::Handle<v8::Value> ModuleSystem::GetSource(const std::string& module_name) {
void ModuleSystem::RequireNative( void ModuleSystem::RequireNative(
const v8::FunctionCallbackInfo<v8::Value>& args) { const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK_EQ(1, args.Length()); CHECK_EQ(1, args.Length());
std::string native_name = *v8::String::Utf8Value(args[0]->ToString()); std::string native_name = *v8::String::Utf8Value(args[0]);
args.GetReturnValue().Set(RequireNativeFromString(native_name)); args.GetReturnValue().Set(RequireNativeFromString(native_name));
} }
...@@ -526,7 +524,7 @@ v8::Handle<v8::Value> ModuleSystem::RequireNativeFromString( ...@@ -526,7 +524,7 @@ v8::Handle<v8::Value> ModuleSystem::RequireNativeFromString(
void ModuleSystem::RequireAsync( void ModuleSystem::RequireAsync(
const v8::FunctionCallbackInfo<v8::Value>& args) { const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK_EQ(1, args.Length()); CHECK_EQ(1, args.Length());
std::string module_name = *v8::String::Utf8Value(args[0]->ToString()); std::string module_name = *v8::String::Utf8Value(args[0]);
v8::Handle<v8::Promise::Resolver> resolver( v8::Handle<v8::Promise::Resolver> resolver(
v8::Promise::Resolver::New(GetIsolate())); v8::Promise::Resolver::New(GetIsolate()));
args.GetReturnValue().Set(resolver->GetPromise()); args.GetReturnValue().Set(resolver->GetPromise());
......
...@@ -24,7 +24,7 @@ void PrintNativeHandler::Print( ...@@ -24,7 +24,7 @@ void PrintNativeHandler::Print(
std::vector<std::string> components; std::vector<std::string> components;
for (int i = 0; i < args.Length(); ++i) for (int i = 0; i < args.Length(); ++i)
components.push_back(*v8::String::Utf8Value(args[i]->ToString())); components.push_back(*v8::String::Utf8Value(args[i]));
LOG(ERROR) << JoinString(components, ','); LOG(ERROR) << JoinString(components, ',');
} }
......
...@@ -64,9 +64,9 @@ void RuntimeCustomBindings::OpenChannelToExtension( ...@@ -64,9 +64,9 @@ void RuntimeCustomBindings::OpenChannelToExtension(
if (extension && !extension->is_hosted_app()) if (extension && !extension->is_hosted_app())
info.source_id = extension->id(); info.source_id = extension->id();
info.target_id = *v8::String::Utf8Value(args[0]->ToString()); info.target_id = *v8::String::Utf8Value(args[0]);
info.source_url = context()->GetURL(); info.source_url = context()->GetURL();
std::string channel_name = *v8::String::Utf8Value(args[1]->ToString()); std::string channel_name = *v8::String::Utf8Value(args[1]);
bool include_tls_channel_id = bool include_tls_channel_id =
args.Length() > 2 ? args[2]->BooleanValue() : false; args.Length() > 2 ? args[2]->BooleanValue() : false;
int port_id = -1; int port_id = -1;
...@@ -100,8 +100,8 @@ void RuntimeCustomBindings::OpenChannelToNativeApp( ...@@ -100,8 +100,8 @@ void RuntimeCustomBindings::OpenChannelToNativeApp(
// The Javascript code should validate/fill the arguments. // The Javascript code should validate/fill the arguments.
CHECK(args.Length() >= 2 && args[0]->IsString() && args[1]->IsString()); CHECK(args.Length() >= 2 && args[0]->IsString() && args[1]->IsString());
std::string extension_id = *v8::String::Utf8Value(args[0]->ToString()); std::string extension_id = *v8::String::Utf8Value(args[0]);
std::string native_app_name = *v8::String::Utf8Value(args[1]->ToString()); std::string native_app_name = *v8::String::Utf8Value(args[1]);
int port_id = -1; int port_id = -1;
renderview->Send(new ExtensionHostMsg_OpenChannelToNativeApp( renderview->Send(new ExtensionHostMsg_OpenChannelToNativeApp(
...@@ -130,7 +130,7 @@ void RuntimeCustomBindings::GetExtensionViews( ...@@ -130,7 +130,7 @@ void RuntimeCustomBindings::GetExtensionViews(
// all views for the current extension. // all views for the current extension.
int browser_window_id = args[0]->Int32Value(); int browser_window_id = args[0]->Int32Value();
std::string view_type_string = *v8::String::Utf8Value(args[1]->ToString()); std::string view_type_string = *v8::String::Utf8Value(args[1]);
StringToUpperASCII(&view_type_string); StringToUpperASCII(&view_type_string);
// |view_type| == VIEW_TYPE_INVALID means getting any type of // |view_type| == VIEW_TYPE_INVALID means getting any type of
// views. // views.
......
...@@ -138,7 +138,7 @@ v8::Local<v8::Object> Load(const char* name, v8::Handle<v8::Context> context) { ...@@ -138,7 +138,7 @@ v8::Local<v8::Object> Load(const char* name, v8::Handle<v8::Context> context) {
v8::Local<v8::Value> value = v8::Local<v8::Value> value =
context->Global()->GetHiddenValue(MakeKey(name, context->GetIsolate())); context->Global()->GetHiddenValue(MakeKey(name, context->GetIsolate()));
CHECK(!value.IsEmpty() && value->IsObject()) << name; CHECK(!value.IsEmpty() && value->IsObject()) << name;
return value->ToObject(); return v8::Local<v8::Object>::Cast(value);
} }
class ExtensionImpl : public v8::Extension { class ExtensionImpl : public v8::Extension {
...@@ -166,9 +166,10 @@ class ExtensionImpl : public v8::Extension { ...@@ -166,9 +166,10 @@ class ExtensionImpl : public v8::Extension {
v8::Local<v8::Function> function = info[0].As<v8::Function>(); v8::Local<v8::Function> function = info[0].As<v8::Function>();
v8::Local<v8::Object> recv; v8::Local<v8::Object> recv;
if (info[1]->IsObject()) { if (info[1]->IsObject()) {
recv = info[1]->ToObject(); recv = v8::Local<v8::Object>::Cast(info[1]);
} else if (info[1]->IsString()) { } else if (info[1]->IsString()) {
recv = v8::StringObject::New(info[1]->ToString())->ToObject(); recv = v8::StringObject::New(v8::Local<v8::String>::Cast(info[1]))
->ToObject(info.GetIsolate());
} else { } else {
info.GetIsolate()->ThrowException( info.GetIsolate()->ThrowException(
v8::Exception::TypeError(v8::String::NewFromUtf8( v8::Exception::TypeError(v8::String::NewFromUtf8(
...@@ -176,9 +177,9 @@ class ExtensionImpl : public v8::Extension { ...@@ -176,9 +177,9 @@ class ExtensionImpl : public v8::Extension {
"The first argument is the receiver and must be an object"))); "The first argument is the receiver and must be an object")));
return; return;
} }
v8::Local<v8::Object> args = info[2]->ToObject(); v8::Local<v8::Object> args = v8::Local<v8::Object>::Cast(info[2]);
int first_arg_index = static_cast<int>(info[3]->ToInt32()->Value()); int first_arg_index = info[3]->ToInt32(info.GetIsolate())->Value();
int args_length = static_cast<int>(info[4]->ToInt32()->Value()); int args_length = info[4]->ToInt32(info.GetIsolate())->Value();
int argc = args_length - first_arg_index; int argc = args_length - first_arg_index;
scoped_ptr<v8::Local<v8::Value> []> argv(new v8::Local<v8::Value>[argc]); scoped_ptr<v8::Local<v8::Value> []> argv(new v8::Local<v8::Value>[argc]);
......
...@@ -39,7 +39,8 @@ bool SetIconNatives::ConvertImageDataToBitmapValue( ...@@ -39,7 +39,8 @@ bool SetIconNatives::ConvertImageDataToBitmapValue(
v8::Local<v8::Value>* image_data_bitmap) { v8::Local<v8::Value>* image_data_bitmap) {
v8::Isolate* isolate = context()->v8_context()->GetIsolate(); v8::Isolate* isolate = context()->v8_context()->GetIsolate();
v8::Local<v8::Object> data = v8::Local<v8::Object> data =
image_data->Get(v8::String::NewFromUtf8(isolate, "data"))->ToObject(); image_data->Get(v8::String::NewFromUtf8(isolate, "data"))
->ToObject(isolate);
int width = int width =
image_data->Get(v8::String::NewFromUtf8(isolate, "width"))->Int32Value(); image_data->Get(v8::String::NewFromUtf8(isolate, "width"))->Int32Value();
int height = int height =
...@@ -107,7 +108,8 @@ bool SetIconNatives::ConvertImageDataSetToBitmapValueSet( ...@@ -107,7 +108,8 @@ bool SetIconNatives::ConvertImageDataSetToBitmapValueSet(
v8::Local<v8::Object>* bitmap_set_value) { v8::Local<v8::Object>* bitmap_set_value) {
v8::Isolate* isolate = context()->v8_context()->GetIsolate(); v8::Isolate* isolate = context()->v8_context()->GetIsolate();
v8::Local<v8::Object> image_data_set = v8::Local<v8::Object> image_data_set =
details->Get(v8::String::NewFromUtf8(isolate, "imageData"))->ToObject(); details->Get(v8::String::NewFromUtf8(isolate, "imageData"))
->ToObject(isolate);
DCHECK(bitmap_set_value); DCHECK(bitmap_set_value);
for (size_t i = 0; i < arraysize(kImageSizeKeys); i++) { for (size_t i = 0; i < arraysize(kImageSizeKeys); i++) {
...@@ -116,7 +118,7 @@ bool SetIconNatives::ConvertImageDataSetToBitmapValueSet( ...@@ -116,7 +118,7 @@ bool SetIconNatives::ConvertImageDataSetToBitmapValueSet(
continue; continue;
v8::Local<v8::Object> image_data = v8::Local<v8::Object> image_data =
image_data_set->Get(v8::String::NewFromUtf8(isolate, kImageSizeKeys[i])) image_data_set->Get(v8::String::NewFromUtf8(isolate, kImageSizeKeys[i]))
->ToObject(); ->ToObject(isolate);
v8::Local<v8::Value> image_data_bitmap; v8::Local<v8::Value> image_data_bitmap;
if (!ConvertImageDataToBitmapValue(image_data, &image_data_bitmap)) if (!ConvertImageDataToBitmapValue(image_data, &image_data_bitmap))
return false; return false;
...@@ -130,7 +132,7 @@ void SetIconNatives::SetIconCommon( ...@@ -130,7 +132,7 @@ void SetIconNatives::SetIconCommon(
const v8::FunctionCallbackInfo<v8::Value>& args) { const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK_EQ(1, args.Length()); CHECK_EQ(1, args.Length());
CHECK(args[0]->IsObject()); CHECK(args[0]->IsObject());
v8::Local<v8::Object> details = args[0]->ToObject(); v8::Local<v8::Object> details = args[0]->ToObject(args.GetIsolate());
v8::Local<v8::Object> bitmap_set_value(v8::Object::New(args.GetIsolate())); v8::Local<v8::Object> bitmap_set_value(v8::Object::New(args.GetIsolate()));
if (!ConvertImageDataSetToBitmapValueSet(details, &bitmap_set_value)) if (!ConvertImageDataSetToBitmapValueSet(details, &bitmap_set_value))
return; return;
......
...@@ -32,7 +32,7 @@ void V8ContextNativeHandler::GetAvailability( ...@@ -32,7 +32,7 @@ void V8ContextNativeHandler::GetAvailability(
const v8::FunctionCallbackInfo<v8::Value>& args) { const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK_EQ(args.Length(), 1); CHECK_EQ(args.Length(), 1);
v8::Isolate* isolate = args.GetIsolate(); v8::Isolate* isolate = args.GetIsolate();
std::string api_name = *v8::String::Utf8Value(args[0]->ToString()); std::string api_name = *v8::String::Utf8Value(args[0]);
Feature::Availability availability = context_->GetAvailability(api_name); Feature::Availability availability = context_->GetAvailability(api_name);
v8::Handle<v8::Object> ret = v8::Object::New(isolate); v8::Handle<v8::Object> ret = v8::Object::New(isolate);
......
...@@ -57,7 +57,8 @@ gin::Dictionary CreateMessagePipe(const gin::Arguments& args) { ...@@ -57,7 +57,8 @@ gin::Dictionary CreateMessagePipe(const gin::Arguments& args) {
options_value->IsUndefined()) { options_value->IsUndefined()) {
result = MojoCreateMessagePipe(NULL, &handle0, &handle1); result = MojoCreateMessagePipe(NULL, &handle0, &handle1);
} else if (options_value->IsObject()) { } else if (options_value->IsObject()) {
gin::Dictionary options_dict(args.isolate(), options_value->ToObject()); gin::Dictionary options_dict(args.isolate(),
options_value->ToObject(args.isolate()));
MojoCreateMessagePipeOptions options; MojoCreateMessagePipeOptions options;
// For future struct_size, we can probably infer that from the presence of // For future struct_size, we can probably infer that from the presence of
// properties in options_dict. For now, it's always 8. // properties in options_dict. For now, it's always 8.
...@@ -156,7 +157,8 @@ gin::Dictionary CreateDataPipe(const gin::Arguments& args) { ...@@ -156,7 +157,8 @@ gin::Dictionary CreateDataPipe(const gin::Arguments& args) {
options_value->IsUndefined()) { options_value->IsUndefined()) {
result = MojoCreateDataPipe(NULL, &producer_handle, &consumer_handle); result = MojoCreateDataPipe(NULL, &producer_handle, &consumer_handle);
} else if (options_value->IsObject()) { } else if (options_value->IsObject()) {
gin::Dictionary options_dict(args.isolate(), options_value->ToObject()); gin::Dictionary options_dict(args.isolate(),
options_value->ToObject(args.isolate()));
MojoCreateDataPipeOptions options; MojoCreateDataPipeOptions options;
// For future struct_size, we can probably infer that from the presence of // For future struct_size, we can probably infer that from the presence of
// properties in options_dict. For now, it's always 16. // properties in options_dict. For now, it's always 16.
......
...@@ -196,7 +196,7 @@ bool V8ObjectToUTF16String(v8::Local<v8::Value> object, ...@@ -196,7 +196,7 @@ bool V8ObjectToUTF16String(v8::Local<v8::Value> object,
return false; return false;
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
v8::Local<v8::String> str_object = object->ToString(); v8::Local<v8::String> str_object = object->ToString(isolate);
if (str_object.IsEmpty()) if (str_object.IsEmpty())
return false; return false;
*utf16_result = V8StringToUTF16(str_object); *utf16_result = V8StringToUTF16(str_object);
...@@ -211,7 +211,8 @@ bool GetHostnameArgument(const v8::FunctionCallbackInfo<v8::Value>& args, ...@@ -211,7 +211,8 @@ bool GetHostnameArgument(const v8::FunctionCallbackInfo<v8::Value>& args,
if (args.Length() == 0 || args[0].IsEmpty() || !args[0]->IsString()) if (args.Length() == 0 || args[0].IsEmpty() || !args[0]->IsString())
return false; return false;
const base::string16 hostname_utf16 = V8StringToUTF16(args[0]->ToString()); const base::string16 hostname_utf16 =
V8StringToUTF16(v8::Local<v8::String>::Cast(args[0]));
// If the hostname is already in ASCII, simply return it as is. // If the hostname is already in ASCII, simply return it as is.
if (base::IsStringASCII(hostname_utf16)) { if (base::IsStringASCII(hostname_utf16)) {
...@@ -393,7 +394,7 @@ class ProxyResolverV8::Context { ...@@ -393,7 +394,7 @@ class ProxyResolverV8::Context {
return ERR_PAC_SCRIPT_FAILED; return ERR_PAC_SCRIPT_FAILED;
} }
base::string16 ret_str = V8StringToUTF16(ret->ToString()); base::string16 ret_str = V8StringToUTF16(v8::Local<v8::String>::Cast(ret));
if (!base::IsStringASCII(ret_str)) { if (!base::IsStringASCII(ret_str)) {
// TODO(eroman): Rather than failing when a wide string is returned, we // TODO(eroman): Rather than failing when a wide string is returned, we
...@@ -656,7 +657,8 @@ class ProxyResolverV8::Context { ...@@ -656,7 +657,8 @@ class ProxyResolverV8::Context {
return; return;
} }
std::string ip_address_list = V8StringToUTF8(args[0]->ToString()); std::string ip_address_list =
V8StringToUTF8(v8::Local<v8::String>::Cast(args[0]));
if (!base::IsStringASCII(ip_address_list)) { if (!base::IsStringASCII(ip_address_list)) {
args.GetReturnValue().SetNull(); args.GetReturnValue().SetNull();
return; return;
...@@ -681,12 +683,14 @@ class ProxyResolverV8::Context { ...@@ -681,12 +683,14 @@ class ProxyResolverV8::Context {
return; return;
} }
std::string ip_address = V8StringToUTF8(args[0]->ToString()); std::string ip_address =
V8StringToUTF8(v8::Local<v8::String>::Cast(args[0]));
if (!base::IsStringASCII(ip_address)) { if (!base::IsStringASCII(ip_address)) {
args.GetReturnValue().Set(false); args.GetReturnValue().Set(false);
return; return;
} }
std::string ip_prefix = V8StringToUTF8(args[1]->ToString()); std::string ip_prefix =
V8StringToUTF8(v8::Local<v8::String>::Cast(args[1]));
if (!base::IsStringASCII(ip_prefix)) { if (!base::IsStringASCII(ip_prefix)) {
args.GetReturnValue().Set(false); args.GetReturnValue().Set(false);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment