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

Side by Side Diff: third_party/WebKit/Source/platform/heap/GCTaskRunner.h

Issue 2080623002: Revert "Remove OwnPtr from Blink." (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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #ifndef GCTaskRunner_h 31 #ifndef GCTaskRunner_h
32 #define GCTaskRunner_h 32 #define GCTaskRunner_h
33 33
34 #include "platform/ThreadSafeFunctional.h" 34 #include "platform/ThreadSafeFunctional.h"
35 #include "platform/heap/ThreadState.h" 35 #include "platform/heap/ThreadState.h"
36 #include "public/platform/WebTaskRunner.h" 36 #include "public/platform/WebTaskRunner.h"
37 #include "public/platform/WebThread.h" 37 #include "public/platform/WebThread.h"
38 #include "public/platform/WebTraceLocation.h" 38 #include "public/platform/WebTraceLocation.h"
39 #include "wtf/PtrUtil.h"
40 #include <memory>
41 39
42 namespace blink { 40 namespace blink {
43 41
44 class MessageLoopInterruptor final : public BlinkGCInterruptor { 42 class MessageLoopInterruptor final : public BlinkGCInterruptor {
45 public: 43 public:
46 explicit MessageLoopInterruptor(WebTaskRunner* taskRunner) : m_taskRunner(ta skRunner) { } 44 explicit MessageLoopInterruptor(WebTaskRunner* taskRunner) : m_taskRunner(ta skRunner) { }
47 45
48 void requestInterrupt() override 46 void requestInterrupt() override
49 { 47 {
50 // GCTask has an empty run() method. Its only purpose is to guarantee 48 // GCTask has an empty run() method. Its only purpose is to guarantee
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 93 }
96 94
97 private: 95 private:
98 int m_nesting; 96 int m_nesting;
99 }; 97 };
100 98
101 class GCTaskRunner final { 99 class GCTaskRunner final {
102 USING_FAST_MALLOC(GCTaskRunner); 100 USING_FAST_MALLOC(GCTaskRunner);
103 public: 101 public:
104 explicit GCTaskRunner(WebThread* thread) 102 explicit GCTaskRunner(WebThread* thread)
105 : m_gcTaskObserver(wrapUnique(new GCTaskObserver)) 103 : m_gcTaskObserver(adoptPtr(new GCTaskObserver))
106 , m_thread(thread) 104 , m_thread(thread)
107 { 105 {
108 m_thread->addTaskObserver(m_gcTaskObserver.get()); 106 m_thread->addTaskObserver(m_gcTaskObserver.get());
109 ThreadState::current()->addInterruptor(wrapUnique(new MessageLoopInterru ptor(thread->getWebTaskRunner()))); 107 ThreadState::current()->addInterruptor(adoptPtr(new MessageLoopInterrupt or(thread->getWebTaskRunner())));
110 } 108 }
111 109
112 ~GCTaskRunner() 110 ~GCTaskRunner()
113 { 111 {
114 m_thread->removeTaskObserver(m_gcTaskObserver.get()); 112 m_thread->removeTaskObserver(m_gcTaskObserver.get());
115 } 113 }
116 114
117 private: 115 private:
118 std::unique_ptr<GCTaskObserver> m_gcTaskObserver; 116 OwnPtr<GCTaskObserver> m_gcTaskObserver;
119 WebThread* m_thread; 117 WebThread* m_thread;
120 }; 118 };
121 119
122 } // namespace blink 120 } // namespace blink
123 121
124 #endif 122 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/test/MockImageDecoder.h ('k') | third_party/WebKit/Source/platform/heap/Heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698