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

Side by Side Diff: content/browser/android/java/gin_java_bridge_dispatcher_host.cc

Issue 2256173002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace a WrapUnique() nested inside a MakeUnique() Created 4 years, 3 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 | content/browser/android/overscroll_controller_android.cc » ('j') | 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 "content/browser/android/java/gin_java_bridge_dispatcher_host.h" 5 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/scoped_java_ref.h" 8 #include "base/android/scoped_java_ref.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 DCHECK(JavaBridgeThread::CurrentlyOn()); 328 DCHECK(JavaBridgeThread::CurrentlyOn());
329 DCHECK(routing_id != MSG_ROUTING_NONE); 329 DCHECK(routing_id != MSG_ROUTING_NONE);
330 scoped_refptr<GinJavaBoundObject> object = FindObject(object_id); 330 scoped_refptr<GinJavaBoundObject> object = FindObject(object_id);
331 if (!object.get()) { 331 if (!object.get()) {
332 wrapped_result->Append(base::Value::CreateNullValue()); 332 wrapped_result->Append(base::Value::CreateNullValue());
333 *error_code = kGinJavaBridgeUnknownObjectId; 333 *error_code = kGinJavaBridgeUnknownObjectId;
334 return; 334 return;
335 } 335 }
336 scoped_refptr<GinJavaMethodInvocationHelper> result = 336 scoped_refptr<GinJavaMethodInvocationHelper> result =
337 new GinJavaMethodInvocationHelper( 337 new GinJavaMethodInvocationHelper(
338 base::WrapUnique(new GinJavaBoundObjectDelegate(object)), method_name, 338 base::MakeUnique<GinJavaBoundObjectDelegate>(object), method_name,
339 arguments); 339 arguments);
340 result->Init(this); 340 result->Init(this);
341 result->Invoke(); 341 result->Invoke();
342 *error_code = result->GetInvocationError(); 342 *error_code = result->GetInvocationError();
343 if (result->HoldsPrimitiveResult()) { 343 if (result->HoldsPrimitiveResult()) {
344 std::unique_ptr<base::ListValue> result_copy( 344 std::unique_ptr<base::ListValue> result_copy(
345 result->GetPrimitiveResult().DeepCopy()); 345 result->GetPrimitiveResult().DeepCopy());
346 wrapped_result->Swap(result_copy.get()); 346 wrapped_result->Swap(result_copy.get());
347 } else if (!result->GetObjectResult().is_null()) { 347 } else if (!result->GetObjectResult().is_null()) {
348 GinJavaBoundObject::ObjectID returned_object_id; 348 GinJavaBoundObject::ObjectID returned_object_id;
(...skipping 24 matching lines...) Expand all
373 if (iter == objects_.end()) 373 if (iter == objects_.end())
374 return; 374 return;
375 JavaObjectWeakGlobalRef ref = 375 JavaObjectWeakGlobalRef ref =
376 RemoveHolderAndAdvanceLocked(routing_id, &iter); 376 RemoveHolderAndAdvanceLocked(routing_id, &iter);
377 if (!ref.is_empty()) { 377 if (!ref.is_empty()) {
378 RemoveFromRetainedObjectSetLocked(ref); 378 RemoveFromRetainedObjectSetLocked(ref);
379 } 379 }
380 } 380 }
381 381
382 } // namespace content 382 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/android/overscroll_controller_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698