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_) |
raymes
2013/10/30 06:31:51
nit: {} for multi-line if
Matt Giuca
2013/10/30 07:00:39
Done.
| |
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). | |
703 DCHECK(pp_resource_); | |
704 | 702 |
705 return PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVar(pp_resource_); | 703 // This is a pending resource host, so create the resource and var. |
704 return PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVar( | |
705 *creation_message_, | |
706 pending_renderer_host_id_, | |
707 pending_browser_host_id_, | |
708 instance); | |
706 } | 709 } |
707 | 710 |
708 void ResourceRawVarData::PopulatePPVar(const PP_Var& var, | 711 void ResourceRawVarData::PopulatePPVar(const PP_Var& var, |
709 const std::vector<PP_Var>& graph) { | 712 const std::vector<PP_Var>& graph) { |
710 } | 713 } |
711 | 714 |
712 void ResourceRawVarData::Write(IPC::Message* m, | 715 void ResourceRawVarData::Write(IPC::Message* m, |
713 const HandleWriter& handle_writer) { | 716 const HandleWriter& handle_writer) { |
714 m->WriteInt(static_cast<int>(pp_resource_)); | 717 m->WriteInt(static_cast<int>(pp_resource_)); |
715 m->WriteInt(pending_renderer_host_id_); | 718 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())) | 741 if (!IPC::ParamTraits<IPC::Message>::Read(m, iter, creation_message_.get())) |
739 return false; | 742 return false; |
740 } else { | 743 } else { |
741 creation_message_.reset(); | 744 creation_message_.reset(); |
742 } | 745 } |
743 return true; | 746 return true; |
744 } | 747 } |
745 | 748 |
746 } // namespace proxy | 749 } // namespace proxy |
747 } // namespace ppapi | 750 } // namespace ppapi |
OLD | NEW |