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

Side by Side Diff: media/blink/buffered_resource_loader.cc

Issue 1904253002: Convert //media/blink from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "media/blink/buffered_resource_loader.h" 5 #include "media/blink/buffered_resource_loader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 174 }
175 175
176 frame->setReferrerForRequest(request, blink::WebURL()); 176 frame->setReferrerForRequest(request, blink::WebURL());
177 177
178 // Disable compression, compression for audio/video doesn't make sense... 178 // Disable compression, compression for audio/video doesn't make sense...
179 request.setHTTPHeaderField( 179 request.setHTTPHeaderField(
180 WebString::fromUTF8(net::HttpRequestHeaders::kAcceptEncoding), 180 WebString::fromUTF8(net::HttpRequestHeaders::kAcceptEncoding),
181 WebString::fromUTF8("identity;q=1, *;q=0")); 181 WebString::fromUTF8("identity;q=1, *;q=0"));
182 182
183 // Check for our test WebURLLoader. 183 // Check for our test WebURLLoader.
184 scoped_ptr<WebURLLoader> loader; 184 std::unique_ptr<WebURLLoader> loader;
185 if (test_loader_) { 185 if (test_loader_) {
186 loader = std::move(test_loader_); 186 loader = std::move(test_loader_);
187 } else { 187 } else {
188 WebURLLoaderOptions options; 188 WebURLLoaderOptions options;
189 if (cors_mode_ == kUnspecified) { 189 if (cors_mode_ == kUnspecified) {
190 options.allowCredentials = true; 190 options.allowCredentials = true;
191 options.crossOriginRequestPolicy = 191 options.crossOriginRequestPolicy =
192 WebURLLoaderOptions::CrossOriginRequestPolicyAllow; 192 WebURLLoaderOptions::CrossOriginRequestPolicyAllow;
193 } else { 193 } else {
194 options.exposeAllResponseHeaders = true; 194 options.exposeAllResponseHeaders = true;
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 << ", domain=" << error.domain.utf8().data() 548 << ", domain=" << error.domain.utf8().data()
549 << ", localizedDescription=" 549 << ", localizedDescription="
550 << error.localizedDescription.utf8().data(); 550 << error.localizedDescription.utf8().data();
551 DCHECK(active_loader_.get()); 551 DCHECK(active_loader_.get());
552 MEDIA_LOG(ERROR, media_log_) 552 MEDIA_LOG(ERROR, media_log_)
553 << "Failed loading buffered resource. Error code=" << error.reason; 553 << "Failed loading buffered resource. Error code=" << error.reason;
554 554
555 // We don't need to continue loading after failure. 555 // We don't need to continue loading after failure.
556 // 556 //
557 // Keep it alive until we exit this method so that |error| remains valid. 557 // Keep it alive until we exit this method so that |error| remains valid.
558 scoped_ptr<ActiveLoader> active_loader = std::move(active_loader_); 558 std::unique_ptr<ActiveLoader> active_loader = std::move(active_loader_);
559 loader_failed_ = true; 559 loader_failed_ = true;
560 loading_cb_.Run(kLoadingFailed); 560 loading_cb_.Run(kLoadingFailed);
561 561
562 // Don't leave start callbacks hanging around. 562 // Don't leave start callbacks hanging around.
563 if (!start_cb_.is_null()) { 563 if (!start_cb_.is_null()) {
564 DCHECK(read_cb_.is_null()) 564 DCHECK(read_cb_.is_null())
565 << "Shouldn't have a read callback during start"; 565 << "Shouldn't have a read callback during start";
566 DoneStart(kFailed); 566 DoneStart(kFailed);
567 return; 567 return;
568 } 568 }
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 823
824 void BufferedResourceLoader::Log() { 824 void BufferedResourceLoader::Log() {
825 media_log_->AddEvent( 825 media_log_->AddEvent(
826 media_log_->CreateBufferedExtentsChangedEvent( 826 media_log_->CreateBufferedExtentsChangedEvent(
827 offset_ - buffer_.backward_bytes(), 827 offset_ - buffer_.backward_bytes(),
828 offset_, 828 offset_,
829 offset_ + buffer_.forward_bytes())); 829 offset_ + buffer_.forward_bytes()));
830 } 830 }
831 831
832 } // namespace media 832 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/buffered_resource_loader.h ('k') | media/blink/buffered_resource_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698