| 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 if (FindObjectId(result->GetObjectResult(), &returned_object_id)) { | 350 if (FindObjectId(result->GetObjectResult(), &returned_object_id)) { |
| 351 base::AutoLock locker(objects_lock_); | 351 base::AutoLock locker(objects_lock_); |
| 352 objects_[returned_object_id]->AddHolder(routing_id); | 352 objects_[returned_object_id]->AddHolder(routing_id); |
| 353 } else { | 353 } else { |
| 354 returned_object_id = AddObject(result->GetObjectResult(), | 354 returned_object_id = AddObject(result->GetObjectResult(), |
| 355 result->GetSafeAnnotationClass(), | 355 result->GetSafeAnnotationClass(), |
| 356 false, | 356 false, |
| 357 routing_id); | 357 routing_id); |
| 358 } | 358 } |
| 359 wrapped_result->Append( | 359 wrapped_result->Append( |
| 360 GinJavaBridgeValue::CreateObjectIDValue( | 360 GinJavaBridgeValue::CreateObjectIDValue(returned_object_id)); |
| 361 returned_object_id).release()); | |
| 362 } else { | 361 } else { |
| 363 wrapped_result->Append(base::MakeUnique<base::Value>()); | 362 wrapped_result->Append(base::MakeUnique<base::Value>()); |
| 364 } | 363 } |
| 365 } | 364 } |
| 366 | 365 |
| 367 void GinJavaBridgeDispatcherHost::OnObjectWrapperDeleted( | 366 void GinJavaBridgeDispatcherHost::OnObjectWrapperDeleted( |
| 368 int routing_id, | 367 int routing_id, |
| 369 GinJavaBoundObject::ObjectID object_id) { | 368 GinJavaBoundObject::ObjectID object_id) { |
| 370 DCHECK(JavaBridgeThread::CurrentlyOn()); | 369 DCHECK(JavaBridgeThread::CurrentlyOn()); |
| 371 DCHECK(routing_id != MSG_ROUTING_NONE); | 370 DCHECK(routing_id != MSG_ROUTING_NONE); |
| 372 base::AutoLock locker(objects_lock_); | 371 base::AutoLock locker(objects_lock_); |
| 373 auto iter = objects_.find(object_id); | 372 auto iter = objects_.find(object_id); |
| 374 if (iter == objects_.end()) | 373 if (iter == objects_.end()) |
| 375 return; | 374 return; |
| 376 JavaObjectWeakGlobalRef ref = | 375 JavaObjectWeakGlobalRef ref = |
| 377 RemoveHolderAndAdvanceLocked(routing_id, &iter); | 376 RemoveHolderAndAdvanceLocked(routing_id, &iter); |
| 378 if (!ref.is_uninitialized()) { | 377 if (!ref.is_uninitialized()) { |
| 379 RemoveFromRetainedObjectSetLocked(ref); | 378 RemoveFromRetainedObjectSetLocked(ref); |
| 380 } | 379 } |
| 381 } | 380 } |
| 382 | 381 |
| 383 } // namespace content | 382 } // namespace content |
| OLD | NEW |