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

Side by Side Diff: Source/core/inspector/InjectedScriptHost.h

Issue 1286343003: DevTools: make InspectorDebuggerAgent aggregate V8DebuggerAgent instead of inheriting (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed dgozman's comments Created 5 years, 4 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) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 27 matching lines...) Expand all
38 #include "wtf/RefCounted.h" 38 #include "wtf/RefCounted.h"
39 #include "wtf/Vector.h" 39 #include "wtf/Vector.h"
40 #include "wtf/text/WTFString.h" 40 #include "wtf/text/WTFString.h"
41 #include <v8.h> 41 #include <v8.h>
42 42
43 namespace blink { 43 namespace blink {
44 44
45 class EventTarget; 45 class EventTarget;
46 class InjectedScriptHostClient; 46 class InjectedScriptHostClient;
47 class InspectorConsoleAgent; 47 class InspectorConsoleAgent;
48 class InspectorDebuggerAgent;
49 class JSONValue; 48 class JSONValue;
50 class ScriptValue; 49 class ScriptValue;
50 class V8DebuggerAgent;
51 class V8Debugger; 51 class V8Debugger;
52 52
53 class EventListenerInfo; 53 class EventListenerInfo;
54 54
55 // SECURITY NOTE: Although the InjectedScriptHost is intended for use solely by the inspector, 55 // SECURITY NOTE: Although the InjectedScriptHost is intended for use solely by the inspector,
56 // a reference to the InjectedScriptHost may be leaked to the page being inspect ed. Thus, the 56 // a reference to the InjectedScriptHost may be leaked to the page being inspect ed. Thus, the
57 // InjectedScriptHost must never implemment methods that have more power over th e page than the 57 // InjectedScriptHost must never implemment methods that have more power over th e page than the
58 // page already has itself (e.g. origin restriction bypasses). 58 // page already has itself (e.g. origin restriction bypasses).
59 59
60 class InjectedScriptHost : public RefCountedWillBeGarbageCollectedFinalized<Inje ctedScriptHost> { 60 class InjectedScriptHost : public RefCountedWillBeGarbageCollectedFinalized<Inje ctedScriptHost> {
61 public: 61 public:
62 static PassRefPtrWillBeRawPtr<InjectedScriptHost> create(); 62 static PassRefPtrWillBeRawPtr<InjectedScriptHost> create();
63 ~InjectedScriptHost(); 63 ~InjectedScriptHost();
64 DECLARE_TRACE(); 64 DECLARE_TRACE();
65 65
66 using InspectCallback = Function<void(PassRefPtr<TypeBuilder::Runtime::Remot eObject>, PassRefPtr<JSONObject>)>; 66 using InspectCallback = Function<void(PassRefPtr<TypeBuilder::Runtime::Remot eObject>, PassRefPtr<JSONObject>)>;
67 67
68 void init(InspectorConsoleAgent* consoleAgent, InspectorDebuggerAgent* debug gerAgent, PassOwnPtr<InspectCallback> inspectCallback, V8Debugger* debugger, Pas sOwnPtr<InjectedScriptHostClient> injectedScriptHostClient) 68 void init(InspectorConsoleAgent* consoleAgent, V8DebuggerAgent* debuggerAgen t, PassOwnPtr<InspectCallback> inspectCallback, V8Debugger* debugger, PassOwnPtr <InjectedScriptHostClient> injectedScriptHostClient)
69 { 69 {
70 m_consoleAgent = consoleAgent; 70 m_consoleAgent = consoleAgent;
71 m_debuggerAgent = debuggerAgent; 71 m_debuggerAgent = debuggerAgent;
72 m_inspectCallback = inspectCallback; 72 m_inspectCallback = inspectCallback;
73 m_debugger = debugger; 73 m_debugger = debugger;
74 m_client = injectedScriptHostClient; 74 m_client = injectedScriptHostClient;
75 } 75 }
76 76
77 static EventTarget* eventTargetFromV8Value(v8::Isolate*, v8::Local<v8::Value >); 77 static EventTarget* eventTargetFromV8Value(v8::Isolate*, v8::Local<v8::Value >);
78 78
(...skipping 23 matching lines...) Expand all
102 InjectedScriptHostClient* client() { return m_client.get(); } 102 InjectedScriptHostClient* client() { return m_client.get(); }
103 103
104 // FIXME: store this template in per isolate data 104 // FIXME: store this template in per isolate data
105 void setWrapperTemplate(v8::Local<v8::FunctionTemplate> wrapperTemplate, v8: :Isolate* isolate) { m_wrapperTemplate.Reset(isolate, wrapperTemplate); } 105 void setWrapperTemplate(v8::Local<v8::FunctionTemplate> wrapperTemplate, v8: :Isolate* isolate) { m_wrapperTemplate.Reset(isolate, wrapperTemplate); }
106 v8::Local<v8::FunctionTemplate> wrapperTemplate(v8::Isolate* isolate) { retu rn v8::Local<v8::FunctionTemplate>::New(isolate, m_wrapperTemplate); } 106 v8::Local<v8::FunctionTemplate> wrapperTemplate(v8::Isolate* isolate) { retu rn v8::Local<v8::FunctionTemplate>::New(isolate, m_wrapperTemplate); }
107 107
108 private: 108 private:
109 InjectedScriptHost(); 109 InjectedScriptHost();
110 110
111 RawPtrWillBeMember<InspectorConsoleAgent> m_consoleAgent; 111 RawPtrWillBeMember<InspectorConsoleAgent> m_consoleAgent;
112 RawPtrWillBeMember<InspectorDebuggerAgent> m_debuggerAgent; 112 RawPtrWillBeMember<V8DebuggerAgent> m_debuggerAgent;
113 OwnPtr<InspectCallback> m_inspectCallback; 113 OwnPtr<InspectCallback> m_inspectCallback;
114 V8Debugger* m_debugger; 114 V8Debugger* m_debugger;
115 WillBeHeapVector<OwnPtrWillBeMember<InspectableObject>> m_inspectedObjects; 115 WillBeHeapVector<OwnPtrWillBeMember<InspectableObject>> m_inspectedObjects;
116 OwnPtrWillBeMember<InspectableObject> m_defaultInspectableObject; 116 OwnPtrWillBeMember<InspectableObject> m_defaultInspectableObject;
117 OwnPtr<InjectedScriptHostClient> m_client; 117 OwnPtr<InjectedScriptHostClient> m_client;
118 v8::Global<v8::FunctionTemplate> m_wrapperTemplate; 118 v8::Global<v8::FunctionTemplate> m_wrapperTemplate;
119 }; 119 };
120 120
121 } // namespace blink 121 } // namespace blink
122 122
123 #endif // InjectedScriptHost_h 123 #endif // InjectedScriptHost_h
OLDNEW
« no previous file with comments | « Source/core/inspector/AsyncCallTracker.cpp ('k') | Source/core/inspector/InjectedScriptHost.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698