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

Unified Diff: third_party/WebKit/Source/core/fetch/RawResourceTest.cpp

Issue 2631093004: RawResourceTest: Use loadingTaskRunner to be balanced with Resource (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/fetch/RawResourceTest.cpp
diff --git a/third_party/WebKit/Source/core/fetch/RawResourceTest.cpp b/third_party/WebKit/Source/core/fetch/RawResourceTest.cpp
index 501cf024d12c73dc557b38bc81ce7b6430725225..acc22a82e4bd44f72c5a3a69abd8ce99a373dff2 100644
--- a/third_party/WebKit/Source/core/fetch/RawResourceTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/RawResourceTest.cpp
@@ -146,24 +146,26 @@ class AddingClient final : public GarbageCollectedFinalized<AddingClient>,
public:
AddingClient(DummyClient* client, Resource* resource)
- : m_dummyClient(client),
- m_resource(resource),
- m_removeClientTimer(this, &AddingClient::removeClient) {}
+ : m_dummyClient(client), m_resource(resource) {}
~AddingClient() override {}
// ResourceClient implementation.
void notifyFinished(Resource* resource) override {
// First schedule an asynchronous task to remove the client.
- // We do not expect the client to be called.
- m_removeClientTimer.startOneShot(0, BLINK_FROM_HERE);
+ // We do not expect a client to be called if the client is removed before
+ // a callback invocation task queued inside addClient() is scheduled.
+ Platform::current()
+ ->currentThread()
+ ->scheduler()
+ ->loadingTaskRunner()
+ ->postTask(BLINK_FROM_HERE, WTF::bind(&AddingClient::removeClient,
+ wrapPersistent(this)));
resource->addClient(m_dummyClient);
}
String debugName() const override { return "AddingClient"; }
- void removeClient(TimerBase* timer) {
- m_resource->removeClient(m_dummyClient);
- }
+ void removeClient() { m_resource->removeClient(m_dummyClient); }
DEFINE_INLINE_VIRTUAL_TRACE() {
visitor->trace(m_dummyClient);
@@ -174,7 +176,6 @@ class AddingClient final : public GarbageCollectedFinalized<AddingClient>,
private:
Member<DummyClient> m_dummyClient;
Member<Resource> m_resource;
- Timer<AddingClient> m_removeClientTimer;
};
TEST(RawResourceTest, RevalidationSucceeded) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698