| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef InjectedScript_h | 31 #ifndef InjectedScript_h |
| 32 #define InjectedScript_h | 32 #define InjectedScript_h |
| 33 | 33 |
| 34 #include "platform/inspector_protocol/Allocator.h" | 34 #include "platform/inspector_protocol/Allocator.h" |
| 35 #include "platform/inspector_protocol/TypeBuilder.h" | 35 #include "platform/inspector_protocol/TypeBuilder.h" |
| 36 #include "platform/v8_inspector/InjectedScriptNative.h" | 36 #include "platform/v8_inspector/InjectedScriptNative.h" |
| 37 #include "platform/v8_inspector/InspectedContext.h" | 37 #include "platform/v8_inspector/InspectedContext.h" |
| 38 #include "platform/v8_inspector/V8DebuggerImpl.h" | 38 #include "platform/v8_inspector/V8DebuggerImpl.h" |
| 39 #include "wtf/PassOwnPtr.h" | 39 #include "wtf/PtrUtil.h" |
| 40 | 40 |
| 41 #include <v8.h> | 41 #include <v8.h> |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 class RemoteObjectId; | 45 class RemoteObjectId; |
| 46 class V8FunctionCall; | 46 class V8FunctionCall; |
| 47 class V8InspectorSessionImpl; | 47 class V8InspectorSessionImpl; |
| 48 | 48 |
| 49 namespace protocol { | 49 namespace protocol { |
| 50 class DictionaryValue; | 50 class DictionaryValue; |
| 51 } | 51 } |
| 52 | 52 |
| 53 using protocol::Maybe; | 53 using protocol::Maybe; |
| 54 | 54 |
| 55 class InjectedScript final { | 55 class InjectedScript final { |
| 56 PROTOCOL_DISALLOW_COPY(InjectedScript); | 56 PROTOCOL_DISALLOW_COPY(InjectedScript); |
| 57 public: | 57 public: |
| 58 static PassOwnPtr<InjectedScript> create(InspectedContext*); | 58 static std::unique_ptr<InjectedScript> create(InspectedContext*); |
| 59 ~InjectedScript(); | 59 ~InjectedScript(); |
| 60 | 60 |
| 61 InspectedContext* context() const { return m_context; } | 61 InspectedContext* context() const { return m_context; } |
| 62 | 62 |
| 63 void getProperties(ErrorString*, v8::Local<v8::Object>, const String16& grou
pName, bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, Ow
nPtr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* result, Maybe<prot
ocol::Runtime::ExceptionDetails>*); | 63 void getProperties(ErrorString*, v8::Local<v8::Object>, const String16& grou
pName, bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, st
d::unique_ptr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* result, M
aybe<protocol::Runtime::ExceptionDetails>*); |
| 64 void releaseObject(const String16& objectId); | 64 void releaseObject(const String16& objectId); |
| 65 | 65 |
| 66 PassOwnPtr<protocol::Runtime::RemoteObject> wrapObject(ErrorString*, v8::Loc
al<v8::Value>, const String16& groupName, bool forceValueType = false, bool gene
ratePreview = false) const; | 66 std::unique_ptr<protocol::Runtime::RemoteObject> wrapObject(ErrorString*, v8
::Local<v8::Value>, const String16& groupName, bool forceValueType = false, bool
generatePreview = false) const; |
| 67 bool wrapObjectProperty(ErrorString*, v8::Local<v8::Object>, v8::Local<v8::V
alue> key, const String16& groupName, bool forceValueType = false, bool generate
Preview = false) const; | 67 bool wrapObjectProperty(ErrorString*, v8::Local<v8::Object>, v8::Local<v8::V
alue> key, const String16& groupName, bool forceValueType = false, bool generate
Preview = false) const; |
| 68 bool wrapPropertyInArray(ErrorString*, v8::Local<v8::Array>, v8::Local<v8::S
tring> property, const String16& groupName, bool forceValueType = false, bool ge
neratePreview = false) const; | 68 bool wrapPropertyInArray(ErrorString*, v8::Local<v8::Array>, v8::Local<v8::S
tring> property, const String16& groupName, bool forceValueType = false, bool ge
neratePreview = false) const; |
| 69 bool wrapObjectsInArray(ErrorString*, v8::Local<v8::Array>, const String16&
groupName, bool forceValueType = false, bool generatePreview = false) const; | 69 bool wrapObjectsInArray(ErrorString*, v8::Local<v8::Array>, const String16&
groupName, bool forceValueType = false, bool generatePreview = false) const; |
| 70 PassOwnPtr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Value> t
able, v8::Local<v8::Value> columns) const; | 70 std::unique_ptr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Val
ue> table, v8::Local<v8::Value> columns) const; |
| 71 | 71 |
| 72 bool findObject(ErrorString*, const RemoteObjectId&, v8::Local<v8::Value>*)
const; | 72 bool findObject(ErrorString*, const RemoteObjectId&, v8::Local<v8::Value>*)
const; |
| 73 String16 objectGroupName(const RemoteObjectId&) const; | 73 String16 objectGroupName(const RemoteObjectId&) const; |
| 74 void releaseObjectGroup(const String16&); | 74 void releaseObjectGroup(const String16&); |
| 75 void setCustomObjectFormatterEnabled(bool); | 75 void setCustomObjectFormatterEnabled(bool); |
| 76 v8::MaybeLocal<v8::Value> resolveCallArgument(ErrorString*, protocol::Runtim
e::CallArgument*); | 76 v8::MaybeLocal<v8::Value> resolveCallArgument(ErrorString*, protocol::Runtim
e::CallArgument*); |
| 77 | 77 |
| 78 PassOwnPtr<protocol::Runtime::ExceptionDetails> createExceptionDetails(v8::L
ocal<v8::Message>); | 78 std::unique_ptr<protocol::Runtime::ExceptionDetails> createExceptionDetails(
v8::Local<v8::Message>); |
| 79 void wrapEvaluateResult(ErrorString*, | 79 void wrapEvaluateResult(ErrorString*, |
| 80 v8::MaybeLocal<v8::Value> maybeResultValue, | 80 v8::MaybeLocal<v8::Value> maybeResultValue, |
| 81 const v8::TryCatch&, | 81 const v8::TryCatch&, |
| 82 const String16& objectGroup, | 82 const String16& objectGroup, |
| 83 bool returnByValue, | 83 bool returnByValue, |
| 84 bool generatePreview, | 84 bool generatePreview, |
| 85 OwnPtr<protocol::Runtime::RemoteObject>* result, | 85 std::unique_ptr<protocol::Runtime::RemoteObject>* result, |
| 86 Maybe<bool>* wasThrown, | 86 Maybe<bool>* wasThrown, |
| 87 Maybe<protocol::Runtime::ExceptionDetails>*); | 87 Maybe<protocol::Runtime::ExceptionDetails>*); |
| 88 v8::Local<v8::Value> lastEvaluationResult() const; | 88 v8::Local<v8::Value> lastEvaluationResult() const; |
| 89 | 89 |
| 90 class Scope { | 90 class Scope { |
| 91 public: | 91 public: |
| 92 bool initialize(); | 92 bool initialize(); |
| 93 bool installCommandLineAPI(); | 93 bool installCommandLineAPI(); |
| 94 void ignoreExceptionsAndMuteConsole(); | 94 void ignoreExceptionsAndMuteConsole(); |
| 95 void pretendUserGesture(); | 95 void pretendUserGesture(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 CallFrameScope(ErrorString*, V8DebuggerImpl*, int contextGroupId, const
String16& remoteCallFrameId); | 151 CallFrameScope(ErrorString*, V8DebuggerImpl*, int contextGroupId, const
String16& remoteCallFrameId); |
| 152 ~CallFrameScope(); | 152 ~CallFrameScope(); |
| 153 size_t frameOrdinal() const { return m_frameOrdinal; } | 153 size_t frameOrdinal() const { return m_frameOrdinal; } |
| 154 private: | 154 private: |
| 155 void findInjectedScript(V8InspectorSessionImpl*) override; | 155 void findInjectedScript(V8InspectorSessionImpl*) override; |
| 156 String16 m_remoteCallFrameId; | 156 String16 m_remoteCallFrameId; |
| 157 size_t m_frameOrdinal; | 157 size_t m_frameOrdinal; |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 private: | 160 private: |
| 161 InjectedScript(InspectedContext*, v8::Local<v8::Object>, PassOwnPtr<Injected
ScriptNative>); | 161 InjectedScript(InspectedContext*, v8::Local<v8::Object>, std::unique_ptr<Inj
ectedScriptNative>); |
| 162 bool canAccessInspectedWindow() const; | 162 bool canAccessInspectedWindow() const; |
| 163 v8::Local<v8::Value> v8Value() const; | 163 v8::Local<v8::Value> v8Value() const; |
| 164 v8::MaybeLocal<v8::Value> wrapValue(ErrorString*, v8::Local<v8::Value>, cons
t String16& groupName, bool forceValueType, bool generatePreview) const; | 164 v8::MaybeLocal<v8::Value> wrapValue(ErrorString*, v8::Local<v8::Value>, cons
t String16& groupName, bool forceValueType, bool generatePreview) const; |
| 165 v8::Local<v8::Object> commandLineAPI(); | 165 v8::Local<v8::Object> commandLineAPI(); |
| 166 | 166 |
| 167 InspectedContext* m_context; | 167 InspectedContext* m_context; |
| 168 v8::Global<v8::Value> m_value; | 168 v8::Global<v8::Value> m_value; |
| 169 v8::Global<v8::Value> m_lastEvaluationResult; | 169 v8::Global<v8::Value> m_lastEvaluationResult; |
| 170 OwnPtr<InjectedScriptNative> m_native; | 170 std::unique_ptr<InjectedScriptNative> m_native; |
| 171 v8::Global<v8::Object> m_commandLineAPI; | 171 v8::Global<v8::Object> m_commandLineAPI; |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 } // namespace blink | 174 } // namespace blink |
| 175 | 175 |
| 176 #endif | 176 #endif |
| OLD | NEW |