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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 class JSONValue; | 44 class JSONValue; |
45 class RemoteObjectId; | 45 class RemoteObjectId; |
46 class ScriptFunctionCall; | 46 class ScriptFunctionCall; |
47 | 47 |
48 typedef String ErrorString; | 48 typedef String ErrorString; |
49 PassRefPtr<JSONValue> toJSONValue(const ScriptValue&); | 49 PassRefPtr<JSONValue> toJSONValue(const ScriptValue&); |
50 | 50 |
51 | |
52 class InjectedScript final { | 51 class InjectedScript final { |
53 DISALLOW_NEW(); | 52 USING_FAST_MALLOC(InjectedScript); |
54 public: | 53 public: |
55 InjectedScript(); | 54 InjectedScript(); |
56 ~InjectedScript(); | 55 ~InjectedScript(); |
57 | 56 |
58 bool isEmpty() const { return m_injectedScriptObject.isEmpty(); } | |
59 ScriptState* scriptState() const | 57 ScriptState* scriptState() const |
60 { | 58 { |
61 ASSERT(!isEmpty()); | |
62 return m_injectedScriptObject.scriptState(); | 59 return m_injectedScriptObject.scriptState(); |
63 } | 60 } |
64 | 61 |
65 void evaluate( | 62 void evaluate( |
66 ErrorString*, | 63 ErrorString*, |
67 const String& expression, | 64 const String& expression, |
68 const String& objectGroup, | 65 const String& objectGroup, |
69 bool includeCommandLineAPI, | 66 bool includeCommandLineAPI, |
70 bool returnByValue, | 67 bool returnByValue, |
71 bool generatePreview, | 68 bool generatePreview, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(const ScriptValue&
table, const ScriptValue& columns) const; | 107 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(const ScriptValue&
table, const ScriptValue& columns) const; |
111 v8::Local<v8::Value> findObject(const RemoteObjectId&) const; | 108 v8::Local<v8::Value> findObject(const RemoteObjectId&) const; |
112 | 109 |
113 String objectIdToObjectGroupName(const String& objectId) const; | 110 String objectIdToObjectGroupName(const String& objectId) const; |
114 void releaseObjectGroup(const String&); | 111 void releaseObjectGroup(const String&); |
115 | 112 |
116 void setCustomObjectFormatterEnabled(bool); | 113 void setCustomObjectFormatterEnabled(bool); |
117 int contextId() { return m_contextId; } | 114 int contextId() { return m_contextId; } |
118 | 115 |
119 private: | 116 private: |
120 friend InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState*)
; | 117 friend InjectedScript* InjectedScriptManager::injectedScriptFor(ScriptState*
); |
121 using InspectedStateAccessCheck = bool (*)(ScriptState*); | 118 using InspectedStateAccessCheck = bool (*)(ScriptState*); |
122 InjectedScript(ScriptValue, InspectedStateAccessCheck, PassRefPtr<InjectedSc
riptNative>, int contextId); | 119 InjectedScript(ScriptValue, InspectedStateAccessCheck, PassRefPtr<InjectedSc
riptNative>, int contextId); |
123 | 120 |
124 void initialize(ScriptValue, InspectedStateAccessCheck); | 121 void initialize(ScriptValue, InspectedStateAccessCheck); |
125 bool canAccessInspectedWindow() const; | 122 bool canAccessInspectedWindow() const; |
126 const ScriptValue& injectedScriptObject() const; | 123 const ScriptValue& injectedScriptObject() const; |
127 ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadExcept
ion) const; | 124 ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadExcept
ion) const; |
128 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); | 125 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); |
129 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run
time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown, RefPtr<Typ
eBuilder::Debugger::ExceptionDetails>* = 0); | 126 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run
time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown, RefPtr<Typ
eBuilder::Debugger::ExceptionDetails>* = 0); |
130 void makeCallWithExceptionDetails(ScriptFunctionCall&, RefPtr<JSONValue>* re
sult, RefPtr<TypeBuilder::Debugger::ExceptionDetails>*); | 127 void makeCallWithExceptionDetails(ScriptFunctionCall&, RefPtr<JSONValue>* re
sult, RefPtr<TypeBuilder::Debugger::ExceptionDetails>*); |
131 | 128 |
132 ScriptValue m_injectedScriptObject; | 129 ScriptValue m_injectedScriptObject; |
133 InspectedStateAccessCheck m_inspectedStateAccessCheck; | 130 InspectedStateAccessCheck m_inspectedStateAccessCheck; |
134 RefPtr<InjectedScriptNative> m_native; | 131 RefPtr<InjectedScriptNative> m_native; |
135 int m_contextId; | 132 int m_contextId; |
136 }; | 133 }; |
137 | 134 |
138 } // namespace blink | 135 } // namespace blink |
139 | 136 |
140 #endif | 137 #endif |
OLD | NEW |