Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1331)

Side by Side Diff: Source/core/platform/network/chromium/ResourceHandleInternal.h

Issue 14246006: Implementing timeout support for XHR (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@timeoutResourceHandle
Patch Set: Rebased, cancel method accepting error argument. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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 ResourceHandleInternal_h 31 #ifndef ResourceHandleInternal_h
32 #define ResourceHandleInternal_h 32 #define ResourceHandleInternal_h
33 33
34 #include "ResourceRequest.h" 34 #include "ResourceRequest.h"
35 #include "ResourceError.h"
36 #include "Timer.h"
35 #include <public/WebCommon.h> 37 #include <public/WebCommon.h>
36 #include <public/WebURLLoader.h> 38 #include <public/WebURLLoader.h>
37 #include <public/WebURLLoaderClient.h> 39 #include <public/WebURLLoaderClient.h>
38 #include <public/WebURLRequest.h> 40 #include <public/WebURLRequest.h>
39 41
40 namespace WebCore { 42 namespace WebCore {
41 43
42 class NetworkingContext; 44 class NetworkingContext;
43 class ResourceHandle; 45 class ResourceHandle;
44 class ResourceHandleClient; 46 class ResourceHandleClient;
45 47
46 class ResourceHandleInternal : public WebKit::WebURLLoaderClient { 48 class ResourceHandleInternal : public WebKit::WebURLLoaderClient {
47 public: 49 public:
48 ResourceHandleInternal(NetworkingContext*, const ResourceRequest&, ResourceH andleClient*); 50 ResourceHandleInternal(NetworkingContext*, const ResourceRequest&, ResourceH andleClient*);
49 51
50 virtual ~ResourceHandleInternal() { } 52 virtual ~ResourceHandleInternal() { }
51 53
52 void start(); 54 void start();
53 void cancel(); 55 void cancel(const ResourceError& = ResourceError());
54 void setDefersLoading(bool); 56 void setDefersLoading(bool);
55 bool allowStoredCredentials() const; 57 bool allowStoredCredentials() const;
56 void didChangePriority(WebKit::WebURLRequest::Priority); 58 void didChangePriority(WebKit::WebURLRequest::Priority);
57 59
58 // WebURLLoaderClient methods: 60 // WebURLLoaderClient methods:
59 virtual void willSendRequest(WebKit::WebURLLoader*, WebKit::WebURLRequest&, const WebKit::WebURLResponse&); 61 virtual void willSendRequest(WebKit::WebURLLoader*, WebKit::WebURLRequest&, const WebKit::WebURLResponse&);
60 virtual void didSendData(WebKit::WebURLLoader*, unsigned long long bytesSent , unsigned long long totalBytesToBeSent); 62 virtual void didSendData(WebKit::WebURLLoader*, unsigned long long bytesSent , unsigned long long totalBytesToBeSent);
61 virtual void didReceiveResponse(WebKit::WebURLLoader*, const WebKit::WebURLR esponse&); 63 virtual void didReceiveResponse(WebKit::WebURLLoader*, const WebKit::WebURLR esponse&);
62 virtual void didDownloadData(WebKit::WebURLLoader*, int dataLength); 64 virtual void didDownloadData(WebKit::WebURLLoader*, int dataLength);
63 virtual void didReceiveData(WebKit::WebURLLoader*, const char* data, int dat aLength, int encodedDataLength); 65 virtual void didReceiveData(WebKit::WebURLLoader*, const char* data, int dat aLength, int encodedDataLength);
(...skipping 15 matching lines...) Expand all
79 void setOwner(ResourceHandle* owner) { m_owner = owner; } 81 void setOwner(ResourceHandle* owner) { m_owner = owner; }
80 ResourceRequest& request() { return m_request; } 82 ResourceRequest& request() { return m_request; }
81 ResourceHandleClient* client() const { return m_client; } 83 ResourceHandleClient* client() const { return m_client; }
82 void setClient(ResourceHandleClient* client) { m_client = client; } 84 void setClient(ResourceHandleClient* client) { m_client = client; }
83 WebKit::WebURLLoader* loader() const { return m_loader.get(); } 85 WebKit::WebURLLoader* loader() const { return m_loader.get(); }
84 NetworkingContext* context() const { return m_context.get(); } 86 NetworkingContext* context() const { return m_context.get(); }
85 87
86 static ResourceHandleInternal* FromResourceHandle(ResourceHandle*); 88 static ResourceHandleInternal* FromResourceHandle(ResourceHandle*);
87 89
88 private: 90 private:
91 void timerFired(Timer<ResourceHandleInternal>*);
Dominik Röttsches 2013/04/22 15:47:45 Now private.
92
89 RefPtr<NetworkingContext> m_context; 93 RefPtr<NetworkingContext> m_context;
90 ResourceRequest m_request; 94 ResourceRequest m_request;
91 ResourceHandle* m_owner; 95 ResourceHandle* m_owner;
92 ResourceHandleClient* m_client; 96 ResourceHandleClient* m_client;
93 OwnPtr<WebKit::WebURLLoader> m_loader; 97 OwnPtr<WebKit::WebURLLoader> m_loader;
94 98
95 // Used for sanity checking to make sure we don't experience illegal state 99 // Used for sanity checking to make sure we don't experience illegal state
96 // transitions. 100 // transitions.
97 ConnectionState m_state; 101 ConnectionState m_state;
102
103 Timer<ResourceHandleInternal> m_timeoutTimer;
98 }; 104 };
99 105
100 } // namespace WebCore 106 } // namespace WebCore
101 107
102 #endif 108 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698