| 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 * 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 26 matching lines...) Expand all Loading... |
| 37 #include "core/loader/ThreadableLoader.h" | 37 #include "core/loader/ThreadableLoader.h" |
| 38 #include "core/platform/Timer.h" | 38 #include "core/platform/Timer.h" |
| 39 #include "core/platform/network/ResourceError.h" | 39 #include "core/platform/network/ResourceError.h" |
| 40 #include "wtf/Forward.h" | 40 #include "wtf/Forward.h" |
| 41 #include "wtf/OwnPtr.h" | 41 #include "wtf/OwnPtr.h" |
| 42 #include "wtf/PassRefPtr.h" | 42 #include "wtf/PassRefPtr.h" |
| 43 #include "wtf/RefCounted.h" | 43 #include "wtf/RefCounted.h" |
| 44 #include "wtf/text/WTFString.h" | 44 #include "wtf/text/WTFString.h" |
| 45 | 45 |
| 46 namespace WebCore { | 46 namespace WebCore { |
| 47 class Document; | |
| 48 class KURL; | |
| 49 class ResourceRequest; | |
| 50 class SecurityOrigin; | |
| 51 class ThreadableLoaderClient; | |
| 52 | 47 |
| 53 class DocumentThreadableLoader : public RefCounted<DocumentThreadableLoader>
, public ThreadableLoader, private RawResourceClient { | 48 class Document; |
| 54 WTF_MAKE_FAST_ALLOCATED; | 49 class KURL; |
| 50 class ResourceRequest; |
| 51 class SecurityOrigin; |
| 52 class ThreadableLoaderClient; |
| 53 |
| 54 class DocumentThreadableLoader : public RefCounted<DocumentThreadableLoader>, pu
blic ThreadableLoader, private RawResourceClient { |
| 55 WTF_MAKE_FAST_ALLOCATED; |
| 55 public: | 56 public: |
| 56 static void loadResourceSynchronously(Document*, const ResourceRequest&,
ThreadableLoaderClient&, const ThreadableLoaderOptions&); | 57 static void loadResourceSynchronously(Document*, const ResourceRequest&,
ThreadableLoaderClient&, const ThreadableLoaderOptions&); |
| 57 static PassRefPtr<DocumentThreadableLoader> create(Document*, Threadable
LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); | 58 static PassRefPtr<DocumentThreadableLoader> create(Document*, Threadable
LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); |
| 58 virtual ~DocumentThreadableLoader(); | 59 virtual ~DocumentThreadableLoader(); |
| 59 | 60 |
| 60 virtual void cancel(); | 61 virtual void cancel(); |
| 61 virtual void setDefersLoading(bool); | 62 virtual void setDefersLoading(bool); |
| 62 | 63 |
| 63 using RefCounted<DocumentThreadableLoader>::ref; | 64 using RefCounted<DocumentThreadableLoader>::ref; |
| 64 using RefCounted<DocumentThreadableLoader>::deref; | 65 using RefCounted<DocumentThreadableLoader>::deref; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 85 virtual void notifyFinished(Resource*); | 86 virtual void notifyFinished(Resource*); |
| 86 virtual void dataDownloaded(Resource*, int); | 87 virtual void dataDownloaded(Resource*, int); |
| 87 | 88 |
| 88 void cancelWithError(const ResourceError&); | 89 void cancelWithError(const ResourceError&); |
| 89 void didReceiveResponse(unsigned long identifier, const ResourceResponse
&); | 90 void didReceiveResponse(unsigned long identifier, const ResourceResponse
&); |
| 90 void didReceiveData(unsigned long identifier, const char* data, int data
Length); | 91 void didReceiveData(unsigned long identifier, const char* data, int data
Length); |
| 91 void didFinishLoading(unsigned long identifier, double finishTime); | 92 void didFinishLoading(unsigned long identifier, double finishTime); |
| 92 void didFail(unsigned long identifier, const ResourceError&); | 93 void didFail(unsigned long identifier, const ResourceError&); |
| 93 void didTimeout(Timer<DocumentThreadableLoader>*); | 94 void didTimeout(Timer<DocumentThreadableLoader>*); |
| 94 void makeCrossOriginAccessRequest(const ResourceRequest&); | 95 void makeCrossOriginAccessRequest(const ResourceRequest&); |
| 95 void makeSimpleCrossOriginAccessRequest(const ResourceRequest& request); | 96 void makeSimpleCrossOriginAccessRequest(const ResourceRequest&); |
| 96 void makeCrossOriginAccessRequestWithPreflight(const ResourceRequest& re
quest); | 97 void makeCrossOriginAccessRequestWithPreflight(const ResourceRequest&); |
| 97 void preflightSuccess(); | 98 void preflightSuccess(); |
| 98 void preflightFailure(unsigned long identifier, const String& url, const
String& errorDescription); | 99 void preflightFailure(unsigned long identifier, const String& url, const
String& errorDescription); |
| 99 | 100 |
| 100 void loadRequest(const ResourceRequest&, SecurityCheckPolicy); | 101 void loadRequest(const ResourceRequest&, SecurityCheckPolicy); |
| 101 bool isAllowedRedirect(const KURL&) const; | 102 bool isAllowedRedirect(const KURL&) const; |
| 102 bool isAllowedByPolicy(const KURL&) const; | 103 bool isAllowedByPolicy(const KURL&) const; |
| 103 | 104 |
| 104 SecurityOrigin* securityOrigin() const; | 105 SecurityOrigin* securityOrigin() const; |
| 106 bool checkCrossOriginAccessRedirectionUrl(const KURL&, String& errorDesc
ription); |
| 105 | 107 |
| 106 ResourcePtr<RawResource> m_resource; | 108 ResourcePtr<RawResource> m_resource; |
| 107 ThreadableLoaderClient* m_client; | 109 ThreadableLoaderClient* m_client; |
| 108 Document* m_document; | 110 Document* m_document; |
| 109 ThreadableLoaderOptions m_options; | 111 ThreadableLoaderOptions m_options; |
| 110 bool m_sameOriginRequest; | 112 bool m_sameOriginRequest; |
| 111 bool m_simpleRequest; | 113 bool m_simpleRequest; |
| 112 bool m_async; | 114 bool m_async; |
| 113 OwnPtr<ResourceRequest> m_actualRequest; // non-null during Access Cont
rol preflight checks | 115 OwnPtr<ResourceRequest> m_actualRequest; // non-null during Access Contr
ol preflight checks |
| 114 Timer<DocumentThreadableLoader> m_timeoutTimer; | 116 Timer<DocumentThreadableLoader> m_timeoutTimer; |
| 115 }; | 117 }; |
| 116 | 118 |
| 117 } // namespace WebCore | 119 } // namespace WebCore |
| 118 | 120 |
| 119 #endif // DocumentThreadableLoader_h | 121 #endif // DocumentThreadableLoader_h |
| OLD | NEW |