Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: content/renderer/browser_plugin/guest_to_embedder_channel.h

Issue 10412056: Browser Plugin: Remove MapInstance from BrowserPluginHost + More cross-process navigation work (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed commented out code Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_GUEST_TO_EMBEDDER_CHANNEL_H_ 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_GUEST_TO_EMBEDDER_CHANNEL_H_
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_GUEST_TO_EMBEDDER_CHANNEL_H_ 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_GUEST_TO_EMBEDDER_CHANNEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
(...skipping 21 matching lines...) Expand all
32 // a WebGraphicsContext3DCommandBufferImpl which is owned by WebKit. Since the 32 // a WebGraphicsContext3DCommandBufferImpl which is owned by WebKit. Since the
33 // lifetime of this context is less than the lifetime of the RenderViewImpl, we 33 // lifetime of this context is less than the lifetime of the RenderViewImpl, we
34 // keep the GuestToEmbedderChannel alive as long as a RenderViewImpl has access 34 // keep the GuestToEmbedderChannel alive as long as a RenderViewImpl has access
35 // to it. If the context is lost, then the PpapiCommandBufferProxy is destroyed 35 // to it. If the context is lost, then the PpapiCommandBufferProxy is destroyed
36 // and we can safely release the reference to this GuestToEmbedderChannel held 36 // and we can safely release the reference to this GuestToEmbedderChannel held
37 // by RenderViewImpl. 37 // by RenderViewImpl.
38 class GuestToEmbedderChannel 38 class GuestToEmbedderChannel
39 : public ppapi::proxy::Dispatcher, 39 : public ppapi::proxy::Dispatcher,
40 public base::RefCounted<GuestToEmbedderChannel> { 40 public base::RefCounted<GuestToEmbedderChannel> {
41 public: 41 public:
42 explicit GuestToEmbedderChannel(const std::string& embedder_channel_manager); 42 GuestToEmbedderChannel(
43 const std::string& embedder_channel_name,
44 const IPC::ChannelHandle& embedder_channel_handle);
43 45
44 // This must be called before anything else. Returns true on success. 46 // This must be called before anything else. Returns true on success.
45 bool InitChannel(const IPC::ChannelHandle& channel_handle); 47 bool InitChannel(const IPC::ChannelHandle& channel_handle);
46 48
47 // Creates a new WebGraphicsContext3DCommandBufferImpl and returns it. 49 // Creates a new WebGraphicsContext3DCommandBufferImpl and returns it.
48 WebGraphicsContext3DCommandBufferImpl* CreateWebGraphicsContext3D( 50 WebGraphicsContext3DCommandBufferImpl* CreateWebGraphicsContext3D(
49 RenderViewImpl* render_view, 51 RenderViewImpl* render_view,
50 const WebKit::WebGraphicsContext3D::Attributes& attributes, 52 const WebKit::WebGraphicsContext3D::Attributes& attributes,
51 bool offscreen); 53 bool offscreen);
52 54
(...skipping 10 matching lines...) Expand all
63 bool offscreen, 65 bool offscreen,
64 RenderViewImpl* render_view); 66 RenderViewImpl* render_view);
65 67
66 // Register the given RenderView with the given PP_Instance. 68 // Register the given RenderView with the given PP_Instance.
67 void AddGuest(PP_Instance instance, RenderViewImpl* render_view); 69 void AddGuest(PP_Instance instance, RenderViewImpl* render_view);
68 70
69 // Removes the guest with the given instance identifier from the 71 // Removes the guest with the given instance identifier from the
70 // InstanceMap. 72 // InstanceMap.
71 void RemoveGuest(PP_Instance instance); 73 void RemoveGuest(PP_Instance instance);
72 74
75 const std::string& embedder_channel_name() const {
76 return embedder_channel_name_;
77 }
78
79 const IPC::ChannelHandle& embedder_channel_handle() const {
80 return embedder_channel_handle_;
81 }
82
73 // ppapi::proxy::Dispatcher implementation. 83 // ppapi::proxy::Dispatcher implementation.
74 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 84 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
75 virtual bool Send(IPC::Message* message) OVERRIDE; 85 virtual bool Send(IPC::Message* message) OVERRIDE;
76 virtual void OnChannelError() OVERRIDE; 86 virtual void OnChannelError() OVERRIDE;
77 virtual bool IsPlugin() const OVERRIDE; 87 virtual bool IsPlugin() const OVERRIDE;
78 88
79 private: 89 private:
80 friend class base::RefCounted<GuestToEmbedderChannel>; 90 friend class base::RefCounted<GuestToEmbedderChannel>;
81 typedef std::map<PP_Instance, base::WeakPtr<RenderViewImpl> > InstanceMap; 91 typedef std::map<PP_Instance, base::WeakPtr<RenderViewImpl> > InstanceMap;
82 typedef std::map<int, int> RoutingIDToInstanceMap; 92 typedef std::map<int, int> RoutingIDToInstanceMap;
(...skipping 20 matching lines...) Expand all
103 113
104 void OnHandleFilteredInputEvent(PP_Instance instance, 114 void OnHandleFilteredInputEvent(PP_Instance instance,
105 const ppapi::InputEventData& data, 115 const ppapi::InputEventData& data,
106 PP_Bool* result); 116 PP_Bool* result);
107 117
108 void OnSwapBuffersACK(const ppapi::HostResource& context, 118 void OnSwapBuffersACK(const ppapi::HostResource& context,
109 int32_t pp_error); 119 int32_t pp_error);
110 120
111 void OnContextLost(PP_Instance instance); 121 void OnContextLost(PP_Instance instance);
112 122
123 void OnGuestReady(PP_Instance instance, int embedder_container_id);
124
113 base::WeakPtr<RenderViewImpl> render_view_; 125 base::WeakPtr<RenderViewImpl> render_view_;
114 BrowserPluginChannelManager* channel_manager_;
115 std::string embedder_channel_name_; 126 std::string embedder_channel_name_;
127 IPC::ChannelHandle embedder_channel_handle_;
116 PepperProxyChannelDelegateImpl delegate_; 128 PepperProxyChannelDelegateImpl delegate_;
117 129
118 InstanceMap render_view_instances_; 130 InstanceMap render_view_instances_;
119 RoutingIDToInstanceMap routing_id_instance_map_; 131 RoutingIDToInstanceMap routing_id_instance_map_;
120 132
121 DISALLOW_COPY_AND_ASSIGN(GuestToEmbedderChannel); 133 DISALLOW_COPY_AND_ASSIGN(GuestToEmbedderChannel);
122 }; 134 };
123 135
124 } // namespace content 136 } // namespace content
125 137
126 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_GUEST_TO_EMBEDDER_CHANNEL_H_ 138 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_GUEST_TO_EMBEDDER_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698