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

Side by Side Diff: mojo/services/network/url_loader_impl.cc

Issue 1241553003: Update implementation following changes to URLRequest cache mode. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "mojo/services/network/url_loader_impl.h" 5 #include "mojo/services/network/url_loader_impl.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 if (request->body) { 530 if (request->body) {
531 ScopedVector<net::UploadElementReader> element_readers; 531 ScopedVector<net::UploadElementReader> element_readers;
532 for (size_t i = 0; i < request->body.size(); ++i) { 532 for (size_t i = 0; i < request->body.size(); ++i) {
533 element_readers.push_back( 533 element_readers.push_back(
534 new UploadDataPipeElementReader(request->body[i].Pass())); 534 new UploadDataPipeElementReader(request->body[i].Pass()));
535 } 535 }
536 url_request_->set_upload(make_scoped_ptr<net::UploadDataStream>( 536 url_request_->set_upload(make_scoped_ptr<net::UploadDataStream>(
537 new net::ElementsUploadDataStream(element_readers.Pass(), 0))); 537 new net::ElementsUploadDataStream(element_readers.Pass(), 0)));
538 } 538 }
539 int load_flags = 0; 539 int load_flags = 0;
540 if (request->bypass_cache) 540 switch (request->cache_mode) {
541 load_flags |= net::LOAD_BYPASS_CACHE; 541 case URLRequest::CACHE_MODE_DEFAULT:
542 if (request->only_from_cache) 542 break;
543 load_flags |= net::LOAD_ONLY_FROM_CACHE; 543 case URLRequest::CACHE_MODE_BYPASS_CACHE:
544 load_flags |= net::LOAD_BYPASS_CACHE;
545 case URLRequest::CACHE_MODE_ONLY_FROM_CACHE:
546 load_flags |= net::LOAD_ONLY_FROM_CACHE;
547 break;
548 }
viettrungluu 2015/07/20 17:00:28 Since we don't validate enums, you should have a d
qsr 2015/07/20 18:30:50 Hum... I'm kind of torn here. If I don't do this,
544 if (load_flags) 549 if (load_flags)
545 url_request_->SetLoadFlags(load_flags); 550 url_request_->SetLoadFlags(load_flags);
546 551
547 response_body_buffer_size_ = request->response_body_buffer_size; 552 response_body_buffer_size_ = request->response_body_buffer_size;
548 auto_follow_redirects_ = request->auto_follow_redirects; 553 auto_follow_redirects_ = request->auto_follow_redirects;
549 554
550 url_request_->Start(); 555 url_request_->Start();
551 } 556 }
552 557
553 void URLLoaderImpl::SendResponse(URLResponsePtr response) { 558 void URLLoaderImpl::SendResponse(URLResponsePtr response) {
(...skipping 22 matching lines...) Expand all
576 if ((*it)->id() == current_fetcher_id_) { 581 if ((*it)->id() == current_fetcher_id_) {
577 last_status_ = fetcher->QueryStatus(); 582 last_status_ = fetcher->QueryStatus();
578 last_status_->is_loading = false; 583 last_status_->is_loading = false;
579 } 584 }
580 body_fetchers_.erase(it); 585 body_fetchers_.erase(it);
581 if (body_fetchers_.empty() and !binding_.is_bound()) 586 if (body_fetchers_.empty() and !binding_.is_bound())
582 delete this; 587 delete this;
583 } 588 }
584 589
585 } // namespace mojo 590 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698