Changeset 176120 in webkit
- Timestamp:
- Nov 14, 2014 1:21:48 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r176115 r176120 1 2014-11-14 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [SOUP] Use GMainLoopSource for request timeout in ResourceHandle 4 https://bugs.webkit.org/show_bug.cgi?id=138695 5 6 Reviewed by Sergio Villar Senin. 7 8 We are currently using soup_timeout_add() that simply creates a 9 GSource and attaches it to the given context. Using 10 GMainLoopSource we simplify the code and fix any potential problem 11 of converting the double value into milliseconds. 12 13 * platform/network/ResourceHandleInternal.h: 14 * platform/network/soup/ResourceHandleSoup.cpp: 15 (WebCore::cleanupSoupRequestOperation): 16 (WebCore::ResourceHandle::sendPendingRequest): 17 (WebCore::ResourceHandle::platformSetDefersLoading): 18 (WebCore::requestTimeoutCallback): Deleted. 19 1 20 2014-11-13 Tim Horton <timothy_horton@apple.com> 2 21 -
trunk/Source/WebCore/platform/network/ResourceHandleInternal.h
r175719 r176120 52 52 #include "GUniquePtrSoup.h" 53 53 #include <libsoup/soup.h> 54 #include <wtf/gobject/GMainLoopSource.h> 54 55 #include <wtf/gobject/GRefPtr.h> 55 56 #endif … … 197 198 GRefPtr<GCancellable> m_cancellable; 198 199 GRefPtr<GAsyncResult> m_deferredResult; 199 G RefPtr<GSource>m_timeoutSource;200 GMainLoopSource m_timeoutSource; 200 201 GUniquePtr<SoupBuffer> m_soupBuffer; 201 202 unsigned long m_bodySize; -
trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
r174394 r176120 232 232 static void sendRequestCallback(GObject*, GAsyncResult*, gpointer); 233 233 static void readCallback(GObject*, GAsyncResult*, gpointer); 234 static gboolean requestTimeoutCallback(void*);235 234 #if ENABLE(WEB_TIMING) 236 235 static int milisecondsSinceRequest(double requestTime); … … 591 590 } 592 591 593 if (d->m_timeoutSource) { 594 g_source_destroy(d->m_timeoutSource.get()); 595 d->m_timeoutSource.clear(); 596 } 592 d->m_timeoutSource.cancel(); 597 593 598 594 if (!isDestroying) … … 1016 1012 1017 1013 if (d->m_firstRequest.timeoutInterval() > 0) { 1018 // soup_add_timeout returns a GSource* whose only reference is owned by 1019 // the context. We need to have our own reference to it, hence not using adoptRef. 1020 d->m_timeoutSource = soup_add_timeout(g_main_context_get_thread_default(), 1021 d->m_firstRequest.timeoutInterval() * 1000, requestTimeoutCallback, this); 1014 d->m_timeoutSource.scheduleAfterDelay("[WebKit] ResourceHandle request timeout", [this] { 1015 client()->didFail(this, ResourceError::timeoutError(firstRequest().url().string())); 1016 cancel(); 1017 }, std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(d->m_firstRequest.timeoutInterval())), 1018 G_PRIORITY_DEFAULT, nullptr, g_main_context_get_thread_default()); 1022 1019 } 1023 1020 … … 1224 1221 // Except when canceling a possible timeout timer, we only need to take action here to UN-defer loading. 1225 1222 if (defersLoading) { 1226 if (d->m_timeoutSource) { 1227 g_source_destroy(d->m_timeoutSource.get()); 1228 d->m_timeoutSource.clear(); 1229 } 1223 d->m_timeoutSource.cancel(); 1230 1224 return; 1231 1225 } … … 1346 1340 } 1347 1341 1348 static gboolean requestTimeoutCallback(gpointer data)1349 {1350 RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(data);1351 handle->client()->didFail(handle.get(), ResourceError::timeoutError(handle->getInternal()->m_firstRequest.url().string()));1352 handle->cancel();1353 1354 return FALSE;1355 }1356 1357 1342 } 1358 1343
Note: See TracChangeset
for help on using the changeset viewer.