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

Side by Side Diff: webkit/glue/resource_fetcher.h

Issue 1742004: Glue for sending/receiving cacheable metadata. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/glue/resource_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // A wrapper around ResourceHandle and ResourceHandleClient that simplifies 5 // A wrapper around ResourceHandle and ResourceHandleClient that simplifies
6 // the download of an HTTP object. The interface is modeled after URLFetcher 6 // the download of an HTTP object. The interface is modeled after URLFetcher
7 // in the /chrome/browser. 7 // in the /chrome/browser.
8 // 8 //
9 // ResourceFetcher::Delegate::OnURLFetchComplete will be called async after 9 // ResourceFetcher::Delegate::OnURLFetchComplete will be called async after
10 // the ResourceFetcher object is created. 10 // the ResourceFetcher object is created.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 protected: 54 protected:
55 // WebURLLoaderClient methods: 55 // WebURLLoaderClient methods:
56 virtual void willSendRequest( 56 virtual void willSendRequest(
57 WebKit::WebURLLoader* loader, WebKit::WebURLRequest& new_request, 57 WebKit::WebURLLoader* loader, WebKit::WebURLRequest& new_request,
58 const WebKit::WebURLResponse& redirect_response); 58 const WebKit::WebURLResponse& redirect_response);
59 virtual void didSendData( 59 virtual void didSendData(
60 WebKit::WebURLLoader* loader, unsigned long long bytes_sent, 60 WebKit::WebURLLoader* loader, unsigned long long bytes_sent,
61 unsigned long long total_bytes_to_be_sent); 61 unsigned long long total_bytes_to_be_sent);
62 virtual void didReceiveResponse( 62 virtual void didReceiveResponse(
63 WebKit::WebURLLoader* loader, const WebKit::WebURLResponse& response); 63 WebKit::WebURLLoader* loader, const WebKit::WebURLResponse& response);
64 virtual void didReceiveCachedMetadata(
65 WebKit::WebURLLoader* loader, const char* data, int data_length);
64 virtual void didReceiveData( 66 virtual void didReceiveData(
65 WebKit::WebURLLoader* loader, const char* data, int data_length); 67 WebKit::WebURLLoader* loader, const char* data, int data_length);
66 virtual void didFinishLoading(WebKit::WebURLLoader* loader); 68 virtual void didFinishLoading(WebKit::WebURLLoader* loader);
67 virtual void didFail( 69 virtual void didFail(
68 WebKit::WebURLLoader* loader, const WebKit::WebURLError& error); 70 WebKit::WebURLLoader* loader, const WebKit::WebURLError& error);
69 71
70 scoped_ptr<WebKit::WebURLLoader> loader_; 72 scoped_ptr<WebKit::WebURLLoader> loader_;
71 73
72 // URL we're fetching 74 // URL we're fetching
73 GURL url_; 75 GURL url_;
74 76
75 // Callback when we're done 77 // Callback when we're done
76 scoped_ptr<Callback> callback_; 78 scoped_ptr<Callback> callback_;
77 79
78 // A copy of the original resource response 80 // A copy of the original resource response
79 WebKit::WebURLResponse response_; 81 WebKit::WebURLResponse response_;
80 82
81 // Set to true once the request is compelte. 83 // Set to true once the request is compelte.
82 bool completed_; 84 bool completed_;
83 85
84 private: 86 private:
85 // Start the actual download. 87 // Start the actual download.
86 void Start(WebKit::WebFrame* frame); 88 void Start(WebKit::WebFrame* frame);
87 89
88 // Buffer to hold the content from the server. 90 // Buffer to hold the content from the server.
89 std::string data_; 91 std::string data_;
92
93 // Buffer to hold metadata from the cache.
94 std::string metadata_;
90 }; 95 };
91 96
92 ///////////////////////////////////////////////////////////////////////////// 97 /////////////////////////////////////////////////////////////////////////////
93 // A resource fetcher with a timeout 98 // A resource fetcher with a timeout
94 class ResourceFetcherWithTimeout : public ResourceFetcher { 99 class ResourceFetcherWithTimeout : public ResourceFetcher {
95 public: 100 public:
96 ResourceFetcherWithTimeout(const GURL& url, WebKit::WebFrame* frame, 101 ResourceFetcherWithTimeout(const GURL& url, WebKit::WebFrame* frame,
97 int timeout_secs, Callback* c); 102 int timeout_secs, Callback* c);
98 virtual ~ResourceFetcherWithTimeout() {} 103 virtual ~ResourceFetcherWithTimeout() {}
99 104
100 private: 105 private:
101 // Callback for timer that limits how long we wait for the alternate error 106 // Callback for timer that limits how long we wait for the alternate error
102 // page server. If this timer fires and the request hasn't completed, we 107 // page server. If this timer fires and the request hasn't completed, we
103 // kill the request. 108 // kill the request.
104 void TimeoutFired(); 109 void TimeoutFired();
105 110
106 // Limit how long we wait for the alternate error page server. 111 // Limit how long we wait for the alternate error page server.
107 base::OneShotTimer<ResourceFetcherWithTimeout> timeout_timer_; 112 base::OneShotTimer<ResourceFetcherWithTimeout> timeout_timer_;
108 }; 113 };
109 114
110 } // namespace webkit_glue 115 } // namespace webkit_glue
111 116
112 #endif // WEBKIT_GLUE_RESOURCE_FETCHER_H_ 117 #endif // WEBKIT_GLUE_RESOURCE_FETCHER_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/glue/resource_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698