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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScript.h

Issue 1917733002: [DevTools] Move part of CommandLineAPI to native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 PassOwnPtr<protocol::Runtime::ExceptionDetails> createExceptionDetails(v8::L ocal<v8::Message>); 79 PassOwnPtr<protocol::Runtime::ExceptionDetails> createExceptionDetails(v8::L ocal<v8::Message>);
80 void wrapEvaluateResult(ErrorString*, 80 void wrapEvaluateResult(ErrorString*,
81 v8::MaybeLocal<v8::Value> maybeResultValue, 81 v8::MaybeLocal<v8::Value> maybeResultValue,
82 const v8::TryCatch&, 82 const v8::TryCatch&,
83 const String16& objectGroup, 83 const String16& objectGroup,
84 bool returnByValue, 84 bool returnByValue,
85 bool generatePreview, 85 bool generatePreview,
86 OwnPtr<protocol::Runtime::RemoteObject>* result, 86 OwnPtr<protocol::Runtime::RemoteObject>* result,
87 Maybe<bool>* wasThrown, 87 Maybe<bool>* wasThrown,
88 Maybe<protocol::Runtime::ExceptionDetails>*); 88 Maybe<protocol::Runtime::ExceptionDetails>*);
89 v8::Local<v8::Value> lastEvaluationResult() const;
89 90
90 class Scope { 91 class Scope {
91 public: 92 public:
92 bool initialize(); 93 bool initialize();
93 bool installCommandLineAPI(); 94 bool installCommandLineAPI();
94 bool installRemoteObjectAPI(const String16& objectGroupName); 95 bool installRemoteObjectAPI(const String16& objectGroupName);
95 void ignoreExceptionsAndMuteConsole(); 96 void ignoreExceptionsAndMuteConsole();
96 v8::Local<v8::Context> context() const { return m_context; } 97 v8::Local<v8::Context> context() const { return m_context; }
97 InjectedScript* injectedScript() const { return m_injectedScript; } 98 InjectedScript* injectedScript() const { return m_injectedScript; }
98 const v8::TryCatch& tryCatch() const { return m_tryCatch; } 99 const v8::TryCatch& tryCatch() const { return m_tryCatch; }
99 100
100 protected: 101 protected:
101 Scope(ErrorString*, V8DebuggerImpl*, int contextGroupId); 102 Scope(ErrorString*, V8DebuggerImpl*, int contextGroupId);
102 ~Scope(); 103 ~Scope();
103 virtual void findInjectedScript(V8InspectorSessionImpl*) = 0; 104 virtual void findInjectedScript(V8InspectorSessionImpl*) = 0;
104 105
105 ErrorString* m_errorString; 106 ErrorString* m_errorString;
106 V8DebuggerImpl* m_debugger; 107 V8DebuggerImpl* m_debugger;
107 int m_contextGroupId; 108 int m_contextGroupId;
108 InjectedScript* m_injectedScript; 109 InjectedScript* m_injectedScript;
109 110
110 private: 111 private:
111 void cleanup(); 112 void cleanup();
112 V8DebuggerImpl::PauseOnExceptionsState setPauseOnExceptionsState(V8Debug gerImpl::PauseOnExceptionsState); 113 V8DebuggerImpl::PauseOnExceptionsState setPauseOnExceptionsState(V8Debug gerImpl::PauseOnExceptionsState);
113 v8::MaybeLocal<v8::Object> installGlobalObjectExtension(V8FunctionCall&) ; 114 bool installGlobalObjectExtension(v8::Local<v8::Object>);
114 115
115 v8::HandleScope m_handleScope; 116 v8::HandleScope m_handleScope;
116 v8::TryCatch m_tryCatch; 117 v8::TryCatch m_tryCatch;
117 v8::Local<v8::Context> m_context; 118 v8::Local<v8::Context> m_context;
118 v8::Local<v8::Symbol> m_extensionSymbol; 119 v8::Local<v8::Private> m_extensionPrivate;
119 v8::MaybeLocal<v8::Object> m_global; 120 v8::MaybeLocal<v8::Object> m_global;
120 bool m_ignoreExceptionsAndMuteConsole; 121 bool m_ignoreExceptionsAndMuteConsole;
121 V8DebuggerImpl::PauseOnExceptionsState m_previousPauseOnExceptionsState; 122 V8DebuggerImpl::PauseOnExceptionsState m_previousPauseOnExceptionsState;
122 }; 123 };
123 124
124 class ContextScope: public Scope { 125 class ContextScope: public Scope {
125 PROTOCOL_DISALLOW_COPY(ContextScope); 126 PROTOCOL_DISALLOW_COPY(ContextScope);
126 public: 127 public:
127 ContextScope(ErrorString*, V8DebuggerImpl*, int contextGroupId, int exec utionContextId); 128 ContextScope(ErrorString*, V8DebuggerImpl*, int contextGroupId, int exec utionContextId);
128 ~ContextScope(); 129 ~ContextScope();
(...skipping 24 matching lines...) Expand all
153 size_t frameOrdinal() const { return m_frameOrdinal; } 154 size_t frameOrdinal() const { return m_frameOrdinal; }
154 private: 155 private:
155 void findInjectedScript(V8InspectorSessionImpl*) override; 156 void findInjectedScript(V8InspectorSessionImpl*) override;
156 String16 m_remoteCallFrameId; 157 String16 m_remoteCallFrameId;
157 size_t m_frameOrdinal; 158 size_t m_frameOrdinal;
158 }; 159 };
159 160
160 private: 161 private:
161 InjectedScript(InspectedContext*, v8::Local<v8::Object>, PassOwnPtr<Injected ScriptNative>); 162 InjectedScript(InspectedContext*, v8::Local<v8::Object>, PassOwnPtr<Injected ScriptNative>);
162 bool canAccessInspectedWindow() const; 163 bool canAccessInspectedWindow() const;
163 v8::Local<v8::Value> lastEvaluationResult() const;
164 v8::Local<v8::Value> v8Value() const; 164 v8::Local<v8::Value> v8Value() const;
165 v8::MaybeLocal<v8::Value> wrapValue(ErrorString*, v8::Local<v8::Value>, cons t String16& groupName, bool forceValueType, bool generatePreview) const; 165 v8::MaybeLocal<v8::Value> wrapValue(ErrorString*, v8::Local<v8::Value>, cons t String16& groupName, bool forceValueType, bool generatePreview) const;
166 v8::MaybeLocal<v8::Object> commandLineAPI(ErrorString*);
166 167
167 InspectedContext* m_context; 168 InspectedContext* m_context;
168 v8::Global<v8::Value> m_value; 169 v8::Global<v8::Value> m_value;
169 v8::Global<v8::Value> m_lastEvaluationResult; 170 v8::Global<v8::Value> m_lastEvaluationResult;
170 OwnPtr<InjectedScriptNative> m_native; 171 OwnPtr<InjectedScriptNative> m_native;
172 v8::Global<v8::Object> m_commandLineAPI;
171 }; 173 };
172 174
173 } // namespace blink 175 } // namespace blink
174 176
175 #endif 177 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698