@@ -57,6 +57,17 @@ using namespace blink;
57
57
#undef INTERNAL_TRACE_EVENT_SCOPED_CONTEXT
58
58
//#undef INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE
59
59
#endif
60
+ #undef EXCLUSIVE_LOCKS_REQUIRED
61
+ #undef SHARED_LOCKS_REQUIRED
62
+ #undef LOCKS_EXCLUDED
63
+ #undef LOCK_RETURNED
64
+ // #undef EXCLUSIVE_LOCK_FUNCTION
65
+ #undef SHARED_LOCK_FUNCTION
66
+ // #undef UNLOCK_FUNCTION
67
+ // #undef EXCLUSIVE_TRYLOCK_FUNCTION
68
+ #undef SHARED_TRYLOCK_FUNCTION
69
+ #undef NO_THREAD_SAFETY_ANALYSIS
70
+
60
71
// #include "third_party/WebKit/Source/config.h"
61
72
#include " third_party/WebKit/Source/core/html/HTMLIFrameElement.h"
62
73
#include " third_party/WebKit/Source/core/dom/Document.h"
@@ -117,43 +128,47 @@ bool MakePathAbsolute(base::FilePath* file_path) {
117
128
}
118
129
119
130
} // namespace
120
- NWCustomBindings::NWCustomBindings (ScriptContext* context)
121
- : ObjectBackedNativeHandler(context ) {
122
- RouteFunction (" crashRenderer" ,
131
+
132
+ void NWCustomBindings::AddRoutes ( ) {
133
+ RouteHandlerFunction (" crashRenderer" ,
123
134
base::Bind (&NWCustomBindings::CrashRenderer,
124
135
base::Unretained (this )));
125
- RouteFunction (" evalScript" ,
136
+ RouteHandlerFunction (" evalScript" ,
126
137
base::Bind (&NWCustomBindings::EvalScript,
127
138
base::Unretained (this )));
128
- RouteFunction (" evalNWBin" ,
139
+ RouteHandlerFunction (" evalNWBin" ,
129
140
base::Bind (&NWCustomBindings::EvalNWBin,
130
141
base::Unretained (this )));
131
- RouteFunction (" getAbsolutePath" ,
142
+ RouteHandlerFunction (" getAbsolutePath" ,
132
143
base::Bind (&NWCustomBindings::GetAbsolutePath,
133
144
base::Unretained (this )));
134
- RouteFunction (" addOriginAccessWhitelistEntry" ,
145
+ RouteHandlerFunction (" addOriginAccessWhitelistEntry" ,
135
146
base::Bind (&NWCustomBindings::AddOriginAccessWhitelistEntry,
136
147
base::Unretained (this )));
137
- RouteFunction (" removeOriginAccessWhitelistEntry" ,
148
+ RouteHandlerFunction (" removeOriginAccessWhitelistEntry" ,
138
149
base::Bind (&NWCustomBindings::RemoveOriginAccessWhitelistEntry,
139
150
base::Unretained (this )));
140
- RouteFunction (" getProxyForURL" ,
151
+ RouteHandlerFunction (" getProxyForURL" ,
141
152
base::Bind (&NWCustomBindings::GetProxyForURL,
142
153
base::Unretained (this )));
143
- RouteFunction (" setDevToolsJail" ,
154
+ RouteHandlerFunction (" setDevToolsJail" ,
144
155
base::Bind (&NWCustomBindings::SetDevToolsJail,
145
156
base::Unretained (this )));
146
- RouteFunction (" getWidgetRoutingID" ,
157
+ RouteHandlerFunction (" getWidgetRoutingID" ,
147
158
base::Bind (&NWCustomBindings::GetWidgetRoutingID,
148
159
base::Unretained (this )));
149
- RouteFunction (" getRoutingID" ,
160
+ RouteHandlerFunction (" getRoutingID" ,
150
161
base::Bind (&NWCustomBindings::GetRoutingID,
151
162
base::Unretained (this )));
152
- RouteFunction (" callInWindow" ,
163
+ RouteHandlerFunction (" callInWindow" ,
153
164
base::Bind (&NWCustomBindings::CallInWindow,
154
165
base::Unretained (this )));
155
166
}
156
167
168
+ NWCustomBindings::NWCustomBindings (ScriptContext* context)
169
+ : ObjectBackedNativeHandler(context) {
170
+ }
171
+
157
172
void NWCustomBindings::CallInWindow (
158
173
const v8::FunctionCallbackInfo<v8::Value>& args) {
159
174
v8::Local<v8::Context> target_context = args[0 ]->ToObject ()->CreationContext ();
@@ -193,6 +208,7 @@ void NWCustomBindings::EvalScript(
193
208
content::RenderFrame* render_frame = context ()->GetRenderFrame ();
194
209
if (!render_frame)
195
210
return ;
211
+ v8::Isolate* isolate = args.GetIsolate ();
196
212
WebFrame* main_frame = render_frame->GetWebFrame ();
197
213
v8::Handle<v8::Value> result;
198
214
v8::Handle<v8::Object> frm = v8::Handle<v8::Object>::Cast (args[0 ]);
@@ -204,9 +220,9 @@ void NWCustomBindings::EvalScript(
204
220
web_frame = blink::WebFrame::FromFrame (iframe->ContentFrame ());
205
221
}
206
222
#if defined(OS_WIN)
207
- base::string16 jscript ((WCHAR*)*v8::String::Value (args[1 ]));
223
+ base::string16 jscript ((WCHAR*)*v8::String::Value (isolate, args[1 ]));
208
224
#else
209
- base::string16 jscript = *v8::String::Value (args[1 ]);
225
+ base::string16 jscript = *v8::String::Value (isolate, args[1 ]);
210
226
#endif
211
227
if (web_frame) {
212
228
blink::WebLocalFrame* local_frame = web_frame->ToWebLocalFrame ();
@@ -292,7 +308,7 @@ void NWCustomBindings::EvalNWBin(
292
308
void NWCustomBindings::GetAbsolutePath (
293
309
const v8::FunctionCallbackInfo<v8::Value>& args) {
294
310
v8::Isolate* isolate = args.GetIsolate ();
295
- base::FilePath path = base::FilePath::FromUTF8Unsafe (*v8::String::Utf8Value (args[0 ]));
311
+ base::FilePath path = base::FilePath::FromUTF8Unsafe (*v8::String::Utf8Value (isolate, args[0 ]));
296
312
MakePathAbsolute (&path);
297
313
#if defined(OS_POSIX)
298
314
args.GetReturnValue ().Set (v8::String::NewFromUtf8 (isolate, path.value ().c_str ()));
@@ -304,9 +320,9 @@ void NWCustomBindings::GetAbsolutePath(
304
320
void NWCustomBindings::AddOriginAccessWhitelistEntry (const v8::FunctionCallbackInfo<v8::Value>& args) {
305
321
v8::Isolate* isolate = args.GetIsolate ();
306
322
307
- std::string sourceOrigin = *v8::String::Utf8Value (args[0 ]);
308
- std::string destinationProtocol = *v8::String::Utf8Value (args[1 ]);
309
- std::string destinationHost = *v8::String::Utf8Value (args[2 ]);
323
+ std::string sourceOrigin = *v8::String::Utf8Value (isolate, args[0 ]);
324
+ std::string destinationProtocol = *v8::String::Utf8Value (isolate, args[1 ]);
325
+ std::string destinationHost = *v8::String::Utf8Value (isolate, args[2 ]);
310
326
bool allowDestinationSubdomains = args[3 ]->ToBoolean ()->Value ();
311
327
312
328
blink::WebSecurityPolicy::AddOriginAccessWhitelistEntry (GURL (sourceOrigin),
@@ -320,9 +336,9 @@ void NWCustomBindings::AddOriginAccessWhitelistEntry(const v8::FunctionCallbackI
320
336
void NWCustomBindings::RemoveOriginAccessWhitelistEntry (const v8::FunctionCallbackInfo<v8::Value>& args) {
321
337
v8::Isolate* isolate = args.GetIsolate ();
322
338
323
- std::string sourceOrigin = *v8::String::Utf8Value (args[0 ]);
324
- std::string destinationProtocol = *v8::String::Utf8Value (args[1 ]);
325
- std::string destinationHost = *v8::String::Utf8Value (args[2 ]);
339
+ std::string sourceOrigin = *v8::String::Utf8Value (isolate, args[0 ]);
340
+ std::string destinationProtocol = *v8::String::Utf8Value (isolate, args[1 ]);
341
+ std::string destinationHost = *v8::String::Utf8Value (isolate, args[2 ]);
326
342
bool allowDestinationSubdomains = args[3 ]->ToBoolean ()->Value ();
327
343
328
344
blink::WebSecurityPolicy::RemoveOriginAccessWhitelistEntry (GURL (sourceOrigin),
@@ -336,7 +352,7 @@ void NWCustomBindings::RemoveOriginAccessWhitelistEntry(const v8::FunctionCallba
336
352
void NWCustomBindings::GetProxyForURL (const v8::FunctionCallbackInfo<v8::Value>& args) {
337
353
v8::Isolate* isolate = args.GetIsolate ();
338
354
339
- std::string url = *v8::String::Utf8Value (args[0 ]);
355
+ std::string url = *v8::String::Utf8Value (isolate, args[0 ]);
340
356
GURL gurl (url);
341
357
if (!gurl.is_valid ()) {
342
358
args.GetReturnValue ().Set (isolate->ThrowException (v8::Exception::Error (v8::String::NewFromUtf8 (isolate,
0 commit comments