| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 class InjectedScript; | 42 class InjectedScript; |
| 43 class InjectedScriptHost; | 43 class InjectedScriptHost; |
| 44 class InjectedScriptNative; | 44 class InjectedScriptNative; |
| 45 class ScriptValue; | 45 class ScriptValue; |
| 46 | 46 |
| 47 class CORE_EXPORT InjectedScriptManager : public NoBaseWillBeGarbageCollectedFin
alized<InjectedScriptManager> { | 47 class CORE_EXPORT InjectedScriptManager : public NoBaseWillBeGarbageCollectedFin
alized<InjectedScriptManager> { |
| 48 WTF_MAKE_NONCOPYABLE(InjectedScriptManager); | 48 WTF_MAKE_NONCOPYABLE(InjectedScriptManager); |
| 49 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(InjectedScriptManager); | 49 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(InjectedScriptManager); |
| 50 public: | 50 public: |
| 51 class CallbackData final : public NoBaseWillBeGarbageCollectedFinalized<Call
backData> { | |
| 52 public: | |
| 53 static PassOwnPtrWillBeRawPtr<CallbackData> create(InjectedScriptManager
*); | |
| 54 void dispose(); | |
| 55 DECLARE_TRACE(); | |
| 56 | |
| 57 ScopedPersistent<v8::Object> handle; | |
| 58 RefPtrWillBeMember<InjectedScriptHost> host; | |
| 59 RawPtrWillBeMember<InjectedScriptManager> injectedScriptManager; | |
| 60 private: | |
| 61 explicit CallbackData(InjectedScriptManager*); | |
| 62 }; | |
| 63 | |
| 64 static PassOwnPtrWillBeRawPtr<InjectedScriptManager> createForPage(); | 51 static PassOwnPtrWillBeRawPtr<InjectedScriptManager> createForPage(); |
| 65 static PassOwnPtrWillBeRawPtr<InjectedScriptManager> createForWorker(); | 52 static PassOwnPtrWillBeRawPtr<InjectedScriptManager> createForWorker(); |
| 66 ~InjectedScriptManager(); | 53 ~InjectedScriptManager(); |
| 67 DECLARE_TRACE(); | 54 DECLARE_TRACE(); |
| 68 | 55 |
| 69 void disconnect(); | 56 void disconnect(); |
| 70 | 57 |
| 71 InjectedScriptHost* injectedScriptHost(); | 58 InjectedScriptHost* injectedScriptHost(); |
| 72 | 59 |
| 73 InjectedScript injectedScriptFor(ScriptState*); | 60 InjectedScript injectedScriptFor(ScriptState*); |
| 74 InjectedScript injectedScriptForId(int); | 61 InjectedScript injectedScriptForId(int); |
| 75 int injectedScriptIdFor(ScriptState*); | 62 int injectedScriptIdFor(ScriptState*); |
| 76 InjectedScript injectedScriptForObjectId(const String& objectId); | 63 InjectedScript injectedScriptForObjectId(const String& objectId); |
| 77 void discardInjectedScripts(); | 64 void discardInjectedScripts(); |
| 78 void discardInjectedScriptFor(ScriptState*); | 65 void discardInjectedScriptFor(ScriptState*); |
| 79 void releaseObjectGroup(const String& objectGroup); | 66 void releaseObjectGroup(const String& objectGroup); |
| 80 | 67 |
| 81 typedef bool (*InspectedStateAccessCheck)(ScriptState*); | 68 typedef bool (*InspectedStateAccessCheck)(ScriptState*); |
| 82 InspectedStateAccessCheck inspectedStateAccessCheck() const { return m_inspe
ctedStateAccessCheck; } | 69 InspectedStateAccessCheck inspectedStateAccessCheck() const { return m_inspe
ctedStateAccessCheck; } |
| 83 | 70 |
| 84 static void setWeakCallback(const v8::WeakCallbackInfo<CallbackData>&); | |
| 85 CallbackData* createCallbackData(); | |
| 86 void removeCallbackData(CallbackData*); | |
| 87 void setCustomObjectFormatterEnabled(bool); | 71 void setCustomObjectFormatterEnabled(bool); |
| 88 | 72 |
| 89 private: | 73 private: |
| 90 explicit InjectedScriptManager(InspectedStateAccessCheck); | 74 explicit InjectedScriptManager(InspectedStateAccessCheck); |
| 91 | 75 |
| 92 String injectedScriptSource(); | 76 String injectedScriptSource(); |
| 93 ScriptValue createInjectedScript(const String& source, ScriptState*, int id,
InjectedScriptNative*); | 77 ScriptValue createInjectedScript(const String& source, ScriptState*, int id,
InjectedScriptNative*); |
| 94 | 78 |
| 95 static bool canAccessInspectedWindow(ScriptState*); | 79 static bool canAccessInspectedWindow(ScriptState*); |
| 96 static bool canAccessInspectedWorkerGlobalScope(ScriptState*); | 80 static bool canAccessInspectedWorkerGlobalScope(ScriptState*); |
| 97 | 81 |
| 98 int m_nextInjectedScriptId; | 82 int m_nextInjectedScriptId; |
| 99 typedef HashMap<int, InjectedScript> IdToInjectedScriptMap; | 83 typedef HashMap<int, InjectedScript> IdToInjectedScriptMap; |
| 100 IdToInjectedScriptMap m_idToInjectedScript; | 84 IdToInjectedScriptMap m_idToInjectedScript; |
| 101 RefPtrWillBeMember<InjectedScriptHost> m_injectedScriptHost; | 85 RefPtrWillBeMember<InjectedScriptHost> m_injectedScriptHost; |
| 102 InspectedStateAccessCheck m_inspectedStateAccessCheck; | 86 InspectedStateAccessCheck m_inspectedStateAccessCheck; |
| 103 typedef HashMap<RefPtr<ScriptState>, int> ScriptStateToId; | 87 typedef HashMap<RefPtr<ScriptState>, int> ScriptStateToId; |
| 104 ScriptStateToId m_scriptStateToId; | 88 ScriptStateToId m_scriptStateToId; |
| 105 WillBeHeapHashSet<OwnPtrWillBeMember<CallbackData>> m_callbackDataSet; | |
| 106 bool m_customObjectFormatterEnabled; | 89 bool m_customObjectFormatterEnabled; |
| 107 }; | 90 }; |
| 108 | 91 |
| 109 } // namespace blink | 92 } // namespace blink |
| 110 | 93 |
| 111 #endif // !defined(InjectedScriptManager_h) | 94 #endif // !defined(InjectedScriptManager_h) |
| OLD | NEW |