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

Side by Side Diff: Source/core/dom/MainThreadTaskRunnerTest.cpp

Issue 336693006: Oilpan: convert remaining OwnPtr EventQueue uses. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | Source/modules/indexeddb/IDBRequestTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2013 Google Inc. All Rights Reserved. 3 * Copyright (C) 2013 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 NullEventQueue() { } 43 NullEventQueue() { }
44 virtual ~NullEventQueue() { } 44 virtual ~NullEventQueue() { }
45 virtual bool enqueueEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE { return t rue; } 45 virtual bool enqueueEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE { return t rue; }
46 virtual bool cancelEvent(Event*) OVERRIDE { return true; } 46 virtual bool cancelEvent(Event*) OVERRIDE { return true; }
47 virtual void close() OVERRIDE { } 47 virtual void close() OVERRIDE { }
48 }; 48 };
49 49
50 class NullExecutionContext : public RefCountedWillBeGarbageCollectedFinalized<Nu llExecutionContext>, public ExecutionContext { 50 class NullExecutionContext : public RefCountedWillBeGarbageCollectedFinalized<Nu llExecutionContext>, public ExecutionContext {
51 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NullExecutionContext); 51 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NullExecutionContext);
52 public: 52 public:
53 void trace(Visitor* visitor) { ExecutionContext::trace(visitor); } 53 NullExecutionContext();
54
55 virtual EventQueue* eventQueue() const OVERRIDE { return m_queue.get(); }
56 virtual bool tasksNeedSuspension() { return m_tasksNeedSuspension; }
57
58 void setTasksNeedSuspention(bool flag) { m_tasksNeedSuspension = flag; }
59
60 void trace(Visitor* visitor)
61 {
62 visitor->trace(m_queue);
63 ExecutionContext::trace(visitor);
64 }
65
54 #if !ENABLE(OILPAN) 66 #if !ENABLE(OILPAN)
55 using RefCounted<NullExecutionContext>::ref; 67 using RefCounted<NullExecutionContext>::ref;
56 using RefCounted<NullExecutionContext>::deref; 68 using RefCounted<NullExecutionContext>::deref;
57 69
58 virtual void refExecutionContext() OVERRIDE { ref(); } 70 virtual void refExecutionContext() OVERRIDE { ref(); }
59 virtual void derefExecutionContext() OVERRIDE { deref(); } 71 virtual void derefExecutionContext() OVERRIDE { deref(); }
60 #endif 72 #endif
61 virtual EventQueue* eventQueue() const OVERRIDE { return m_queue.get(); }
62 virtual bool tasksNeedSuspension() { return m_tasksNeedSuspension; }
63
64 void setTasksNeedSuspention(bool flag) { m_tasksNeedSuspension = flag; }
65
66 NullExecutionContext();
67 73
68 private: 74 private:
69 bool m_tasksNeedSuspension; 75 bool m_tasksNeedSuspension;
70 OwnPtr<EventQueue> m_queue; 76 OwnPtrWillBeMember<EventQueue> m_queue;
71 }; 77 };
72 78
73 NullExecutionContext::NullExecutionContext() 79 NullExecutionContext::NullExecutionContext()
74 : m_tasksNeedSuspension(false) 80 : m_tasksNeedSuspension(false)
75 , m_queue(adoptPtr(new NullEventQueue())) 81 , m_queue(adoptPtrWillBeNoop(new NullEventQueue()))
76 { 82 {
77 } 83 }
78 84
79 class MarkingBooleanTask FINAL : public ExecutionContextTask { 85 class MarkingBooleanTask FINAL : public ExecutionContextTask {
80 public: 86 public:
81 static PassOwnPtr<MarkingBooleanTask> create(bool* toBeMarked) 87 static PassOwnPtr<MarkingBooleanTask> create(bool* toBeMarked)
82 { 88 {
83 return adoptPtr(new MarkingBooleanTask(toBeMarked)); 89 return adoptPtr(new MarkingBooleanTask(toBeMarked));
84 } 90 }
85 91
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 bool isMarked = false; 140 bool isMarked = false;
135 141
136 context->setTasksNeedSuspention(true); 142 context->setTasksNeedSuspention(true);
137 runner->postTask(MarkingBooleanTask::create(&isMarked)); 143 runner->postTask(MarkingBooleanTask::create(&isMarked));
138 runner.clear(); 144 runner.clear();
139 WebCore::testing::runPendingTasks(); 145 WebCore::testing::runPendingTasks();
140 EXPECT_FALSE(isMarked); 146 EXPECT_FALSE(isMarked);
141 } 147 }
142 148
143 } 149 }
OLDNEW
« no previous file with comments | « no previous file | Source/modules/indexeddb/IDBRequestTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698