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

Side by Side Diff: Source/web/AssociatedURLLoader.cpp

Issue 618583002: Correct data size argument type in resource loading path to unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add static_cast to RELEASE_ASSERT in AssociatedURLLoader::ClientAdapter::didReceiveData Created 6 years, 2 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
« no previous file with comments | « Source/platform/SharedBuffer.cpp ('k') | Source/web/WebSharedWorkerImpl.cpp » ('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) 2010, 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2010, 2011, 2012 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "platform/network/ResourceError.h" 43 #include "platform/network/ResourceError.h"
44 #include "public/platform/WebHTTPHeaderVisitor.h" 44 #include "public/platform/WebHTTPHeaderVisitor.h"
45 #include "public/platform/WebString.h" 45 #include "public/platform/WebString.h"
46 #include "public/platform/WebURLError.h" 46 #include "public/platform/WebURLError.h"
47 #include "public/platform/WebURLLoaderClient.h" 47 #include "public/platform/WebURLLoaderClient.h"
48 #include "public/platform/WebURLRequest.h" 48 #include "public/platform/WebURLRequest.h"
49 #include "public/web/WebDataSource.h" 49 #include "public/web/WebDataSource.h"
50 #include "web/WebLocalFrameImpl.h" 50 #include "web/WebLocalFrameImpl.h"
51 #include "wtf/HashSet.h" 51 #include "wtf/HashSet.h"
52 #include "wtf/text/WTFString.h" 52 #include "wtf/text/WTFString.h"
53 #include <limits.h>
53 54
54 namespace blink { 55 namespace blink {
55 56
56 namespace { 57 namespace {
57 58
58 class HTTPRequestHeaderValidator : public WebHTTPHeaderVisitor { 59 class HTTPRequestHeaderValidator : public WebHTTPHeaderVisitor {
59 WTF_MAKE_NONCOPYABLE(HTTPRequestHeaderValidator); 60 WTF_MAKE_NONCOPYABLE(HTTPRequestHeaderValidator);
60 public: 61 public:
61 HTTPRequestHeaderValidator() : m_isSafe(true) { } 62 HTTPRequestHeaderValidator() : m_isSafe(true) { }
62 63
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 class AssociatedURLLoader::ClientAdapter FINAL : public DocumentThreadableLoader Client { 121 class AssociatedURLLoader::ClientAdapter FINAL : public DocumentThreadableLoader Client {
121 WTF_MAKE_NONCOPYABLE(ClientAdapter); 122 WTF_MAKE_NONCOPYABLE(ClientAdapter);
122 public: 123 public:
123 static PassOwnPtr<ClientAdapter> create(AssociatedURLLoader*, WebURLLoaderCl ient*, const WebURLLoaderOptions&); 124 static PassOwnPtr<ClientAdapter> create(AssociatedURLLoader*, WebURLLoaderCl ient*, const WebURLLoaderOptions&);
124 125
125 virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long lon g /*totalBytesToBeSent*/) OVERRIDE; 126 virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long lon g /*totalBytesToBeSent*/) OVERRIDE;
126 virtual void willSendRequest(ResourceRequest& /*newRequest*/, const Resource Response& /*redirectResponse*/) OVERRIDE; 127 virtual void willSendRequest(ResourceRequest& /*newRequest*/, const Resource Response& /*redirectResponse*/) OVERRIDE;
127 128
128 virtual void didReceiveResponse(unsigned long, const ResourceResponse&) OVER RIDE; 129 virtual void didReceiveResponse(unsigned long, const ResourceResponse&) OVER RIDE;
129 virtual void didDownloadData(int /*dataLength*/) OVERRIDE; 130 virtual void didDownloadData(int /*dataLength*/) OVERRIDE;
130 virtual void didReceiveData(const char*, int /*dataLength*/) OVERRIDE; 131 virtual void didReceiveData(const char*, unsigned /*dataLength*/) OVERRIDE;
131 virtual void didReceiveCachedMetadata(const char*, int /*dataLength*/) OVERR IDE; 132 virtual void didReceiveCachedMetadata(const char*, int /*dataLength*/) OVERR IDE;
132 virtual void didFinishLoading(unsigned long /*identifier*/, double /*finishT ime*/) OVERRIDE; 133 virtual void didFinishLoading(unsigned long /*identifier*/, double /*finishT ime*/) OVERRIDE;
133 virtual void didFail(const ResourceError&) OVERRIDE; 134 virtual void didFail(const ResourceError&) OVERRIDE;
134 virtual void didFailRedirectCheck() OVERRIDE; 135 virtual void didFailRedirectCheck() OVERRIDE;
135 136
136 // Sets an error to be reported back to the client, asychronously. 137 // Sets an error to be reported back to the client, asychronously.
137 void setDelayedError(const ResourceError&); 138 void setDelayedError(const ResourceError&);
138 139
139 // Enables forwarding of error notifications to the WebURLLoaderClient. Thes e must be 140 // Enables forwarding of error notifications to the WebURLLoaderClient. Thes e must be
140 // deferred until after the call to AssociatedURLLoader::loadAsynchronously( ) completes. 141 // deferred until after the call to AssociatedURLLoader::loadAsynchronously( ) completes.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 217 }
217 218
218 void AssociatedURLLoader::ClientAdapter::didDownloadData(int dataLength) 219 void AssociatedURLLoader::ClientAdapter::didDownloadData(int dataLength)
219 { 220 {
220 if (!m_client) 221 if (!m_client)
221 return; 222 return;
222 223
223 m_client->didDownloadData(m_loader, dataLength, -1); 224 m_client->didDownloadData(m_loader, dataLength, -1);
224 } 225 }
225 226
226 void AssociatedURLLoader::ClientAdapter::didReceiveData(const char* data, int da taLength) 227 void AssociatedURLLoader::ClientAdapter::didReceiveData(const char* data, unsign ed dataLength)
227 { 228 {
228 if (!m_client) 229 if (!m_client)
229 return; 230 return;
230 231
232 RELEASE_ASSERT(dataLength <= static_cast<unsigned>(std::numeric_limits<int>: :max()));
233
231 m_client->didReceiveData(m_loader, data, dataLength, -1); 234 m_client->didReceiveData(m_loader, data, dataLength, -1);
232 } 235 }
233 236
234 void AssociatedURLLoader::ClientAdapter::didReceiveCachedMetadata(const char* da ta, int dataLength) 237 void AssociatedURLLoader::ClientAdapter::didReceiveCachedMetadata(const char* da ta, int dataLength)
235 { 238 {
236 if (!m_client) 239 if (!m_client)
237 return; 240 return;
238 241
239 m_client->didReceiveCachedMetadata(m_loader, data, dataLength); 242 m_client->didReceiveCachedMetadata(m_loader, data, dataLength);
240 } 243 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 m_loader->cancel(); 373 m_loader->cancel();
371 } 374 }
372 375
373 void AssociatedURLLoader::setDefersLoading(bool defersLoading) 376 void AssociatedURLLoader::setDefersLoading(bool defersLoading)
374 { 377 {
375 if (m_loader) 378 if (m_loader)
376 m_loader->setDefersLoading(defersLoading); 379 m_loader->setDefersLoading(defersLoading);
377 } 380 }
378 381
379 } // namespace blink 382 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/SharedBuffer.cpp ('k') | Source/web/WebSharedWorkerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698