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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "wtf/text/WTFString.h" | 44 #include "wtf/text/WTFString.h" |
45 | 45 |
46 namespace WebCore { | 46 namespace WebCore { |
47 | 47 |
48 class Document; | 48 class Document; |
49 class KURL; | 49 class KURL; |
50 class ResourceRequest; | 50 class ResourceRequest; |
51 class SecurityOrigin; | 51 class SecurityOrigin; |
52 class ThreadableLoaderClient; | 52 class ThreadableLoaderClient; |
53 | 53 |
54 class DocumentThreadableLoader : public RefCounted<DocumentThreadableLoader>, pu
blic ThreadableLoader, private ResourceOwner<RawResource> { | 54 class DocumentThreadableLoader FINAL : public RefCounted<DocumentThreadableLoade
r>, public ThreadableLoader, private ResourceOwner<RawResource> { |
55 WTF_MAKE_FAST_ALLOCATED; | 55 WTF_MAKE_FAST_ALLOCATED; |
56 public: | 56 public: |
57 static void loadResourceSynchronously(Document*, const ResourceRequest&,
ThreadableLoaderClient&, const ThreadableLoaderOptions&); | 57 static void loadResourceSynchronously(Document*, const ResourceRequest&,
ThreadableLoaderClient&, const ThreadableLoaderOptions&); |
58 static PassRefPtr<DocumentThreadableLoader> create(Document*, Threadable
LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); | 58 static PassRefPtr<DocumentThreadableLoader> create(Document*, Threadable
LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); |
59 virtual ~DocumentThreadableLoader(); | 59 virtual ~DocumentThreadableLoader(); |
60 | 60 |
61 virtual void cancel(); | 61 virtual void cancel() OVERRIDE; |
62 virtual void setDefersLoading(bool); | 62 void setDefersLoading(bool); |
63 | 63 |
64 using RefCounted<DocumentThreadableLoader>::ref; | 64 using RefCounted<DocumentThreadableLoader>::ref; |
65 using RefCounted<DocumentThreadableLoader>::deref; | 65 using RefCounted<DocumentThreadableLoader>::deref; |
66 | 66 |
67 protected: | 67 protected: |
68 virtual void refThreadableLoader() { ref(); } | 68 virtual void refThreadableLoader() OVERRIDE { ref(); } |
69 virtual void derefThreadableLoader() { deref(); } | 69 virtual void derefThreadableLoader() OVERRIDE { deref(); } |
70 | 70 |
71 private: | 71 private: |
72 enum BlockingBehavior { | 72 enum BlockingBehavior { |
73 LoadSynchronously, | 73 LoadSynchronously, |
74 LoadAsynchronously | 74 LoadAsynchronously |
75 }; | 75 }; |
76 | 76 |
77 DocumentThreadableLoader(Document*, ThreadableLoaderClient*, BlockingBeh
avior, const ResourceRequest&, const ThreadableLoaderOptions&); | 77 DocumentThreadableLoader(Document*, ThreadableLoaderClient*, BlockingBeh
avior, const ResourceRequest&, const ThreadableLoaderOptions&); |
78 | 78 |
79 // RawResourceClient | 79 // RawResourceClient |
80 virtual void dataSent(Resource*, unsigned long long bytesSent, unsigned
long long totalBytesToBeSent); | 80 virtual void dataSent(Resource*, unsigned long long bytesSent, unsigned
long long totalBytesToBeSent) OVERRIDE; |
81 virtual void responseReceived(Resource*, const ResourceResponse&); | 81 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRI
DE; |
82 virtual void dataReceived(Resource*, const char* data, int dataLength); | 82 virtual void dataReceived(Resource*, const char* data, int dataLength) O
VERRIDE; |
83 virtual void redirectReceived(Resource*, ResourceRequest&, const Resourc
eResponse&); | 83 virtual void redirectReceived(Resource*, ResourceRequest&, const Resourc
eResponse&) OVERRIDE; |
84 virtual void notifyFinished(Resource*); | 84 virtual void notifyFinished(Resource*) OVERRIDE; |
85 virtual void dataDownloaded(Resource*, int); | 85 virtual void dataDownloaded(Resource*, int) OVERRIDE; |
86 | 86 |
87 void cancelWithError(const ResourceError&); | 87 void cancelWithError(const ResourceError&); |
88 void didReceiveResponse(unsigned long identifier, const ResourceResponse
&); | 88 void didReceiveResponse(unsigned long identifier, const ResourceResponse
&); |
89 void didReceiveData(const char* data, int dataLength); | 89 void didReceiveData(const char* data, int dataLength); |
90 void didFinishLoading(unsigned long identifier, double finishTime); | 90 void didFinishLoading(unsigned long identifier, double finishTime); |
91 void didTimeout(Timer<DocumentThreadableLoader>*); | 91 void didTimeout(Timer<DocumentThreadableLoader>*); |
92 void makeCrossOriginAccessRequest(const ResourceRequest&); | 92 void makeCrossOriginAccessRequest(const ResourceRequest&); |
93 void makeSimpleCrossOriginAccessRequest(const ResourceRequest&); | 93 void makeSimpleCrossOriginAccessRequest(const ResourceRequest&); |
94 void makeCrossOriginAccessRequestWithPreflight(const ResourceRequest&); | 94 void makeCrossOriginAccessRequestWithPreflight(const ResourceRequest&); |
95 void preflightSuccess(); | 95 void preflightSuccess(); |
(...skipping 12 matching lines...) Expand all Loading... |
108 bool m_sameOriginRequest; | 108 bool m_sameOriginRequest; |
109 bool m_simpleRequest; | 109 bool m_simpleRequest; |
110 bool m_async; | 110 bool m_async; |
111 OwnPtr<ResourceRequest> m_actualRequest; // non-null during Access Contr
ol preflight checks | 111 OwnPtr<ResourceRequest> m_actualRequest; // non-null during Access Contr
ol preflight checks |
112 Timer<DocumentThreadableLoader> m_timeoutTimer; | 112 Timer<DocumentThreadableLoader> m_timeoutTimer; |
113 }; | 113 }; |
114 | 114 |
115 } // namespace WebCore | 115 } // namespace WebCore |
116 | 116 |
117 #endif // DocumentThreadableLoader_h | 117 #endif // DocumentThreadableLoader_h |
OLD | NEW |