Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 21 matching lines...) Expand all Loading... | |
| 32 | 32 |
| 33 #include "bindings/v8/ScriptState.h" | 33 #include "bindings/v8/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 | 37 |
| 38 namespace WebCore { | 38 namespace WebCore { |
| 39 | 39 |
| 40 class DOMWindow; | 40 class DOMWindow; |
| 41 class InjectedScript; | 41 class InjectedScript; |
| 42 class V8InjectedScript; | |
| 42 class InjectedScriptHost; | 43 class InjectedScriptHost; |
| 43 class ScriptObject; | 44 class ScriptObject; |
| 44 | 45 |
| 45 class InjectedScriptManager { | 46 class InjectedScriptManager { |
| 46 WTF_MAKE_NONCOPYABLE(InjectedScriptManager); WTF_MAKE_FAST_ALLOCATED; | 47 WTF_MAKE_NONCOPYABLE(InjectedScriptManager); WTF_MAKE_FAST_ALLOCATED; |
| 47 public: | 48 public: |
| 48 static PassOwnPtr<InjectedScriptManager> createForPage(); | 49 static PassOwnPtr<InjectedScriptManager> createForPage(); |
| 49 static PassOwnPtr<InjectedScriptManager> createForWorker(); | 50 static PassOwnPtr<InjectedScriptManager> createForWorker(); |
| 50 ~InjectedScriptManager(); | 51 ~InjectedScriptManager(); |
| 51 | 52 |
| 52 void disconnect(); | 53 void disconnect(); |
| 53 | 54 |
| 54 InjectedScriptHost* injectedScriptHost(); | 55 InjectedScriptHost* injectedScriptHost(); |
| 55 | 56 |
| 56 InjectedScript injectedScriptFor(ScriptState*); | 57 InjectedScript& injectedScriptFor(ScriptState*); |
|
vsm
2014/06/03 14:24:49
Rather than making these changes, you might try Ry
| |
| 57 InjectedScript injectedScriptForId(int); | 58 InjectedScript& injectedScriptForId(int); |
| 58 int injectedScriptIdFor(ScriptState*); | 59 int injectedScriptIdFor(ScriptState*); |
| 59 InjectedScript injectedScriptForObjectId(const String& objectId); | 60 InjectedScript& injectedScriptForObjectId(const String& objectId); |
| 60 void discardInjectedScripts(); | 61 void discardInjectedScripts(); |
| 61 void discardInjectedScriptsFor(DOMWindow*); | 62 void discardInjectedScriptsFor(DOMWindow*); |
| 62 void releaseObjectGroup(const String& objectGroup); | 63 void releaseObjectGroup(const String& objectGroup); |
| 63 | 64 |
| 64 typedef bool (*InspectedStateAccessCheck)(ScriptState*); | 65 typedef bool (*InspectedStateAccessCheck)(ScriptState*); |
| 65 InspectedStateAccessCheck inspectedStateAccessCheck() const { return m_inspe ctedStateAccessCheck; } | 66 InspectedStateAccessCheck inspectedStateAccessCheck() const { return m_inspe ctedStateAccessCheck; } |
| 66 | 67 |
| 67 struct CallbackData; | 68 struct CallbackData; |
| 68 static void setWeakCallback(const v8::WeakCallbackData<v8::Object, CallbackD ata>&); | 69 static void setWeakCallback(const v8::WeakCallbackData<v8::Object, CallbackD ata>&); |
| 70 | |
| 71 InjectedScript& placeholderInjectedScript(); | |
| 69 private: | 72 private: |
| 70 explicit InjectedScriptManager(InspectedStateAccessCheck); | 73 explicit InjectedScriptManager(InspectedStateAccessCheck); |
| 71 | 74 |
| 72 String injectedScriptSource(); | 75 String injectedScriptSource(); |
| 73 ScriptObject createInjectedScript(const String& source, ScriptState*, int id ); | 76 ScriptObject createInjectedScript(const String& source, ScriptState*, int id ); |
| 74 | 77 |
| 75 static bool canAccessInspectedWindow(ScriptState*); | 78 static bool canAccessInspectedWindow(ScriptState*); |
| 76 static bool canAccessInspectedWorkerGlobalScope(ScriptState*); | 79 static bool canAccessInspectedWorkerGlobalScope(ScriptState*); |
| 77 | 80 |
| 78 int m_nextInjectedScriptId; | 81 int m_nextInjectedScriptId; |
| 79 typedef HashMap<int, InjectedScript> IdToInjectedScriptMap; | 82 // FIXMEDART: use RefPtr<InjectedScript> instead. |
| 83 typedef HashMap<int, InjectedScript*> IdToInjectedScriptMap; | |
| 80 IdToInjectedScriptMap m_idToInjectedScript; | 84 IdToInjectedScriptMap m_idToInjectedScript; |
| 81 RefPtr<InjectedScriptHost> m_injectedScriptHost; | 85 RefPtr<InjectedScriptHost> m_injectedScriptHost; |
| 82 InspectedStateAccessCheck m_inspectedStateAccessCheck; | 86 InspectedStateAccessCheck m_inspectedStateAccessCheck; |
| 83 typedef HashMap<RefPtr<ScriptState>, int> ScriptStateToId; | 87 typedef HashMap<RefPtr<ScriptState>, int> ScriptStateToId; |
| 84 ScriptStateToId m_scriptStateToId; | 88 ScriptStateToId m_scriptStateToId; |
| 89 V8InjectedScript* m_placeholderInjectedScript; | |
| 85 }; | 90 }; |
| 86 | 91 |
| 87 } // namespace WebCore | 92 } // namespace WebCore |
| 88 | 93 |
| 89 #endif // !defined(InjectedScriptManager_h) | 94 #endif // !defined(InjectedScriptManager_h) |
| OLD | NEW |