]> khamidou — GitHub mirrors - electron.git/commitdiff
using mate::Dictionary instead of base::DictionaryValue
authordeepak1556 <hop2deep@gmail.com>
Fri, 22 May 2015 03:42:03 +0000 (09:12 +0530)
committerdeepak1556 <hop2deep@gmail.com>
Sat, 23 May 2015 13:56:47 +0000 (19:26 +0530)
atom/browser/api/atom_api_web_contents.cc
atom/common/native_mate_converters/value_converter.cc
atom/common/native_mate_converters/value_converter.h

index 23bdc24cf761ae7acf8ab5f5878eb7ae78761a6d..ab58ca0d8cc45a2e3d55ab64b1012a60a1c2f9ac 100644 (file)
@@ -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,
index 7971623021a32a9d5dbf4883a291334f4b9c3105..815ba0ebb2114fb223efb3894f115aa85f14d895 100644 (file)
@@ -23,13 +23,6 @@ bool Converter<base::DictionaryValue>::FromV8(v8::Isolate* isolate,
   }
 }
 
-v8::Handle<v8::Value> Converter<base::DictionaryValue>::ToV8(
-    v8::Isolate* isolate,
-    const base::DictionaryValue& val) {
-  scoped_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
-  return converter->ToV8Value(&val, isolate->GetCurrentContext());
-}
-
 bool Converter<base::ListValue>::FromV8(v8::Isolate* isolate,
                                         v8::Local<v8::Value> val,
                                         base::ListValue* out) {
index 27e00f4521df2d1577e59c665796c9d74d359be4..bb0ef66e719bacfd2b880bb0738c525a81ec3f0f 100644 (file)
@@ -19,8 +19,6 @@ struct Converter<base::DictionaryValue> {
   static bool FromV8(v8::Isolate* isolate,
                      v8::Local<v8::Value> val,
                      base::DictionaryValue* out);
-  static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
-                                    const base::DictionaryValue& val);
 };
 
 template<>