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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_host.h

Issue 10735010: 3D Compositing in <browser>, first draft. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Major changes to clean up deadlock & other issues Created 8 years, 4 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
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_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_H__ 5 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_H__
6 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_H__ 6 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_H__
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/id_map.h" 11 #include "base/id_map.h"
12 #include "content/common/browser_plugin_info.h"
scshunt 2012/08/12 01:42:45 This header seems really bad. How do other clients
12 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 14 #include "content/public/browser/notification_registrar.h"
14 #include "content/public/browser/web_contents_delegate.h" 15 #include "content/public/browser/web_contents_delegate.h"
15 #include "content/public/browser/web_contents_observer.h" 16 #include "content/public/browser/web_contents_observer.h"
16 #include "ppapi/c/pp_instance.h" 17 #include "ppapi/c/pp_instance.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
18 #include "ui/gfx/rect.h" 19 #include "ui/gfx/rect.h"
19 #include "ui/gfx/size.h" 20 #include "ui/gfx/size.h"
20 #include "ui/surface/transport_dib.h" 21 #include "ui/surface/transport_dib.h"
21 #include "webkit/glue/webcursor.h" 22 #include "webkit/glue/webcursor.h"
22 23
23 class WebContentsImpl; 24 class WebContentsImpl;
25 struct BrowserPlugin_SwapInfo;
24 struct BrowserPluginHostMsg_PostMessage_Params; 26 struct BrowserPluginHostMsg_PostMessage_Params;
25 struct ViewHostMsg_UpdateRect_Params; 27 struct ViewHostMsg_UpdateRect_Params;
26 28
27 namespace IPC { 29 namespace IPC {
28 struct ChannelHandle; 30 struct ChannelHandle;
29 } 31 }
30 32
31 namespace content { 33 namespace content {
32 34
33 class RenderProcessHost; 35 class RenderProcessHost;
(...skipping 12 matching lines...) Expand all
46 // BrowserPluginHost is owned by a WebContentsImpl. Here it takes in its 48 // BrowserPluginHost is owned by a WebContentsImpl. Here it takes in its
47 // owner. The owner can be either a guest or embedder WebContents. 49 // owner. The owner can be either a guest or embedder WebContents.
48 explicit BrowserPluginHost(WebContentsImpl* web_contents); 50 explicit BrowserPluginHost(WebContentsImpl* web_contents);
49 51
50 virtual ~BrowserPluginHost(); 52 virtual ~BrowserPluginHost();
51 53
52 // This is called on the first navigation of the browser plugin. It creates 54 // This is called on the first navigation of the browser plugin. It creates
53 // a new WebContentsImpl for the guest, associates it with its embedder, sets 55 // a new WebContentsImpl for the guest, associates it with its embedder, sets
54 // its size and navigates it to the src URL. 56 // its size and navigates it to the src URL.
55 void NavigateOrCreateGuest(RenderViewHost* render_view_host, 57 void NavigateOrCreateGuest(RenderViewHost* render_view_host,
56 int instance_id, 58 int instance_id,
57 long long frame_id, 59 long long frame_id,
58 const std::string& src); 60 const std::string& src,
61 const BrowserPluginHostMsg_Surface_Params& params);
59 62
60 void ResizeGuest(int instance_id, 63 void ResizeGuest(int instance_id,
61 TransportDIB* damage_buffer, 64 TransportDIB* damage_buffer,
62 int width, 65 int width,
63 int height, 66 int height,
64 bool resize_pending, 67 bool resize_pending,
65 float scale_factor); 68 float scale_factor);
66 69
67 void UpdateRect(RenderViewHost* render_view_host, 70 void UpdateRect(RenderViewHost* render_view_host,
68 const ViewHostMsg_UpdateRect_Params& params); 71 const ViewHostMsg_UpdateRect_Params& params);
(...skipping 13 matching lines...) Expand all
82 85
83 RenderProcessHost* embedder_render_process_host() const { 86 RenderProcessHost* embedder_render_process_host() const {
84 return embedder_render_process_host_; 87 return embedder_render_process_host_;
85 } 88 }
86 int instance_id() const { return instance_id_; } 89 int instance_id() const { return instance_id_; }
87 void SetDamageBuffer(TransportDIB* damage_buffer, 90 void SetDamageBuffer(TransportDIB* damage_buffer,
88 const gfx::Size& size, 91 const gfx::Size& size,
89 float scale_factor); 92 float scale_factor);
90 TransportDIB* damage_buffer() const { return damage_buffer_; } 93 TransportDIB* damage_buffer() const { return damage_buffer_; }
91 const gfx::Size& damage_buffer_size() const { return damage_buffer_size_; } 94 const gfx::Size& damage_buffer_size() const { return damage_buffer_size_; }
95
96 void SendBuffersSwappedToEmbedder(
97 uint64 surface_handle,
98 const BrowserPlugin_SwapInfo& info);
99 void SendSurfaceResizeToEmbedder(const gfx::Size& size);
100
101 void set_surface_params(const BrowserPluginHostMsg_Surface_Params& params) {
102 surface_params_ = params;
103 }
104
92 float damage_buffer_scale_factor() const { 105 float damage_buffer_scale_factor() const {
93 return damage_buffer_scale_factor_; 106 return damage_buffer_scale_factor_;
94 } 107 }
95 108
96 private: 109 private:
97 typedef std::map<WebContents*, int64> GuestMap; 110 typedef std::map<WebContents*, int64> GuestMap;
98 typedef std::map<int, BrowserPluginHost*> ContainerInstanceMap; 111 typedef std::map<int, BrowserPluginHost*> ContainerInstanceMap;
99 friend class BrowserPluginHostHelper; 112 friend class BrowserPluginHostHelper;
100 113
101 // Get a guest BrowserPluginHost by its container ID specified 114 // Get a guest BrowserPluginHost by its container ID specified
(...skipping 10 matching lines...) Expand all
112 embedder_render_process_host_ = embedder_render_process_host; 125 embedder_render_process_host_ = embedder_render_process_host;
113 } 126 }
114 void set_instance_id(int instance_id) { instance_id_ = instance_id; } 127 void set_instance_id(int instance_id) { instance_id_ = instance_id; }
115 128
116 void DestroyGuests(); 129 void DestroyGuests();
117 // Destroy a specific guest if possible. This is a no-op if the guest id is 130 // Destroy a specific guest if possible. This is a no-op if the guest id is
118 // unknown as we may already have removed it for a different reason. 131 // unknown as we may already have removed it for a different reason.
119 void DestroyGuestByInstanceID(int instance_id); 132 void DestroyGuestByInstanceID(int instance_id);
120 133
121 // WebContentsDelegate implementation. 134 // WebContentsDelegate implementation.
122 virtual bool TakeFocus(bool reverse) OVERRIDE; 135 virtual bool TakeFocus(WebContents* source, bool reverse) OVERRIDE;
scshunt 2012/08/12 01:42:45 This change shouldn't be here.
123 virtual void RendererUnresponsive(WebContents* source) OVERRIDE; 136 virtual void RendererUnresponsive(WebContents* source) OVERRIDE;
124 137
125 // WebContentsObserver implementation. 138 // WebContentsObserver implementation.
126 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 139 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
127 // Used to monitor frame navigation to cleanup guests when a frame navigates 140 // Used to monitor frame navigation to cleanup guests when a frame navigates
128 // away from the browser plugin it's hosting. 141 // away from the browser plugin it's hosting.
129 virtual void DidCommitProvisionalLoadForFrame( 142 virtual void DidCommitProvisionalLoadForFrame(
130 int64 frame_id, 143 int64 frame_id,
131 bool is_main_frame, 144 bool is_main_frame,
132 const GURL& url, 145 const GURL& url,
(...skipping 16 matching lines...) Expand all
149 int instance_id_; 162 int instance_id_;
150 TransportDIB* damage_buffer_; 163 TransportDIB* damage_buffer_;
151 gfx::Size damage_buffer_size_; 164 gfx::Size damage_buffer_size_;
152 float damage_buffer_scale_factor_; 165 float damage_buffer_scale_factor_;
153 GuestMap guests_; 166 GuestMap guests_;
154 ContainerInstanceMap guests_by_instance_id_; 167 ContainerInstanceMap guests_by_instance_id_;
155 168
156 IDMap<RenderViewHost> pending_updates_; 169 IDMap<RenderViewHost> pending_updates_;
157 int pending_update_counter_; 170 int pending_update_counter_;
158 scoped_ptr<IPC::Message> pending_input_event_reply_; 171 scoped_ptr<IPC::Message> pending_input_event_reply_;
172 BrowserPluginHostMsg_Surface_Params surface_params_;
159 gfx::Rect guest_rect_; 173 gfx::Rect guest_rect_;
160 WebCursor cursor_; 174 WebCursor cursor_;
161 175
162 DISALLOW_COPY_AND_ASSIGN(BrowserPluginHost); 176 DISALLOW_COPY_AND_ASSIGN(BrowserPluginHost);
163 }; 177 };
164 178
165 } // namespace content 179 } // namespace content
166 180
167 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_OLD_BROWSER_PLUGIN_HOST_H_ 181 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_OLD_BROWSER_PLUGIN_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698