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

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

Issue 300393002: Merge DevTools Refactor CL to Blink36 (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1985
Patch Set: PTAL Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 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 22 matching lines...) Expand all
33 #include "bindings/common/ScriptState.h" 33 #include "bindings/common/ScriptState.h"
34 #include "wtf/Forward.h" 34 #include "wtf/Forward.h"
35 #include "wtf/HashMap.h" 35 #include "wtf/HashMap.h"
36 #include "wtf/text/WTFString.h" 36 #include "wtf/text/WTFString.h"
37 #include <v8.h> 37 #include <v8.h>
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 class DOMWindow; 41 class DOMWindow;
42 class InjectedScript; 42 class InjectedScript;
43 class V8InjectedScript;
43 class InjectedScriptHost; 44 class InjectedScriptHost;
44 class ScriptObject; 45 class ScriptObject;
45 46
46 class InjectedScriptManager { 47 class InjectedScriptManager {
47 WTF_MAKE_NONCOPYABLE(InjectedScriptManager); WTF_MAKE_FAST_ALLOCATED; 48 WTF_MAKE_NONCOPYABLE(InjectedScriptManager); WTF_MAKE_FAST_ALLOCATED;
48 public: 49 public:
49 static PassOwnPtr<InjectedScriptManager> createForPage(); 50 static PassOwnPtr<InjectedScriptManager> createForPage();
50 static PassOwnPtr<InjectedScriptManager> createForWorker(); 51 static PassOwnPtr<InjectedScriptManager> createForWorker();
51 ~InjectedScriptManager(); 52 ~InjectedScriptManager();
52 53
53 void disconnect(); 54 void disconnect();
54 55
55 InjectedScriptHost* injectedScriptHost(); 56 InjectedScriptHost* injectedScriptHost();
56 57
57 InjectedScript injectedScriptFor(ScriptState*); 58 InjectedScript& injectedScriptFor(ScriptState*);
58 InjectedScript injectedScriptForId(int); 59 InjectedScript& injectedScriptForId(int);
59 int injectedScriptIdFor(ScriptState*); 60 int injectedScriptIdFor(ScriptState*);
60 InjectedScript injectedScriptForObjectId(const String& objectId); 61 InjectedScript& injectedScriptForObjectId(const String& objectId);
61 void discardInjectedScripts(); 62 void discardInjectedScripts();
62 void discardInjectedScriptsFor(DOMWindow*); 63 void discardInjectedScriptsFor(DOMWindow*);
63 void releaseObjectGroup(const String& objectGroup); 64 void releaseObjectGroup(const String& objectGroup);
64 65
65 typedef bool (*InspectedStateAccessCheck)(ScriptState*); 66 typedef bool (*InspectedStateAccessCheck)(ScriptState*);
66 InspectedStateAccessCheck inspectedStateAccessCheck() const { return m_inspe ctedStateAccessCheck; } 67 InspectedStateAccessCheck inspectedStateAccessCheck() const { return m_inspe ctedStateAccessCheck; }
67 68
68 struct CallbackData; 69 struct CallbackData;
69 static void setWeakCallback(const v8::WeakCallbackData<v8::Object, CallbackD ata>&); 70 static void setWeakCallback(const v8::WeakCallbackData<v8::Object, CallbackD ata>&);
71
72 InjectedScript& placeholderInjectedScript();
70 private: 73 private:
71 explicit InjectedScriptManager(InspectedStateAccessCheck); 74 explicit InjectedScriptManager(InspectedStateAccessCheck);
72 75
73 String injectedScriptSource(); 76 String injectedScriptSource();
74 ScriptObject createInjectedScript(const String& source, ScriptState*, int id ); 77 ScriptObject createInjectedScript(const String& source, ScriptState*, int id );
75 78
76 static bool canAccessInspectedWindow(ScriptState*); 79 static bool canAccessInspectedWindow(ScriptState*);
77 static bool canAccessInspectedWorkerGlobalScope(ScriptState*); 80 static bool canAccessInspectedWorkerGlobalScope(ScriptState*);
78 81
79 int m_nextInjectedScriptId; 82 int m_nextInjectedScriptId;
80 typedef HashMap<int, InjectedScript> IdToInjectedScriptMap; 83 // FIXMEDART: use RefPtr<InjectedScript> instead.
84 typedef HashMap<int, InjectedScript*> IdToInjectedScriptMap;
81 IdToInjectedScriptMap m_idToInjectedScript; 85 IdToInjectedScriptMap m_idToInjectedScript;
82 RefPtr<InjectedScriptHost> m_injectedScriptHost; 86 RefPtr<InjectedScriptHost> m_injectedScriptHost;
83 InspectedStateAccessCheck m_inspectedStateAccessCheck; 87 InspectedStateAccessCheck m_inspectedStateAccessCheck;
84 typedef HashMap<RefPtr<ScriptState>, int> ScriptStateToId; 88 typedef HashMap<RefPtr<ScriptState>, int> ScriptStateToId;
85 ScriptStateToId m_scriptStateToId; 89 ScriptStateToId m_scriptStateToId;
90 V8InjectedScript* m_placeholderInjectedScript;
86 }; 91 };
87 92
88 } // namespace WebCore 93 } // namespace WebCore
89 94
90 #endif // !defined(InjectedScriptManager_h) 95 #endif // !defined(InjectedScriptManager_h)
OLDNEW
« no previous file with comments | « Source/core/inspector/InjectedScriptHost.cpp ('k') | Source/core/inspector/InjectedScriptManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698