| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 Google Inc. All rights reserved. | 2 * Copyright (c) 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 230 } |
| 231 | 231 |
| 232 v8::MaybeLocal<v8::Value> MainThreadDebugger::memoryInfo(v8::Isolate* isolate, v
8::Local<v8::Context> context, v8::Local<v8::Object> creationContext) | 232 v8::MaybeLocal<v8::Value> MainThreadDebugger::memoryInfo(v8::Isolate* isolate, v
8::Local<v8::Context> context, v8::Local<v8::Object> creationContext) |
| 233 { | 233 { |
| 234 ExecutionContext* executionContext = toExecutionContext(context); | 234 ExecutionContext* executionContext = toExecutionContext(context); |
| 235 ASSERT_UNUSED(executionContext, executionContext); | 235 ASSERT_UNUSED(executionContext, executionContext); |
| 236 ASSERT(executionContext->isDocument()); | 236 ASSERT(executionContext->isDocument()); |
| 237 return toV8(MemoryInfo::create(), creationContext, isolate); | 237 return toV8(MemoryInfo::create(), creationContext, isolate); |
| 238 } | 238 } |
| 239 | 239 |
| 240 bool MainThreadDebugger::isCommandLineAPIMethod(const String& name) | |
| 241 { | |
| 242 DEFINE_STATIC_LOCAL(HashSet<String>, methods, ()); | |
| 243 if (methods.size() == 0) { | |
| 244 const char* members[] = { "$", "$$", "$x" }; | |
| 245 for (size_t i = 0; i < WTF_ARRAY_LENGTH(members); ++i) | |
| 246 methods.add(members[i]); | |
| 247 } | |
| 248 return methods.find(name) != methods.end() || ThreadDebugger::isCommandLineA
PIMethod(name); | |
| 249 } | |
| 250 | |
| 251 void MainThreadDebugger::installAdditionalCommandLineAPI(v8::Local<v8::Context>
context, v8::Local<v8::Object> object) | 240 void MainThreadDebugger::installAdditionalCommandLineAPI(v8::Local<v8::Context>
context, v8::Local<v8::Object> object) |
| 252 { | 241 { |
| 253 ThreadDebugger::installAdditionalCommandLineAPI(context, object); | 242 ThreadDebugger::installAdditionalCommandLineAPI(context, object); |
| 254 createFunctionProperty(context, object, "$", MainThreadDebugger::querySelect
orCallback, "function $(selector, [startNode]) { [Command Line API] }"); | 243 createFunctionProperty(context, object, "$", MainThreadDebugger::querySelect
orCallback, "function $(selector, [startNode]) { [Command Line API] }"); |
| 255 createFunctionProperty(context, object, "$$", MainThreadDebugger::querySelec
torAllCallback, "function $$(selector, [startNode]) { [Command Line API] }"); | 244 createFunctionProperty(context, object, "$$", MainThreadDebugger::querySelec
torAllCallback, "function $$(selector, [startNode]) { [Command Line API] }"); |
| 256 createFunctionProperty(context, object, "$x", MainThreadDebugger::xpathSelec
torCallback, "function $x(xpath, [startNode]) { [Command Line API] }"); | 245 createFunctionProperty(context, object, "$x", MainThreadDebugger::xpathSelec
torCallback, "function $x(xpath, [startNode]) { [Command Line API] }"); |
| 257 } | 246 } |
| 258 | 247 |
| 259 static Node* secondArgumentAsNode(const v8::FunctionCallbackInfo<v8::Value>& inf
o) | 248 static Node* secondArgumentAsNode(const v8::FunctionCallbackInfo<v8::Value>& inf
o) |
| 260 { | 249 { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 return; | 334 return; |
| 346 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get
Isolate())).FromMaybe(false)) | 335 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get
Isolate())).FromMaybe(false)) |
| 347 return; | 336 return; |
| 348 } | 337 } |
| 349 info.GetReturnValue().Set(nodes); | 338 info.GetReturnValue().Set(nodes); |
| 350 } | 339 } |
| 351 exceptionState.throwIfNeeded(); | 340 exceptionState.throwIfNeeded(); |
| 352 } | 341 } |
| 353 | 342 |
| 354 } // namespace blink | 343 } // namespace blink |
| OLD | NEW |