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

Unified Diff: android_webview/browser/net/aw_request_interceptor.cc

Issue 1852513003: Convert //android_webview to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git is hard Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/browser/net/aw_request_interceptor.cc
diff --git a/android_webview/browser/net/aw_request_interceptor.cc b/android_webview/browser/net/aw_request_interceptor.cc
index 62e06197aeb93dba9f2fd91efc5ffcf3389d5125..fd07a1b6490421c867bc8e2b9e2c004ac6d8ae34 100644
--- a/android_webview/browser/net/aw_request_interceptor.cc
+++ b/android_webview/browser/net/aw_request_interceptor.cc
@@ -10,6 +10,7 @@
#include "android_webview/browser/input_stream.h"
#include "android_webview/browser/net/android_stream_reader_url_request_job.h"
#include "android_webview/browser/net/aw_web_resource_response.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/supports_user_data.h"
@@ -28,13 +29,13 @@ class StreamReaderJobDelegateImpl
: public AndroidStreamReaderURLRequestJob::Delegate {
public:
StreamReaderJobDelegateImpl(
- scoped_ptr<AwWebResourceResponse> aw_web_resource_response)
+ std::unique_ptr<AwWebResourceResponse> aw_web_resource_response)
: aw_web_resource_response_(std::move(aw_web_resource_response)) {
DCHECK(aw_web_resource_response_);
}
- scoped_ptr<InputStream> OpenInputStream(JNIEnv* env,
- const GURL& url) override {
+ std::unique_ptr<InputStream> OpenInputStream(JNIEnv* env,
+ const GURL& url) override {
return aw_web_resource_response_->GetInputStream(env);
}
@@ -73,16 +74,16 @@ class StreamReaderJobDelegateImpl
}
private:
- scoped_ptr<AwWebResourceResponse> aw_web_resource_response_;
+ std::unique_ptr<AwWebResourceResponse> aw_web_resource_response_;
};
class ShouldInterceptRequestAdaptor
: public AndroidStreamReaderURLRequestJob::DelegateObtainer {
public:
explicit ShouldInterceptRequestAdaptor(
- scoped_ptr<AwContentsIoThreadClient> io_thread_client)
+ std::unique_ptr<AwContentsIoThreadClient> io_thread_client)
: io_thread_client_(std::move(io_thread_client)), weak_factory_(this) {}
- ~ShouldInterceptRequestAdaptor() override {}
+ ~ShouldInterceptRequestAdaptor() override {}
void ObtainDelegate(net::URLRequest* request,
const Callback& callback) override {
@@ -98,23 +99,23 @@ class ShouldInterceptRequestAdaptor
private:
void WebResourceResponseObtained(
- scoped_ptr<AwWebResourceResponse> response) {
+ std::unique_ptr<AwWebResourceResponse> response) {
if (response) {
- callback_.Run(make_scoped_ptr(
+ callback_.Run(base::WrapUnique(
new StreamReaderJobDelegateImpl(std::move(response))));
} else {
callback_.Run(nullptr);
}
}
- scoped_ptr<AwContentsIoThreadClient> io_thread_client_;
+ std::unique_ptr<AwContentsIoThreadClient> io_thread_client_;
Callback callback_;
base::WeakPtrFactory<ShouldInterceptRequestAdaptor> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ShouldInterceptRequestAdaptor);
};
-scoped_ptr<AwContentsIoThreadClient> GetCorrespondingIoThreadClient(
+std::unique_ptr<AwContentsIoThreadClient> GetCorrespondingIoThreadClient(
net::URLRequest* request) {
if (content::ResourceRequestInfo::OriginatedFromServiceWorker(request))
return AwContentsIoThreadClient::GetServiceWorkerIoThreadClient();
@@ -143,7 +144,7 @@ net::URLRequestJob* AwRequestInterceptor::MaybeInterceptRequest(
if (request->GetUserData(kRequestAlreadyHasJobDataKey))
return nullptr;
- scoped_ptr<AwContentsIoThreadClient> io_thread_client =
+ std::unique_ptr<AwContentsIoThreadClient> io_thread_client =
GetCorrespondingIoThreadClient(request);
if (!io_thread_client)
@@ -159,7 +160,7 @@ net::URLRequestJob* AwRequestInterceptor::MaybeInterceptRequest(
new base::SupportsUserData::Data());
return new AndroidStreamReaderURLRequestJob(
request, network_delegate,
- make_scoped_ptr(
+ base::WrapUnique(
new ShouldInterceptRequestAdaptor(std::move(io_thread_client))),
true);
}
« no previous file with comments | « android_webview/browser/net/aw_request_interceptor.h ('k') | android_webview/browser/net/aw_url_request_context_getter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698