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

Side by Side Diff: mojo/shell/fetcher/network_fetcher.cc

Issue 1568073002: Reduce string copies in GURL creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/shell/fetcher/network_fetcher.h" 5 #include "mojo/shell/fetcher/network_fetcher.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 return url_; 51 return url_;
52 } 52 }
53 53
54 GURL NetworkFetcher::GetRedirectURL() const { 54 GURL NetworkFetcher::GetRedirectURL() const {
55 if (!response_) 55 if (!response_)
56 return GURL::EmptyGURL(); 56 return GURL::EmptyGURL();
57 57
58 if (response_->redirect_url.is_null()) 58 if (response_->redirect_url.is_null())
59 return GURL::EmptyGURL(); 59 return GURL::EmptyGURL();
60 60
61 return GURL(response_->redirect_url); 61 return GURL(response_->redirect_url.get());
62 } 62 }
63 63
64 GURL NetworkFetcher::GetRedirectReferer() const { 64 GURL NetworkFetcher::GetRedirectReferer() const {
65 if (!response_) 65 if (!response_)
66 return GURL::EmptyGURL(); 66 return GURL::EmptyGURL();
67 67
68 if (response_->redirect_referrer.is_null()) 68 if (response_->redirect_referrer.is_null())
69 return GURL::EmptyGURL(); 69 return GURL::EmptyGURL();
70 70
71 return GURL(response_->redirect_referrer); 71 return GURL(response_->redirect_referrer.get());
72 } 72 }
73 URLResponsePtr NetworkFetcher::AsURLResponse(base::TaskRunner* task_runner, 73 URLResponsePtr NetworkFetcher::AsURLResponse(base::TaskRunner* task_runner,
74 uint32_t skip) { 74 uint32_t skip) {
75 if (skip != 0) { 75 if (skip != 0) {
76 MojoResult result = ReadDataRaw( 76 MojoResult result = ReadDataRaw(
77 response_->body.get(), nullptr, &skip, 77 response_->body.get(), nullptr, &skip,
78 MOJO_READ_DATA_FLAG_ALL_OR_NONE | MOJO_READ_DATA_FLAG_DISCARD); 78 MOJO_READ_DATA_FLAG_ALL_OR_NONE | MOJO_READ_DATA_FLAG_DISCARD);
79 DCHECK_EQ(result, MOJO_RESULT_OK); 79 DCHECK_EQ(result, MOJO_RESULT_OK);
80 } 80 }
81 return std::move(response_); 81 return std::move(response_);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 loader_callback_.Run(nullptr); 244 loader_callback_.Run(nullptr);
245 return; 245 return;
246 } 246 }
247 247
248 response_ = std::move(response); 248 response_ = std::move(response);
249 loader_callback_.Run(std::move(owner)); 249 loader_callback_.Run(std::move(owner));
250 } 250 }
251 251
252 } // namespace shell 252 } // namespace shell
253 } // namespace mojo 253 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/connect_to_application_params.cc ('k') | mojo/shell/package_manager/capability_filter_content_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698