| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 22 matching lines...) Expand all Loading... |
| 33 #include "bindings/core/dart/DartInjectedScript.h" | 33 #include "bindings/core/dart/DartInjectedScript.h" |
| 34 | 34 |
| 35 #include "bindings/core/dart/DartDOMWrapper.h" | 35 #include "bindings/core/dart/DartDOMWrapper.h" |
| 36 #include "bindings/core/dart/DartHandleProxy.h" | 36 #include "bindings/core/dart/DartHandleProxy.h" |
| 37 #include "bindings/core/dart/DartJsInterop.h" | 37 #include "bindings/core/dart/DartJsInterop.h" |
| 38 #include "bindings/core/dart/DartScriptDebugServer.h" | 38 #include "bindings/core/dart/DartScriptDebugServer.h" |
| 39 #include "bindings/core/dart/DartScriptState.h" | 39 #include "bindings/core/dart/DartScriptState.h" |
| 40 #include "bindings/core/dart/DartUtilities.h" | 40 #include "bindings/core/dart/DartUtilities.h" |
| 41 #include "bindings/core/dart/V8Converter.h" | 41 #include "bindings/core/dart/V8Converter.h" |
| 42 #include "bindings/core/v8/ScriptFunctionCall.h" | 42 #include "bindings/core/v8/ScriptFunctionCall.h" |
| 43 #include "bindings/core/v8/V8InjectedScriptHost.h" | 43 #include "bindings/core/v8/V8DOMWrapper.h" |
| 44 #include "bindings/core/v8/inspector/V8InjectedScriptHost.h" |
| 44 #include "core/inspector/InjectedScriptHost.h" | 45 #include "core/inspector/InjectedScriptHost.h" |
| 45 #include "core/inspector/JSONParser.h" | 46 #include "core/inspector/JSONParser.h" |
| 46 #include "platform/JSONValues.h" | 47 #include "platform/JSONValues.h" |
| 47 | 48 |
| 48 using blink::TypeBuilder::Array; | 49 using blink::TypeBuilder::Array; |
| 49 using blink::TypeBuilder::Debugger::CallFrame; | 50 using blink::TypeBuilder::Debugger::CallFrame; |
| 50 using blink::TypeBuilder::Debugger::Location; | 51 using blink::TypeBuilder::Debugger::Location; |
| 51 using blink::TypeBuilder::Debugger::Scope; | 52 using blink::TypeBuilder::Debugger::Scope; |
| 52 using blink::TypeBuilder::Runtime::PropertyDescriptor; | 53 using blink::TypeBuilder::Runtime::PropertyDescriptor; |
| 53 using blink::TypeBuilder::Runtime::InternalPropertyDescriptor; | 54 using blink::TypeBuilder::Runtime::InternalPropertyDescriptor; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 265 |
| 265 for (DebuggerObjectMap::iterator it = m_objects.begin(); it != m_objects.end
(); ++it) { | 266 for (DebuggerObjectMap::iterator it = m_objects.begin(); it != m_objects.end
(); ++it) { |
| 266 delete it->value; | 267 delete it->value; |
| 267 } | 268 } |
| 268 | 269 |
| 269 if (m_consoleApi) | 270 if (m_consoleApi) |
| 270 Dart_DeletePersistentHandle(m_consoleApi); | 271 Dart_DeletePersistentHandle(m_consoleApi); |
| 271 } | 272 } |
| 272 | 273 |
| 273 // Copied from V8injectedScriptManager. | 274 // Copied from V8injectedScriptManager. |
| 274 v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(PassRefPtrWillBeRawPtr<I
njectedScriptHost> host, InjectedScriptManager* injectedScriptManager, v8::Handl
e<v8::Object> creationContext, v8::Isolate* isolate) | 275 v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(PassRefPtrWillBeRawPtr<I
njectedScriptHost> host, InjectedScriptManager* injectedScriptManager, v8::Handl
e<v8::Context> creationContext, v8::Isolate* isolate) |
| 275 { | 276 { |
| 276 return V8DOMWrapper::createWrapper(creationContext, &V8InjectedScriptHost::w
rapperTypeInfo, | 277 // TODO(jacobr): is this correct. |
| 277 host->toScriptWrappableBase(), isolate); | 278 v8::Local<v8::FunctionTemplate> wrapperTemplate = host->wrapperTemplate(isol
ate); |
| 279 ASSERT(!wrapperTemplate.IsEmpty()); |
| 280 if (wrapperTemplate.IsEmpty()) { |
| 281 // Hopefully this isn't needed. |
| 282 wrapperTemplate = V8InjectedScriptHost::createWrapperTemplate(isolate); |
| 283 host->setWrapperTemplate(wrapperTemplate, isolate); |
| 284 } |
| 285 |
| 286 return V8InjectedScriptHost::wrap(wrapperTemplate, creationContext, host); |
| 278 } | 287 } |
| 279 | 288 |
| 280 Dart_Handle DartInjectedScript::consoleApi() | 289 Dart_Handle DartInjectedScript::consoleApi() |
| 281 { | 290 { |
| 282 if (!m_consoleApi) { | 291 if (!m_consoleApi) { |
| 283 V8Scope v8scope(DartDOMData::current()); | 292 V8Scope v8scope(DartDOMData::current()); |
| 284 v8::Local<v8::Object> scriptHostWrapper = createInjectedScriptHostV8Wrap
per(m_host, m_injectedScriptManager, m_scriptState->v8ScriptState()->context()->
Global(), v8::Isolate::GetCurrent()); | 293 v8::Local<v8::Object> scriptHostWrapper = createInjectedScriptHostV8Wrap
per(m_host, m_injectedScriptManager, m_scriptState->v8ScriptState()->context(),
v8::Isolate::GetCurrent()); |
| 285 | 294 |
| 286 Dart_Handle host = JsInterop::toDart(scriptHostWrapper, false); | 295 Dart_Handle host = JsInterop::toDart(scriptHostWrapper, false); |
| 287 Dart_SetPeer(host, this); | 296 Dart_SetPeer(host, this); |
| 288 Dart_Handle consoleApi = DartUtilities::invokeUtilsMethod("consoleApi",
1, &host); | 297 Dart_Handle consoleApi = DartUtilities::invokeUtilsMethod("consoleApi",
1, &host); |
| 289 ASSERT(!Dart_IsError(consoleApi)); | 298 ASSERT(!Dart_IsError(consoleApi)); |
| 290 m_consoleApi = Dart_NewPersistentHandle(consoleApi); | 299 m_consoleApi = Dart_NewPersistentHandle(consoleApi); |
| 291 } | 300 } |
| 292 return m_consoleApi; | 301 return m_consoleApi; |
| 293 } | 302 } |
| 294 | 303 |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 RefPtr<JSONValue> parsedObjectId = parseJSON(objectId); | 1456 RefPtr<JSONValue> parsedObjectId = parseJSON(objectId); |
| 1448 if (parsedObjectId && parsedObjectId->type() == JSONValue::TypeObject) { | 1457 if (parsedObjectId && parsedObjectId->type() == JSONValue::TypeObject) { |
| 1449 bool isDart = false; | 1458 bool isDart = false; |
| 1450 bool success = parsedObjectId->asObject()-> getBoolean("isDart", &isDart
); | 1459 bool success = parsedObjectId->asObject()-> getBoolean("isDart", &isDart
); |
| 1451 return success && isDart; | 1460 return success && isDart; |
| 1452 } | 1461 } |
| 1453 return false; | 1462 return false; |
| 1454 } | 1463 } |
| 1455 | 1464 |
| 1456 } // namespace blink | 1465 } // namespace blink |
| OLD | NEW |