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

Side by Side Diff: content/browser/service_worker/service_worker_write_to_cache_job.cc

Issue 1283273002: Service Worker: Change last update check location and HTTP cache bypass rule (2/2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments. Created 5 years, 4 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/service_worker/service_worker_write_to_cache_job.h" 5 #include "content/browser/service_worker/service_worker_write_to_cache_job.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 : base::StringPrintf(kBadMIMEError, mime_type.c_str()); 662 : base::StringPrintf(kBadMIMEError, mime_type.c_str());
663 AsyncNotifyDoneHelper(net::URLRequestStatus(net::URLRequestStatus::FAILED, 663 AsyncNotifyDoneHelper(net::URLRequestStatus(net::URLRequestStatus::FAILED,
664 net::ERR_INSECURE_RESPONSE), 664 net::ERR_INSECURE_RESPONSE),
665 error_message); 665 error_message);
666 return; 666 return;
667 } 667 }
668 668
669 if (!CheckPathRestriction(request)) 669 if (!CheckPathRestriction(request))
670 return; 670 return;
671 671
672 const net::HttpResponseHeaders* headers = request->response_headers();
673 base::TimeDelta result;
674 if (headers->GetMaxAgeValue(&result) &&
675 result < base::TimeDelta::FromSeconds(
676 kServiceWorkerScriptMaxCacheAgeInSeconds))
677 version_->set_max_age(result);
678
672 version_->SetMainScriptHttpResponseInfo(net_request_->response_info()); 679 version_->SetMainScriptHttpResponseInfo(net_request_->response_info());
673 } 680 }
674 681
675 if (net_request_->response_info().network_accessed) 682 if (net_request_->response_info().network_accessed)
676 version_->embedded_worker()->OnNetworkAccessedForScriptLoad(); 683 version_->embedded_worker()->OnNetworkAccessedForScriptLoad();
677 684
678 consumer_->OnResponseStarted(); 685 consumer_->OnResponseStarted();
679 } 686 }
680 687
681 void ServiceWorkerWriteToCacheJob::CommitHeadersAndNotifyHeadersComplete() { 688 void ServiceWorkerWriteToCacheJob::CommitHeadersAndNotifyHeadersComplete() {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 DCHECK(!did_notify_finished_); 823 DCHECK(!did_notify_finished_);
817 int size = -1; 824 int size = -1;
818 if (status.is_success()) 825 if (status.is_success())
819 size = writer_ ? writer_->amount_written() : 0; 826 size = writer_ ? writer_->amount_written() : 0;
820 version_->script_cache_map()->NotifyFinishedCaching(url_, size, status, 827 version_->script_cache_map()->NotifyFinishedCaching(url_, size, status,
821 status_message); 828 status_message);
822 did_notify_finished_ = true; 829 did_notify_finished_ = true;
823 } 830 }
824 831
825 } // namespace content 832 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698