Index: Source/core/loader/DocumentThreadableLoader.cpp |
diff --git a/Source/core/loader/DocumentThreadableLoader.cpp b/Source/core/loader/DocumentThreadableLoader.cpp |
index 2840dce77f4d9e26c4eae1e3c59f20864f715df6..dbcf5005fb8038c77e6a5a1e9f683bf86cc66b53 100644 |
--- a/Source/core/loader/DocumentThreadableLoader.cpp |
+++ b/Source/core/loader/DocumentThreadableLoader.cpp |
@@ -76,6 +76,7 @@ DocumentThreadableLoader::DocumentThreadableLoader(Document& document, Threadabl |
, m_simpleRequest(true) |
, m_async(blockingBehavior == LoadAsynchronously) |
, m_timeoutTimer(this, &DocumentThreadableLoader::didTimeout) |
+ , m_requestStarted(0.0) |
{ |
ASSERT(client); |
// Setting an outgoing referer is only supported in the async code path. |
@@ -138,6 +139,24 @@ DocumentThreadableLoader::~DocumentThreadableLoader() |
{ |
} |
+void DocumentThreadableLoader::overrideTimeout(unsigned long timeoutMilliseconds) |
+{ |
+ if (m_async) { |
tyoshino (SeeGerritForStatus)
2014/05/09 08:04:36
if (!m_async)
return;
...
|
+ m_timeoutTimer.stop(); |
+ // At the time of this method's implementation, it is only ever called by |
+ // XMLHttpRequest, when the timeout attribute is set after sending the |
+ // request. |
+ // |
+ // The XHR request says to resolve the time relative to when the request |
+ // was initially sent, however other uses of this method may need to |
+ // behave differently, in which case this should be re-arranged somehow. |
+ if (timeoutMilliseconds) { |
+ double resolvedTime = m_requestStarted + timeoutMilliseconds / 1000.0; |
+ m_timeoutTimer.startOneShotExact(resolvedTime, FROM_HERE); |
tyoshino (SeeGerritForStatus)
2014/05/09 08:04:36
any reason you chose to add this new method to Tim
caitp (gmail)
2014/05/09 08:39:49
For IEEE floating point math, you lose accuracy if
|
+ } |
+ } |
+} |
+ |
void DocumentThreadableLoader::cancel() |
{ |
cancelWithError(ResourceError()); |
@@ -387,6 +406,8 @@ void DocumentThreadableLoader::loadRequest(const ResourceRequest& request) |
ASSERT(m_sameOriginRequest || requestURL.user().isEmpty()); |
ASSERT(m_sameOriginRequest || requestURL.pass().isEmpty()); |
+ m_requestStarted = monotonicallyIncreasingTime(); |
tyoshino (SeeGerritForStatus)
2014/05/09 08:04:36
move this to between L419 and L420 (outside of if-
|
+ |
ThreadableLoaderOptions options = m_options; |
if (m_async) { |
if (m_actualRequest) { |