Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/WebKit/Source/core/inspector/InjectedScript.h

Issue 1622213002: DevTools: make InjectedScript heap-allocated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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();
sof 2016/01/24 08:05:32 USING_FAST_MALLOC(InjectedScript); ?
sof 2016/01/25 18:59:12 Not following up on this one?
pfeldman 2016/01/25 19:02:41 I absolutely have to! Why allocating this rare obj
54 public: 52 public:
55 InjectedScript(); 53 InjectedScript();
56 ~InjectedScript(); 54 ~InjectedScript();
57 55
58 bool isEmpty() const { return m_injectedScriptObject.isEmpty(); }
59 ScriptState* scriptState() const 56 ScriptState* scriptState() const
60 { 57 {
61 ASSERT(!isEmpty()); 58 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,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698