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

Side by Side Diff: webkit/api/src/ResourceHandle.cpp

Issue 295041: DevTools: report correct content length for resources (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | « webkit/api/public/WebURLLoaderClient.h ('k') | webkit/glue/devtools/js/tests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 void start(); 62 void start();
63 void cancel(); 63 void cancel();
64 void setDefersLoading(bool); 64 void setDefersLoading(bool);
65 bool allowStoredCredentials() const; 65 bool allowStoredCredentials() const;
66 66
67 // WebURLLoaderClient methods: 67 // WebURLLoaderClient methods:
68 virtual void willSendRequest(WebURLLoader*, WebURLRequest&, const WebURLResponse&); 68 virtual void willSendRequest(WebURLLoader*, WebURLRequest&, const WebURLResponse&);
69 virtual void didSendData( 69 virtual void didSendData(
70 WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent); 70 WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
71 virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&); 71 virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&);
72 virtual void didReceiveData( 72 virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength);
73 WebURLLoader*, const char* data, int dataLength, long long totalDataLength);
74 virtual void didFinishLoading(WebURLLoader*); 73 virtual void didFinishLoading(WebURLLoader*);
75 virtual void didFail(WebURLLoader*, const WebURLError&); 74 virtual void didFail(WebURLLoader*, const WebURLError&);
76 75
77 ResourceRequest m_request; 76 ResourceRequest m_request;
78 ResourceHandle* m_owner; 77 ResourceHandle* m_owner;
79 ResourceHandleClient* m_client; 78 ResourceHandleClient* m_client;
80 OwnPtr<WebURLLoader> m_loader; 79 OwnPtr<WebURLLoader> m_loader;
81 }; 80 };
82 81
83 void ResourceHandleInternal::start() 82 void ResourceHandleInternal::start()
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 124 }
126 125
127 void ResourceHandleInternal::didReceiveResponse(WebURLLoader*, const WebURLResponse& response) 126 void ResourceHandleInternal::didReceiveResponse(WebURLLoader*, const WebURLResponse& response)
128 { 127 {
129 ASSERT(m_client); 128 ASSERT(m_client);
130 ASSERT(!response.isNull()); 129 ASSERT(!response.isNull());
131 m_client->didReceiveResponse(m_owner, response.toResourceResponse()); 130 m_client->didReceiveResponse(m_owner, response.toResourceResponse());
132 } 131 }
133 132
134 void ResourceHandleInternal::didReceiveData( 133 void ResourceHandleInternal::didReceiveData(
135 WebURLLoader*, const char* data, int dataLength, long long totalDataLength) 134 WebURLLoader*, const char* data, int dataLength)
136 { 135 {
137 ASSERT(m_client); 136 ASSERT(m_client);
138 137
139 // FIXME: ResourceHandleClient::didReceiveData should take a 'long long' 138 // FIXME(yurys): it looks like lengthReceived is always the same as
140 int lengthReceived = static_cast<int>(totalDataLength); 139 // dataLength and that the latter parameter can be eliminated.
141 if (lengthReceived != totalDataLength) // overflow occurred 140 // See WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=31019
142 lengthReceived = -1; 141 m_client->didReceiveData(m_owner, data, dataLength, dataLength);
143
144 m_client->didReceiveData(m_owner, data, dataLength, lengthReceived);
145 } 142 }
146 143
147 void ResourceHandleInternal::didFinishLoading(WebURLLoader*) 144 void ResourceHandleInternal::didFinishLoading(WebURLLoader*)
148 { 145 {
149 ASSERT(m_client); 146 ASSERT(m_client);
150 m_client->didFinishLoading(m_owner); 147 m_client->didFinishLoading(m_owner);
151 } 148 }
152 149
153 void ResourceHandleInternal::didFail(WebURLLoader*, const WebURLError& error) 150 void ResourceHandleInternal::didFail(WebURLLoader*, const WebURLError& error)
154 { 151 {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // if the request cannot be serviced from cache. We force the 'DontLoad' 275 // if the request cannot be serviced from cache. We force the 'DontLoad'
279 // cache policy at this point to ensure that we never hit the network for 276 // cache policy at this point to ensure that we never hit the network for
280 // this request. 277 // this request.
281 // 278 //
282 ASSERT(request.httpMethod() == "POST"); 279 ASSERT(request.httpMethod() == "POST");
283 request.setCachePolicy(ReturnCacheDataDontLoad); 280 request.setCachePolicy(ReturnCacheDataDontLoad);
284 return true; 281 return true;
285 } 282 }
286 283
287 } // namespace WebCore 284 } // namespace WebCore
OLDNEW
« no previous file with comments | « webkit/api/public/WebURLLoaderClient.h ('k') | webkit/glue/devtools/js/tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698