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

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

Issue 1040703002: Oilpan: avoid InjectedScriptManager::CallbackData-induced leaks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add explicit dispose() Created 5 years, 9 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) 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 29 matching lines...) Expand all
40 40
41 class InjectedScript; 41 class InjectedScript;
42 class InjectedScriptHost; 42 class InjectedScriptHost;
43 class InjectedScriptNative; 43 class InjectedScriptNative;
44 class ScriptValue; 44 class ScriptValue;
45 45
46 class InjectedScriptManager : public NoBaseWillBeGarbageCollectedFinalized<Injec tedScriptManager> { 46 class InjectedScriptManager : public NoBaseWillBeGarbageCollectedFinalized<Injec tedScriptManager> {
47 WTF_MAKE_NONCOPYABLE(InjectedScriptManager); 47 WTF_MAKE_NONCOPYABLE(InjectedScriptManager);
48 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(InjectedScriptManager); 48 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(InjectedScriptManager);
49 public: 49 public:
50 struct CallbackData { 50 class CallbackData final : public NoBaseWillBeGarbageCollectedFinalized<Call backData> {
51 public:
52 static PassOwnPtrWillBeRawPtr<CallbackData> create(InjectedScriptManager *);
53 void dispose();
54 DECLARE_TRACE();
55
51 ScopedPersistent<v8::Object> handle; 56 ScopedPersistent<v8::Object> handle;
52 RefPtrWillBePersistent<InjectedScriptHost> host; 57 RefPtrWillBeMember<InjectedScriptHost> host;
53 InjectedScriptManager* injectedScriptManager; 58 RawPtrWillBeMember<InjectedScriptManager> injectedScriptManager;
59 private:
60 explicit CallbackData(InjectedScriptManager*);
54 }; 61 };
55 62
56 static PassOwnPtrWillBeRawPtr<InjectedScriptManager> createForPage(); 63 static PassOwnPtrWillBeRawPtr<InjectedScriptManager> createForPage();
57 static PassOwnPtrWillBeRawPtr<InjectedScriptManager> createForWorker(); 64 static PassOwnPtrWillBeRawPtr<InjectedScriptManager> createForWorker();
58 ~InjectedScriptManager(); 65 ~InjectedScriptManager();
59 DECLARE_TRACE(); 66 DECLARE_TRACE();
60 67
61 void disconnect(); 68 void disconnect();
62 69
63 InjectedScriptHost* injectedScriptHost(); 70 InjectedScriptHost* injectedScriptHost();
(...skipping 23 matching lines...) Expand all
87 static bool canAccessInspectedWindow(ScriptState*); 94 static bool canAccessInspectedWindow(ScriptState*);
88 static bool canAccessInspectedWorkerGlobalScope(ScriptState*); 95 static bool canAccessInspectedWorkerGlobalScope(ScriptState*);
89 96
90 int m_nextInjectedScriptId; 97 int m_nextInjectedScriptId;
91 typedef HashMap<int, InjectedScript> IdToInjectedScriptMap; 98 typedef HashMap<int, InjectedScript> IdToInjectedScriptMap;
92 IdToInjectedScriptMap m_idToInjectedScript; 99 IdToInjectedScriptMap m_idToInjectedScript;
93 RefPtrWillBeMember<InjectedScriptHost> m_injectedScriptHost; 100 RefPtrWillBeMember<InjectedScriptHost> m_injectedScriptHost;
94 InspectedStateAccessCheck m_inspectedStateAccessCheck; 101 InspectedStateAccessCheck m_inspectedStateAccessCheck;
95 typedef HashMap<RefPtr<ScriptState>, int> ScriptStateToId; 102 typedef HashMap<RefPtr<ScriptState>, int> ScriptStateToId;
96 ScriptStateToId m_scriptStateToId; 103 ScriptStateToId m_scriptStateToId;
97 HashSet<OwnPtr<CallbackData> > m_callbackDataSet; 104 WillBeHeapHashSet<OwnPtrWillBeMember<CallbackData>> m_callbackDataSet;
98 bool m_customObjectFormatterEnabled; 105 bool m_customObjectFormatterEnabled;
99 }; 106 };
100 107
101 } // namespace blink 108 } // namespace blink
102 109
103 #endif // !defined(InjectedScriptManager_h) 110 #endif // !defined(InjectedScriptManager_h)
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp ('k') | Source/core/inspector/InjectedScriptManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698