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

Unified Diff: android_webview/native/aw_contents_io_thread_client_impl.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
« no previous file with comments | « android_webview/native/aw_contents_io_thread_client_impl.h ('k') | android_webview/native/aw_debug.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/native/aw_contents_io_thread_client_impl.cc
diff --git a/android_webview/native/aw_contents_io_thread_client_impl.cc b/android_webview/native/aw_contents_io_thread_client_impl.cc
index 321c5e15a2812337385f400171a13ccb9601fd90..9b6e450817adf44c1fb117f4904ecbf03deb04e7 100644
--- a/android_webview/native/aw_contents_io_thread_client_impl.cc
+++ b/android_webview/native/aw_contents_io_thread_client_impl.cc
@@ -5,6 +5,7 @@
#include "android_webview/native/aw_contents_io_thread_client_impl.h"
#include <map>
+#include <memory>
#include <utility>
#include "android_webview/common/devtools_instrumentation.h"
@@ -14,7 +15,6 @@
#include "base/android/jni_string.h"
#include "base/android/jni_weak_ref.h"
#include "base/lazy_instance.h"
-#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
@@ -208,19 +208,21 @@ struct WebResourceRequest {
// AwContentsIoThreadClientImpl -----------------------------------------------
// static
-scoped_ptr<AwContentsIoThreadClient>
-AwContentsIoThreadClient::FromID(int render_process_id, int render_frame_id) {
+std::unique_ptr<AwContentsIoThreadClient> AwContentsIoThreadClient::FromID(
+ int render_process_id,
+ int render_frame_id) {
pair<int, int> rfh_id(render_process_id, render_frame_id);
IoThreadClientData client_data;
if (!RfhToIoThreadClientMap::GetInstance()->Get(rfh_id, &client_data))
- return scoped_ptr<AwContentsIoThreadClient>();
+ return std::unique_ptr<AwContentsIoThreadClient>();
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> java_delegate =
client_data.io_thread_client.get(env);
DCHECK(!client_data.pending_association || java_delegate.is_null());
- return scoped_ptr<AwContentsIoThreadClient>(new AwContentsIoThreadClientImpl(
- client_data.pending_association, java_delegate));
+ return std::unique_ptr<AwContentsIoThreadClient>(
+ new AwContentsIoThreadClientImpl(client_data.pending_association,
+ java_delegate));
}
// static
@@ -269,17 +271,17 @@ void AwContentsIoThreadClientImpl::SetServiceWorkerIoThreadClient(
}
// static
-scoped_ptr<AwContentsIoThreadClient>
+std::unique_ptr<AwContentsIoThreadClient>
AwContentsIoThreadClient::GetServiceWorkerIoThreadClient() {
if (g_sw_instance_.Get().is_empty())
- return scoped_ptr<AwContentsIoThreadClient>();
+ return std::unique_ptr<AwContentsIoThreadClient>();
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> java_delegate = g_sw_instance_.Get().get(env);
DCHECK(!java_delegate.is_null());
- return scoped_ptr<AwContentsIoThreadClient>(new AwContentsIoThreadClientImpl(
- false, java_delegate));
+ return std::unique_ptr<AwContentsIoThreadClient>(
+ new AwContentsIoThreadClientImpl(false, java_delegate));
}
AwContentsIoThreadClientImpl::AwContentsIoThreadClientImpl(
@@ -312,7 +314,7 @@ AwContentsIoThreadClientImpl::GetCacheMode() const {
namespace {
-scoped_ptr<AwWebResourceResponse> RunShouldInterceptRequest(
+std::unique_ptr<AwWebResourceResponse> RunShouldInterceptRequest(
WebResourceRequest web_request,
JavaObjectWeakGlobalRef ref) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
@@ -335,12 +337,12 @@ scoped_ptr<AwWebResourceResponse> RunShouldInterceptRequest(
web_request.jstring_method.obj(),
web_request.jstringArray_header_names.obj(),
web_request.jstringArray_header_values.obj());
- return scoped_ptr<AwWebResourceResponse>(
+ return std::unique_ptr<AwWebResourceResponse>(
ret.is_null() ? nullptr : new AwWebResourceResponseImpl(ret));
}
-scoped_ptr<AwWebResourceResponse> ReturnNull() {
- return scoped_ptr<AwWebResourceResponse>();
+std::unique_ptr<AwWebResourceResponse> ReturnNull() {
+ return std::unique_ptr<AwWebResourceResponse>();
}
} // namespace
@@ -349,7 +351,7 @@ void AwContentsIoThreadClientImpl::ShouldInterceptRequestAsync(
const net::URLRequest* request,
const ShouldInterceptRequestResultCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- base::Callback<scoped_ptr<AwWebResourceResponse>()> get_response =
+ base::Callback<std::unique_ptr<AwWebResourceResponse>()> get_response =
base::Bind(&ReturnNull);
JNIEnv* env = AttachCurrentThread();
if (bg_thread_client_object_.is_null() && !java_object_.is_null()) {
« no previous file with comments | « android_webview/native/aw_contents_io_thread_client_impl.h ('k') | android_webview/native/aw_debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698