OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013, Intel Corporation | 3 * Copyright (C) 2013, Intel Corporation |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 namespace blink { | 62 namespace blink { |
63 | 63 |
64 namespace { | 64 namespace { |
65 | 65 |
66 class EmptyDataHandle final : public WebDataConsumerHandle { | 66 class EmptyDataHandle final : public WebDataConsumerHandle { |
67 private: | 67 private: |
68 class EmptyDataReader final : public WebDataConsumerHandle::Reader { | 68 class EmptyDataReader final : public WebDataConsumerHandle::Reader { |
69 public: | 69 public: |
70 explicit EmptyDataReader(WebDataConsumerHandle::Client* client) : m_fact
ory(this) | 70 explicit EmptyDataReader(WebDataConsumerHandle::Client* client) : m_fact
ory(this) |
71 { | 71 { |
72 Platform::current()->currentThread()->taskRunner()->postTask(FROM_HE
RE, new Task(bind(&EmptyDataReader::notify, m_factory.createWeakPtr(), client)))
; | 72 Platform::current()->currentThread()->taskRunner()->postTask(BLINK_F
ROM_HERE, new Task(bind(&EmptyDataReader::notify, m_factory.createWeakPtr(), cli
ent))); |
73 } | 73 } |
74 private: | 74 private: |
75 Result read(void*, size_t, WebDataConsumerHandle::Flags, size_t *readSiz
e) override | 75 Result read(void*, size_t, WebDataConsumerHandle::Flags, size_t *readSiz
e) override |
76 { | 76 { |
77 *readSize = 0; | 77 *readSize = 0; |
78 return Done; | 78 return Done; |
79 } | 79 } |
80 Result beginRead(const void** buffer, WebDataConsumerHandle::Flags, size
_t *available) override | 80 Result beginRead(const void** buffer, WebDataConsumerHandle::Flags, size
_t *available) override |
81 { | 81 { |
82 *available = 0; | 82 *available = 0; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 // XMLHttpRequest, when the timeout attribute is set after sending the | 289 // XMLHttpRequest, when the timeout attribute is set after sending the |
290 // request. | 290 // request. |
291 // | 291 // |
292 // The XHR request says to resolve the time relative to when the request | 292 // The XHR request says to resolve the time relative to when the request |
293 // was initially sent, however other uses of this method may need to | 293 // was initially sent, however other uses of this method may need to |
294 // behave differently, in which case this should be re-arranged somehow. | 294 // behave differently, in which case this should be re-arranged somehow. |
295 if (timeoutMilliseconds) { | 295 if (timeoutMilliseconds) { |
296 double elapsedTime = monotonicallyIncreasingTime() - m_requestStartedSec
onds; | 296 double elapsedTime = monotonicallyIncreasingTime() - m_requestStartedSec
onds; |
297 double nextFire = timeoutMilliseconds / 1000.0; | 297 double nextFire = timeoutMilliseconds / 1000.0; |
298 double resolvedTime = std::max(nextFire - elapsedTime, 0.0); | 298 double resolvedTime = std::max(nextFire - elapsedTime, 0.0); |
299 m_timeoutTimer.startOneShot(resolvedTime, FROM_HERE); | 299 m_timeoutTimer.startOneShot(resolvedTime, BLINK_FROM_HERE); |
300 } | 300 } |
301 } | 301 } |
302 | 302 |
303 void DocumentThreadableLoader::cancel() | 303 void DocumentThreadableLoader::cancel() |
304 { | 304 { |
305 cancelWithError(ResourceError()); | 305 cancelWithError(ResourceError()); |
306 // |this| may be dead here. | 306 // |this| may be dead here. |
307 } | 307 } |
308 | 308 |
309 void DocumentThreadableLoader::cancelWithError(const ResourceError& error) | 309 void DocumentThreadableLoader::cancelWithError(const ResourceError& error) |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 | 768 |
769 // Update resourceLoaderOptions with enforced values. | 769 // Update resourceLoaderOptions with enforced values. |
770 if (m_forceDoNotAllowStoredCredentials) | 770 if (m_forceDoNotAllowStoredCredentials) |
771 resourceLoaderOptions.allowCredentials = DoNotAllowStoredCredentials; | 771 resourceLoaderOptions.allowCredentials = DoNotAllowStoredCredentials; |
772 resourceLoaderOptions.securityOrigin = m_securityOrigin; | 772 resourceLoaderOptions.securityOrigin = m_securityOrigin; |
773 if (m_async) { | 773 if (m_async) { |
774 if (m_actualRequest) | 774 if (m_actualRequest) |
775 resourceLoaderOptions.dataBufferingPolicy = BufferData; | 775 resourceLoaderOptions.dataBufferingPolicy = BufferData; |
776 | 776 |
777 if (m_options.timeoutMilliseconds > 0) | 777 if (m_options.timeoutMilliseconds > 0) |
778 m_timeoutTimer.startOneShot(m_options.timeoutMilliseconds / 1000.0,
FROM_HERE); | 778 m_timeoutTimer.startOneShot(m_options.timeoutMilliseconds / 1000.0,
BLINK_FROM_HERE); |
779 | 779 |
780 FetchRequest newRequest(request, m_options.initiator, resourceLoaderOpti
ons); | 780 FetchRequest newRequest(request, m_options.initiator, resourceLoaderOpti
ons); |
781 if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests) | 781 if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests) |
782 newRequest.setOriginRestriction(FetchRequest::NoOriginRestriction); | 782 newRequest.setOriginRestriction(FetchRequest::NoOriginRestriction); |
783 ASSERT(!resource()); | 783 ASSERT(!resource()); |
784 if (request.requestContext() == WebURLRequest::RequestContextVideo || re
quest.requestContext() == WebURLRequest::RequestContextAudio) | 784 if (request.requestContext() == WebURLRequest::RequestContextVideo || re
quest.requestContext() == WebURLRequest::RequestContextAudio) |
785 setResource(RawResource::fetchMedia(newRequest, m_document.fetcher()
)); | 785 setResource(RawResource::fetchMedia(newRequest, m_document.fetcher()
)); |
786 else | 786 else |
787 setResource(RawResource::fetch(newRequest, m_document.fetcher())); | 787 setResource(RawResource::fetch(newRequest, m_document.fetcher())); |
788 if (resource() && resource()->loader()) { | 788 if (resource() && resource()->loader()) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 return DoNotAllowStoredCredentials; | 865 return DoNotAllowStoredCredentials; |
866 return m_resourceLoaderOptions.allowCredentials; | 866 return m_resourceLoaderOptions.allowCredentials; |
867 } | 867 } |
868 | 868 |
869 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const | 869 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const |
870 { | 870 { |
871 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin
(); | 871 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin
(); |
872 } | 872 } |
873 | 873 |
874 } // namespace blink | 874 } // namespace blink |
OLD | NEW |