OLD | NEW |
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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 , m_resource(resource) | 109 , m_resource(resource) |
110 , m_removeClientTimer(this, &AddingClient::removeClient) {} | 110 , m_removeClientTimer(this, &AddingClient::removeClient) {} |
111 | 111 |
112 ~AddingClient() override {} | 112 ~AddingClient() override {} |
113 | 113 |
114 // ResourceClient implementation. | 114 // ResourceClient implementation. |
115 virtual void notifyFinished(Resource* resource) | 115 virtual void notifyFinished(Resource* resource) |
116 { | 116 { |
117 // First schedule an asynchronous task to remove the client. | 117 // First schedule an asynchronous task to remove the client. |
118 // We do not expect the client to be called. | 118 // We do not expect the client to be called. |
119 m_removeClientTimer.startOneShot(0, FROM_HERE); | 119 m_removeClientTimer.startOneShot(0, BLINK_FROM_HERE); |
120 resource->addClient(m_dummyClient); | 120 resource->addClient(m_dummyClient); |
121 } | 121 } |
122 void removeClient(Timer<AddingClient>* timer) | 122 void removeClient(Timer<AddingClient>* timer) |
123 { | 123 { |
124 m_resource->removeClient(m_dummyClient); | 124 m_resource->removeClient(m_dummyClient); |
125 } | 125 } |
126 private: | 126 private: |
127 DummyClient* m_dummyClient; | 127 DummyClient* m_dummyClient; |
128 ResourcePtr<Resource> m_resource; | 128 ResourcePtr<Resource> m_resource; |
129 Timer<AddingClient> m_removeClientTimer; | 129 Timer<AddingClient> m_removeClientTimer; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 OwnPtr<DummyClient> dummyClient = adoptPtr(new DummyClient()); | 181 OwnPtr<DummyClient> dummyClient = adoptPtr(new DummyClient()); |
182 OwnPtr<RemovingClient> removingClient = adoptPtr(new RemovingClient(dummyCli
ent.get())); | 182 OwnPtr<RemovingClient> removingClient = adoptPtr(new RemovingClient(dummyCli
ent.get())); |
183 raw->addClient(dummyClient.get()); | 183 raw->addClient(dummyClient.get()); |
184 raw->addClient(removingClient.get()); | 184 raw->addClient(removingClient.get()); |
185 testing::runPendingTasks(); | 185 testing::runPendingTasks(); |
186 EXPECT_FALSE(raw->hasClients()); | 186 EXPECT_FALSE(raw->hasClients()); |
187 } | 187 } |
188 | 188 |
189 } // namespace blink | 189 } // namespace blink |
OLD | NEW |