| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ppapi/proxy/raw_var_data.h" | 5 #include "ppapi/proxy/raw_var_data.h" |
| 6 | 6 |
| 7 #include <stack> | 7 #include <stack> |
| 8 | 8 |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 creation_message_.reset(new IPC::Message(*message)); | 688 creation_message_.reset(new IPC::Message(*message)); |
| 689 else | 689 else |
| 690 creation_message_.reset(); | 690 creation_message_.reset(); |
| 691 pending_renderer_host_id_ = resource_var->GetPendingRendererHostId(); | 691 pending_renderer_host_id_ = resource_var->GetPendingRendererHostId(); |
| 692 pending_browser_host_id_ = resource_var->GetPendingBrowserHostId(); | 692 pending_browser_host_id_ = resource_var->GetPendingBrowserHostId(); |
| 693 initialized_ = true; | 693 initialized_ = true; |
| 694 return true; | 694 return true; |
| 695 } | 695 } |
| 696 | 696 |
| 697 PP_Var ResourceRawVarData::CreatePPVar(PP_Instance instance) { | 697 PP_Var ResourceRawVarData::CreatePPVar(PP_Instance instance) { |
| 698 // If pp_resource_ is NULL, it could be because we are on the plugin side and | 698 // If this is not a pending resource host, just create the var. |
| 699 // there is a pending resource host on the renderer. | 699 if (pp_resource_ || !creation_message_) { |
| 700 // TODO(mgiuca): Create a plugin-side resource in this case. | 700 return PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVar( |
| 701 // Currently, this should never occur. This will be needed when passing a | 701 pp_resource_); |
| 702 // resource from the renderer to the plugin (http://crbug.com/177017). | 702 } |
| 703 DCHECK(pp_resource_); | |
| 704 | 703 |
| 705 return PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVar(pp_resource_); | 704 // This is a pending resource host, so create the resource and var. |
| 705 return PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVar( |
| 706 instance, |
| 707 *creation_message_, |
| 708 pending_renderer_host_id_, |
| 709 pending_browser_host_id_); |
| 706 } | 710 } |
| 707 | 711 |
| 708 void ResourceRawVarData::PopulatePPVar(const PP_Var& var, | 712 void ResourceRawVarData::PopulatePPVar(const PP_Var& var, |
| 709 const std::vector<PP_Var>& graph) { | 713 const std::vector<PP_Var>& graph) { |
| 710 } | 714 } |
| 711 | 715 |
| 712 void ResourceRawVarData::Write(IPC::Message* m, | 716 void ResourceRawVarData::Write(IPC::Message* m, |
| 713 const HandleWriter& handle_writer) { | 717 const HandleWriter& handle_writer) { |
| 714 m->WriteInt(static_cast<int>(pp_resource_)); | 718 m->WriteInt(static_cast<int>(pp_resource_)); |
| 715 m->WriteInt(pending_renderer_host_id_); | 719 m->WriteInt(pending_renderer_host_id_); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 738 if (!IPC::ParamTraits<IPC::Message>::Read(m, iter, creation_message_.get())) | 742 if (!IPC::ParamTraits<IPC::Message>::Read(m, iter, creation_message_.get())) |
| 739 return false; | 743 return false; |
| 740 } else { | 744 } else { |
| 741 creation_message_.reset(); | 745 creation_message_.reset(); |
| 742 } | 746 } |
| 743 return true; | 747 return true; |
| 744 } | 748 } |
| 745 | 749 |
| 746 } // namespace proxy | 750 } // namespace proxy |
| 747 } // namespace ppapi | 751 } // namespace ppapi |
| OLD | NEW |