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

Side by Side Diff: third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp

Issue 2123783002: Expose RunsTasksOnCurrentThread through WebTaskRunner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@00_fix_thread_affinity
Patch Set: rebase Created 4 years, 5 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 explicit TestingPlatformMockWebTaskRunner(Deque<std::unique_ptr<WebTaskRunne r::Task>>* tasks) : m_tasks(tasks) { } 74 explicit TestingPlatformMockWebTaskRunner(Deque<std::unique_ptr<WebTaskRunne r::Task>>* tasks) : m_tasks(tasks) { }
75 ~TestingPlatformMockWebTaskRunner() override { } 75 ~TestingPlatformMockWebTaskRunner() override { }
76 76
77 void postTask(const WebTraceLocation&, Task* task) override 77 void postTask(const WebTraceLocation&, Task* task) override
78 { 78 {
79 m_tasks->append(wrapUnique(task)); 79 m_tasks->append(wrapUnique(task));
80 } 80 }
81 81
82 void postDelayedTask(const WebTraceLocation&, Task*, double delayMs) overrid e 82 void postDelayedTask(const WebTraceLocation&, Task*, double delayMs) overrid e
83 { 83 {
84 ASSERT_NOT_REACHED(); 84 NOTREACHED();
85 }
86
87 bool runsTasksOnCurrentThread() override
88 {
89 NOTREACHED();
90 return true;
85 } 91 }
86 92
87 WebTaskRunner* clone() override 93 WebTaskRunner* clone() override
88 { 94 {
89 return new TestingPlatformMockWebTaskRunner(m_tasks); 95 return new TestingPlatformMockWebTaskRunner(m_tasks);
90 } 96 }
91 97
92 double virtualTimeSeconds() const override 98 double virtualTimeSeconds() const override
93 { 99 {
94 ASSERT_NOT_REACHED(); 100 NOTREACHED();
95 return 0.0; 101 return 0.0;
96 } 102 }
97 103
98 double monotonicallyIncreasingVirtualTimeSeconds() const override 104 double monotonicallyIncreasingVirtualTimeSeconds() const override
99 { 105 {
100 ASSERT_NOT_REACHED(); 106 NOTREACHED();
101 return 0.0; 107 return 0.0;
102 } 108 }
103 109
104 private: 110 private:
105 Deque<std::unique_ptr<WebTaskRunner::Task>>* m_tasks; // NOT OWNED 111 Deque<std::unique_ptr<WebTaskRunner::Task>>* m_tasks; // NOT OWNED
106 }; 112 };
107 113
108 // TestingPlatformMockScheduler definition: 114 // TestingPlatformMockScheduler definition:
109 115
110 TestingPlatformMockScheduler::TestingPlatformMockScheduler() 116 TestingPlatformMockScheduler::TestingPlatformMockScheduler()
(...skipping 30 matching lines...) Expand all
141 TestingPlatformMockWebThread() : m_mockWebScheduler(wrapUnique(new TestingPl atformMockScheduler)) { } 147 TestingPlatformMockWebThread() : m_mockWebScheduler(wrapUnique(new TestingPl atformMockScheduler)) { }
142 ~TestingPlatformMockWebThread() override { } 148 ~TestingPlatformMockWebThread() override { }
143 149
144 WebTaskRunner* getWebTaskRunner() override 150 WebTaskRunner* getWebTaskRunner() override
145 { 151 {
146 return m_mockWebScheduler->timerTaskRunner(); 152 return m_mockWebScheduler->timerTaskRunner();
147 } 153 }
148 154
149 bool isCurrentThread() const override 155 bool isCurrentThread() const override
150 { 156 {
151 ASSERT_NOT_REACHED(); 157 NOTREACHED();
152 return true; 158 return true;
153 } 159 }
154 160
155 WebScheduler* scheduler() const override 161 WebScheduler* scheduler() const override
156 { 162 {
157 return m_mockWebScheduler.get(); 163 return m_mockWebScheduler.get();
158 } 164 }
159 165
160 TestingPlatformMockScheduler* mockWebScheduler() 166 TestingPlatformMockScheduler* mockWebScheduler()
161 { 167 {
(...skipping 19 matching lines...) Expand all
181 { 187 {
182 return m_mockWebThread.get(); 188 return m_mockWebThread.get();
183 } 189 }
184 190
185 TestingPlatformMockScheduler* TestingPlatformSupportWithMockScheduler::mockWebSc heduler() 191 TestingPlatformMockScheduler* TestingPlatformSupportWithMockScheduler::mockWebSc heduler()
186 { 192 {
187 return m_mockWebThread->mockWebScheduler(); 193 return m_mockWebThread->mockWebScheduler();
188 } 194 }
189 195
190 } // namespace blink 196 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698