Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 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 17 matching lines...) Expand all Loading... | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef DocumentThreadableLoader_h | 31 #ifndef DocumentThreadableLoader_h |
| 32 #define DocumentThreadableLoader_h | 32 #define DocumentThreadableLoader_h |
| 33 | 33 |
| 34 #include "core/loader/FrameLoaderTypes.h" | 34 #include "core/loader/FrameLoaderTypes.h" |
| 35 #include "core/loader/ThreadableLoader.h" | 35 #include "core/loader/ThreadableLoader.h" |
| 36 #include "core/loader/cache/CachedRawResource.h" | 36 #include "core/loader/cache/CachedRawResource.h" |
| 37 #include "core/loader/cache/CachedResourceHandle.h" | 37 #include "core/loader/cache/CachedResourceHandle.h" |
| 38 #include "core/platform/Timer.h" | |
| 39 #include "core/platform/network/ResourceError.h" | |
| 38 #include <wtf/Forward.h> | 40 #include <wtf/Forward.h> |
| 39 #include <wtf/OwnPtr.h> | 41 #include <wtf/OwnPtr.h> |
| 40 #include <wtf/PassRefPtr.h> | 42 #include <wtf/PassRefPtr.h> |
| 41 #include <wtf/RefCounted.h> | 43 #include <wtf/RefCounted.h> |
| 42 #include <wtf/RefPtr.h> | 44 #include <wtf/RefPtr.h> |
| 43 #include <wtf/text/WTFString.h> | 45 #include <wtf/text/WTFString.h> |
| 44 | 46 |
| 45 namespace WebCore { | 47 namespace WebCore { |
| 46 class Document; | 48 class Document; |
| 47 class KURL; | 49 class KURL; |
| 48 class ResourceRequest; | 50 class ResourceRequest; |
| 49 class SecurityOrigin; | 51 class SecurityOrigin; |
| 50 class ThreadableLoaderClient; | 52 class ThreadableLoaderClient; |
| 51 | 53 |
| 52 class DocumentThreadableLoader : public RefCounted<DocumentThreadableLoader> , public ThreadableLoader, private CachedRawResourceClient { | 54 class DocumentThreadableLoader : public RefCounted<DocumentThreadableLoader> , public ThreadableLoader, private CachedRawResourceClient { |
| 53 WTF_MAKE_FAST_ALLOCATED; | 55 WTF_MAKE_FAST_ALLOCATED; |
| 54 public: | 56 public: |
| 55 static void loadResourceSynchronously(Document*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); | 57 static void loadResourceSynchronously(Document*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); |
| 56 static PassRefPtr<DocumentThreadableLoader> create(Document*, Threadable LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); | 58 static PassRefPtr<DocumentThreadableLoader> create(Document*, Threadable LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); |
| 57 virtual ~DocumentThreadableLoader(); | 59 virtual ~DocumentThreadableLoader(); |
| 58 | 60 |
| 59 virtual void cancel(); | 61 virtual void cancel(); |
| 62 void cancel(const ResourceError&); | |
| 60 virtual void setDefersLoading(bool); | 63 virtual void setDefersLoading(bool); |
| 61 | 64 |
| 62 using RefCounted<DocumentThreadableLoader>::ref; | 65 using RefCounted<DocumentThreadableLoader>::ref; |
| 63 using RefCounted<DocumentThreadableLoader>::deref; | 66 using RefCounted<DocumentThreadableLoader>::deref; |
| 64 | 67 |
| 65 protected: | 68 protected: |
| 66 virtual void refThreadableLoader() { ref(); } | 69 virtual void refThreadableLoader() { ref(); } |
| 67 virtual void derefThreadableLoader() { deref(); } | 70 virtual void derefThreadableLoader() { deref(); } |
| 68 | 71 |
| 69 private: | 72 private: |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 86 | 89 |
| 87 void didReceiveResponse(unsigned long identifier, const ResourceResponse &); | 90 void didReceiveResponse(unsigned long identifier, const ResourceResponse &); |
| 88 void didReceiveData(unsigned long identifier, const char* data, int data Length); | 91 void didReceiveData(unsigned long identifier, const char* data, int data Length); |
| 89 void didFinishLoading(unsigned long identifier, double finishTime); | 92 void didFinishLoading(unsigned long identifier, double finishTime); |
| 90 void didFail(unsigned long identifier, const ResourceError&); | 93 void didFail(unsigned long identifier, const ResourceError&); |
| 91 void makeCrossOriginAccessRequest(const ResourceRequest&); | 94 void makeCrossOriginAccessRequest(const ResourceRequest&); |
| 92 void makeSimpleCrossOriginAccessRequest(const ResourceRequest& request); | 95 void makeSimpleCrossOriginAccessRequest(const ResourceRequest& request); |
| 93 void makeCrossOriginAccessRequestWithPreflight(const ResourceRequest& re quest); | 96 void makeCrossOriginAccessRequestWithPreflight(const ResourceRequest& re quest); |
| 94 void preflightSuccess(); | 97 void preflightSuccess(); |
| 95 void preflightFailure(unsigned long identifier, const String& url, const String& errorDescription); | 98 void preflightFailure(unsigned long identifier, const String& url, const String& errorDescription); |
| 99 void timedOut(Timer<DocumentThreadableLoader>*); | |
|
abarth-chromium
2013/05/17 05:10:40
didTimeout?
| |
| 96 | 100 |
| 97 void loadRequest(const ResourceRequest&, SecurityCheckPolicy); | 101 void loadRequest(const ResourceRequest&, SecurityCheckPolicy); |
| 98 bool isAllowedRedirect(const KURL&) const; | 102 bool isAllowedRedirect(const KURL&) const; |
| 99 bool isAllowedByPolicy(const KURL&) const; | 103 bool isAllowedByPolicy(const KURL&) const; |
| 100 | 104 |
| 101 SecurityOrigin* securityOrigin() const; | 105 SecurityOrigin* securityOrigin() const; |
| 102 | 106 |
| 103 CachedResourceHandle<CachedRawResource> m_resource; | 107 CachedResourceHandle<CachedRawResource> m_resource; |
| 104 ThreadableLoaderClient* m_client; | 108 ThreadableLoaderClient* m_client; |
| 105 Document* m_document; | 109 Document* m_document; |
| 106 ThreadableLoaderOptions m_options; | 110 ThreadableLoaderOptions m_options; |
| 107 bool m_sameOriginRequest; | 111 bool m_sameOriginRequest; |
| 108 bool m_simpleRequest; | 112 bool m_simpleRequest; |
| 109 bool m_async; | 113 bool m_async; |
| 110 OwnPtr<ResourceRequest> m_actualRequest; // non-null during Access Cont rol preflight checks | 114 OwnPtr<ResourceRequest> m_actualRequest; // non-null during Access Cont rol preflight checks |
| 115 Timer<DocumentThreadableLoader> m_timeoutTimer; | |
| 111 }; | 116 }; |
| 112 | 117 |
| 113 } // namespace WebCore | 118 } // namespace WebCore |
| 114 | 119 |
| 115 #endif // DocumentThreadableLoader_h | 120 #endif // DocumentThreadableLoader_h |
| OLD | NEW |