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

Unified Diff: third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h

Issue 1938313003: Move MainThreadTaskRunner off Oilpan heap to simplify posting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h
diff --git a/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h b/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h
index efcc7dc33c4506361dfee89c1daf1cdb8454da7c..0bdd69f0088ff6ac54b83ddf0df64a961d5e41c7 100644
--- a/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h
+++ b/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h
@@ -35,16 +35,18 @@
#include "wtf/OwnPtr.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/Vector.h"
+#include "wtf/WeakPtr.h"
namespace blink {
class ExecutionContext;
class ExecutionContextTask;
-class CORE_EXPORT MainThreadTaskRunner final : public GarbageCollectedFinalized<MainThreadTaskRunner> {
+class CORE_EXPORT MainThreadTaskRunner final {
+ USING_FAST_MALLOC(MainThreadTaskRunner);
WTF_MAKE_NONCOPYABLE(MainThreadTaskRunner);
public:
- static MainThreadTaskRunner* create(ExecutionContext*);
+ static PassOwnPtr<MainThreadTaskRunner> create(ExecutionContext*);
~MainThreadTaskRunner();
@@ -64,15 +66,18 @@ private:
void postTaskInternal(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>, bool isInspectorTask);
- Member<ExecutionContext> m_context;
+ // Untraced back reference to the owner Document;
+ // this object has identical lifetime to it.
+ UntracedMember<ExecutionContext> m_context;
Timer<MainThreadTaskRunner> m_pendingTasksTimer;
Vector<OwnPtr<ExecutionContextTask>> m_pendingTasks;
bool m_suspended;
+ WeakPtrFactory<MainThreadTaskRunner> m_weakFactory;
};
-inline MainThreadTaskRunner* MainThreadTaskRunner::create(ExecutionContext* context)
+inline PassOwnPtr<MainThreadTaskRunner> MainThreadTaskRunner::create(ExecutionContext* context)
{
- return new MainThreadTaskRunner(context);
+ return adoptPtr(new MainThreadTaskRunner(context));
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698