OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |