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

Side by Side Diff: content/browser/download/download_resource_handler.cc

Issue 1444253003: Use If-Range instead of If-Match/If-Unmodified-Since for partial requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make it obvious that the interrupt reason is obsolete. Created 5 years 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/browser/download/download_resource_handler.h" 5 #include "content/browser/download/download_resource_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 case net::HTTP_ACCEPTED: 401 case net::HTTP_ACCEPTED:
402 case net::HTTP_NON_AUTHORITATIVE_INFORMATION: 402 case net::HTTP_NON_AUTHORITATIVE_INFORMATION:
403 case net::HTTP_RESET_CONTENT: 403 case net::HTTP_RESET_CONTENT:
404 case net::HTTP_PARTIAL_CONTENT: 404 case net::HTTP_PARTIAL_CONTENT:
405 // Expected successful codes. 405 // Expected successful codes.
406 break; 406 break;
407 case net::HTTP_NO_CONTENT: 407 case net::HTTP_NO_CONTENT:
408 case net::HTTP_NOT_FOUND: 408 case net::HTTP_NOT_FOUND:
409 reason = DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; 409 reason = DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT;
410 break; 410 break;
411 case net::HTTP_PRECONDITION_FAILED:
412 // Failed our 'If-Unmodified-Since' or 'If-Match'; see
413 // download_manager_impl.cc BeginDownload()
414 reason = DOWNLOAD_INTERRUPT_REASON_SERVER_PRECONDITION;
415 break;
416 case net::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE: 411 case net::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE:
417 // Retry by downloading from the start automatically: 412 // Retry by downloading from the start automatically:
418 // If we haven't received data when we get this error, we won't. 413 // If we haven't received data when we get this error, we won't.
419 reason = DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE; 414 reason = DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE;
420 break; 415 break;
421 case net::HTTP_UNAUTHORIZED: 416 case net::HTTP_UNAUTHORIZED:
422 // Server didn't authorize this request. 417 // Server didn't authorize this request.
423 reason = DOWNLOAD_INTERRUPT_REASON_SERVER_UNAUTHORIZED; 418 reason = DOWNLOAD_INTERRUPT_REASON_SERVER_UNAUTHORIZED;
424 break; 419 break;
425 case net::HTTP_FORBIDDEN: 420 case net::HTTP_FORBIDDEN:
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 BrowserThread::PostTask( 537 BrowserThread::PostTask(
543 BrowserThread::UI, FROM_HERE, 538 BrowserThread::UI, FROM_HERE,
544 base::Bind(&DeleteOnUIThread, base::Passed(&tab_info_))); 539 base::Bind(&DeleteOnUIThread, base::Passed(&tab_info_)));
545 } 540 }
546 541
547 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", 542 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration",
548 base::TimeTicks::Now() - download_start_time_); 543 base::TimeTicks::Now() - download_start_time_);
549 } 544 }
550 545
551 } // namespace content 546 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698