From 2b9826404af7fa4c090a880628fe6db4593fa278 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Fri, 22 May 2015 09:12:03 +0530 Subject: [PATCH] using mate::Dictionary instead of base::DictionaryValue --- atom/browser/api/atom_api_web_contents.cc | 14 +++++++++----- .../native_mate_converters/value_converter.cc | 7 ------- .../native_mate_converters/value_converter.h | 2 -- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 23bdc24cf761..ab58ca0d8cc4 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -312,15 +312,19 @@ void WebContents::DidStopLoading() { void WebContents::DidGetResourceResponseStart( const content::ResourceRequestDetails& details) { + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Locker locker(isolate); + v8::HandleScope handle_scope(isolate); + mate::Dictionary response_headers(isolate, v8::Object::New(isolate)); + net::HttpResponseHeaders* headers = details.headers.get(); - base::DictionaryValue response_headers; void* iter = nullptr; std::string key; std::string value; - while (headers && headers->EnumerateHeaderLines(&iter, &key, &value)) { - response_headers.SetString(base::StringToLowerASCII(key), - base::StringToLowerASCII(value)); - } + while (headers && headers->EnumerateHeaderLines(&iter, &key, &value)) + response_headers.Set(base::StringToLowerASCII(key), + base::StringToLowerASCII(value)); + Emit("did-get-response-details", details.socket_address.IsEmpty(), details.url, diff --git a/atom/common/native_mate_converters/value_converter.cc b/atom/common/native_mate_converters/value_converter.cc index 7971623021a3..815ba0ebb211 100644 --- a/atom/common/native_mate_converters/value_converter.cc +++ b/atom/common/native_mate_converters/value_converter.cc @@ -23,13 +23,6 @@ bool Converter::FromV8(v8::Isolate* isolate, } } -v8::Handle Converter::ToV8( - v8::Isolate* isolate, - const base::DictionaryValue& val) { - scoped_ptr converter(new atom::V8ValueConverter); - return converter->ToV8Value(&val, isolate->GetCurrentContext()); -} - bool Converter::FromV8(v8::Isolate* isolate, v8::Local val, base::ListValue* out) { diff --git a/atom/common/native_mate_converters/value_converter.h b/atom/common/native_mate_converters/value_converter.h index 27e00f4521df..bb0ef66e719b 100644 --- a/atom/common/native_mate_converters/value_converter.h +++ b/atom/common/native_mate_converters/value_converter.h @@ -19,8 +19,6 @@ struct Converter { static bool FromV8(v8::Isolate* isolate, v8::Local val, base::DictionaryValue* out); - static v8::Handle ToV8(v8::Isolate* isolate, - const base::DictionaryValue& val); }; template<>