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

Side by Side Diff: third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h

Issue 2098433002: Remove ExecutionContextTask::taskNameForInstrumentation() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 17 matching lines...) Expand all
28 #define MainThreadTaskRunner_h 28 #define MainThreadTaskRunner_h
29 29
30 #include "core/CoreExport.h" 30 #include "core/CoreExport.h"
31 #include "platform/Timer.h" 31 #include "platform/Timer.h"
32 #include "platform/heap/Handle.h" 32 #include "platform/heap/Handle.h"
33 #include "wtf/Allocator.h" 33 #include "wtf/Allocator.h"
34 #include "wtf/Noncopyable.h" 34 #include "wtf/Noncopyable.h"
35 #include "wtf/PtrUtil.h" 35 #include "wtf/PtrUtil.h"
36 #include "wtf/Vector.h" 36 #include "wtf/Vector.h"
37 #include "wtf/WeakPtr.h" 37 #include "wtf/WeakPtr.h"
38 #include "wtf/text/WTFString.h"
38 #include <memory> 39 #include <memory>
39 40
40 namespace blink { 41 namespace blink {
41 42
42 class ExecutionContext; 43 class ExecutionContext;
43 class ExecutionContextTask; 44 class ExecutionContextTask;
44 45
45 class CORE_EXPORT MainThreadTaskRunner final { 46 class CORE_EXPORT MainThreadTaskRunner final {
46 USING_FAST_MALLOC(MainThreadTaskRunner); 47 USING_FAST_MALLOC(MainThreadTaskRunner);
47 WTF_MAKE_NONCOPYABLE(MainThreadTaskRunner); 48 WTF_MAKE_NONCOPYABLE(MainThreadTaskRunner);
48 public: 49 public:
49 static std::unique_ptr<MainThreadTaskRunner> create(ExecutionContext*); 50 static std::unique_ptr<MainThreadTaskRunner> create(ExecutionContext*);
50 51
51 ~MainThreadTaskRunner(); 52 ~MainThreadTaskRunner();
52 53
53 DECLARE_TRACE(); 54 DECLARE_TRACE();
54 55
55 void postTask(const WebTraceLocation&, std::unique_ptr<ExecutionContextTask> ); // Executes the task on context's thread asynchronously. 56 void postTask(const WebTraceLocation&, std::unique_ptr<ExecutionContextTask> , const String& taskNameForInstrumentation = emptyString()); // Executes the tas k on context's thread asynchronously.
56 void postInspectorTask(const WebTraceLocation&, std::unique_ptr<ExecutionCon textTask>); 57 void postInspectorTask(const WebTraceLocation&, std::unique_ptr<ExecutionCon textTask>);
57 void perform(std::unique_ptr<ExecutionContextTask>, bool); 58 void perform(std::unique_ptr<ExecutionContextTask>, bool isInspectorTask, bo ol instrumenting);
58 59
59 void suspend(); 60 void suspend();
60 void resume(); 61 void resume();
61 62
62 private: 63 private:
63 explicit MainThreadTaskRunner(ExecutionContext*); 64 explicit MainThreadTaskRunner(ExecutionContext*);
64 65
65 void pendingTasksTimerFired(Timer<MainThreadTaskRunner>*); 66 void pendingTasksTimerFired(Timer<MainThreadTaskRunner>*);
66 67
67 void postTaskInternal(const WebTraceLocation&, std::unique_ptr<ExecutionCont extTask>, bool isInspectorTask); 68 void postTaskInternal(const WebTraceLocation&, std::unique_ptr<ExecutionCont extTask>, bool isInspectorTask, bool instrumenting);
68 69
69 // Untraced back reference to the owner Document; 70 // Untraced back reference to the owner Document;
70 // this object has identical lifetime to it. 71 // this object has identical lifetime to it.
71 UntracedMember<ExecutionContext> m_context; 72 UntracedMember<ExecutionContext> m_context;
72 Timer<MainThreadTaskRunner> m_pendingTasksTimer; 73 Timer<MainThreadTaskRunner> m_pendingTasksTimer;
73 Vector<std::unique_ptr<ExecutionContextTask>> m_pendingTasks; 74 Vector<std::pair<std::unique_ptr<ExecutionContextTask>, bool /* instrumentin g */>> m_pendingTasks;
74 bool m_suspended; 75 bool m_suspended;
75 WeakPtrFactory<MainThreadTaskRunner> m_weakFactory; 76 WeakPtrFactory<MainThreadTaskRunner> m_weakFactory;
76 }; 77 };
77 78
78 inline std::unique_ptr<MainThreadTaskRunner> MainThreadTaskRunner::create(Execut ionContext* context) 79 inline std::unique_ptr<MainThreadTaskRunner> MainThreadTaskRunner::create(Execut ionContext* context)
79 { 80 {
80 return wrapUnique(new MainThreadTaskRunner(context)); 81 return wrapUnique(new MainThreadTaskRunner(context));
81 } 82 }
82 83
83 } // namespace blink 84 } // namespace blink
84 85
85 #endif 86 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ExecutionContextTask.h ('k') | third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698