| 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/java_handler_thread.h" | 7 #include "base/android/java_handler_thread.h" |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 result.Append(base::Value::CreateNullValue()); | 453 result.Append(base::Value::CreateNullValue()); |
| 454 IPC::WriteParam(reply_msg, result); | 454 IPC::WriteParam(reply_msg, result); |
| 455 IPC::WriteParam(reply_msg, kGinJavaBridgeUnknownObjectId); | 455 IPC::WriteParam(reply_msg, kGinJavaBridgeUnknownObjectId); |
| 456 render_frame_host->Send(reply_msg); | 456 render_frame_host->Send(reply_msg); |
| 457 return; | 457 return; |
| 458 } | 458 } |
| 459 DCHECK(!HasPendingReply(render_frame_host)); | 459 DCHECK(!HasPendingReply(render_frame_host)); |
| 460 pending_replies_[render_frame_host] = reply_msg; | 460 pending_replies_[render_frame_host] = reply_msg; |
| 461 scoped_refptr<GinJavaMethodInvocationHelper> result = | 461 scoped_refptr<GinJavaMethodInvocationHelper> result = |
| 462 new GinJavaMethodInvocationHelper( | 462 new GinJavaMethodInvocationHelper( |
| 463 make_scoped_ptr(new GinJavaBoundObjectDelegate(object)) | 463 make_scoped_ptr(new GinJavaBoundObjectDelegate(object)), |
| 464 .PassAs<GinJavaMethodInvocationHelper::ObjectDelegate>(), | |
| 465 method_name, | 464 method_name, |
| 466 arguments); | 465 arguments); |
| 467 result->Init(this); | 466 result->Init(this); |
| 468 g_background_thread.Get() | 467 g_background_thread.Get() |
| 469 .message_loop() | 468 .message_loop() |
| 470 ->message_loop_proxy() | 469 ->message_loop_proxy() |
| 471 ->PostTaskAndReply( | 470 ->PostTaskAndReply( |
| 472 FROM_HERE, | 471 FROM_HERE, |
| 473 base::Bind(&GinJavaMethodInvocationHelper::Invoke, result), | 472 base::Bind(&GinJavaMethodInvocationHelper::Invoke, result), |
| 474 base::Bind( | 473 base::Bind( |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 pending_replies_.erase(it); | 563 pending_replies_.erase(it); |
| 565 return reply_msg; | 564 return reply_msg; |
| 566 } | 565 } |
| 567 | 566 |
| 568 bool GinJavaBridgeDispatcherHost::HasPendingReply( | 567 bool GinJavaBridgeDispatcherHost::HasPendingReply( |
| 569 RenderFrameHost* render_frame_host) const { | 568 RenderFrameHost* render_frame_host) const { |
| 570 return pending_replies_.find(render_frame_host) != pending_replies_.end(); | 569 return pending_replies_.find(render_frame_host) != pending_replies_.end(); |
| 571 } | 570 } |
| 572 | 571 |
| 573 } // namespace content | 572 } // namespace content |
| OLD | NEW |