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

Side by Side Diff: third_party/WebKit/Source/web/AssociatedURLLoader.cpp

Issue 2191533003: Refactor Timer classes in preparation for landing FrameTimers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android build fix Created 4 years, 4 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) 2010, 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2010, 2011, 2012 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 WebURLLoaderClient* releaseClient() 106 WebURLLoaderClient* releaseClient()
107 { 107 {
108 WebURLLoaderClient* client = m_client; 108 WebURLLoaderClient* client = m_client;
109 m_client = nullptr; 109 m_client = nullptr;
110 return client; 110 return client;
111 } 111 }
112 112
113 private: 113 private:
114 ClientAdapter(AssociatedURLLoader*, WebURLLoaderClient*, const WebURLLoaderO ptions&); 114 ClientAdapter(AssociatedURLLoader*, WebURLLoaderClient*, const WebURLLoaderO ptions&);
115 115
116 void notifyError(Timer<ClientAdapter>*); 116 void notifyError(TimerBase*);
117 117
118 AssociatedURLLoader* m_loader; 118 AssociatedURLLoader* m_loader;
119 WebURLLoaderClient* m_client; 119 WebURLLoaderClient* m_client;
120 WebURLLoaderOptions m_options; 120 WebURLLoaderOptions m_options;
121 WebURLError m_error; 121 WebURLError m_error;
122 122
123 Timer<ClientAdapter> m_errorTimer; 123 Timer<ClientAdapter> m_errorTimer;
124 bool m_enableErrorNotifications; 124 bool m_enableErrorNotifications;
125 bool m_didFail; 125 bool m_didFail;
126 }; 126 };
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 void AssociatedURLLoader::ClientAdapter::enableErrorNotifications() 252 void AssociatedURLLoader::ClientAdapter::enableErrorNotifications()
253 { 253 {
254 m_enableErrorNotifications = true; 254 m_enableErrorNotifications = true;
255 // If an error has already been received, start a timer to report it to the client 255 // If an error has already been received, start a timer to report it to the client
256 // after AssociatedURLLoader::loadAsynchronously has returned to the caller. 256 // after AssociatedURLLoader::loadAsynchronously has returned to the caller.
257 if (m_didFail) 257 if (m_didFail)
258 m_errorTimer.startOneShot(0, BLINK_FROM_HERE); 258 m_errorTimer.startOneShot(0, BLINK_FROM_HERE);
259 } 259 }
260 260
261 void AssociatedURLLoader::ClientAdapter::notifyError(Timer<ClientAdapter>* timer ) 261 void AssociatedURLLoader::ClientAdapter::notifyError(TimerBase* timer)
262 { 262 {
263 ASSERT_UNUSED(timer, timer == &m_errorTimer); 263 ASSERT_UNUSED(timer, timer == &m_errorTimer);
264 264
265 if (!m_client) 265 if (!m_client)
266 return; 266 return;
267 267
268 releaseClient()->didFail(m_loader, m_error); 268 releaseClient()->didFail(m_loader, m_error);
269 // |this| may be dead here. 269 // |this| may be dead here.
270 } 270 }
271 271
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 // there could be a WebURLLoader instance behind the 452 // there could be a WebURLLoader instance behind the
453 // DocumentThreadableLoader instance. So, for safety, we chose to just 453 // DocumentThreadableLoader instance. So, for safety, we chose to just
454 // crash here. 454 // crash here.
455 RELEASE_ASSERT(ThreadState::current()); 455 RELEASE_ASSERT(ThreadState::current());
456 456
457 m_observer->dispose(); 457 m_observer->dispose();
458 m_observer = nullptr; 458 m_observer = nullptr;
459 } 459 }
460 460
461 } // namespace blink 461 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698