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

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

Issue 1404353004: Delay creation of BrowserPluginMsg_X messages until after attach. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 // A BrowserPluginGuest is the browser side of a browser <--> embedder 5 // A BrowserPluginGuest is the browser side of a browser <--> embedder
6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder 6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder
7 // renderer side of browser <--> embedder renderer communication. 7 // renderer side of browser <--> embedder renderer communication.
8 // 8 //
9 // BrowserPluginGuest lives on the UI thread of the browser process. Any 9 // BrowserPluginGuest lives on the UI thread of the browser process. Any
10 // messages about the guest render process that the embedder might be interested 10 // messages about the guest render process that the embedder might be interested
11 // in receiving should be listened for here. 11 // in receiving should be listened for here.
12 // 12 //
13 // BrowserPluginGuest is a WebContentsObserver for the guest WebContents. 13 // BrowserPluginGuest is a WebContentsObserver for the guest WebContents.
14 // BrowserPluginGuest operates under the assumption that the guest will be 14 // BrowserPluginGuest operates under the assumption that the guest will be
15 // accessible through only one RenderViewHost for the lifetime of 15 // accessible through only one RenderViewHost for the lifetime of
16 // the guest WebContents. Thus, cross-process navigation is not supported. 16 // the guest WebContents. Thus, cross-process navigation is not supported.
17 17
18 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 18 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
19 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 19 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
20 20
21 #include <functional>
21 #include <map> 22 #include <map>
22 #include <queue> 23 #include <queue>
23 24
24 #include "base/compiler_specific.h" 25 #include "base/compiler_specific.h"
25 #include "base/memory/linked_ptr.h" 26 #include "base/memory/linked_ptr.h"
26 #include "base/memory/weak_ptr.h" 27 #include "base/memory/weak_ptr.h"
27 #include "base/values.h" 28 #include "base/values.h"
28 #include "content/common/edit_command.h" 29 #include "content/common/edit_command.h"
29 #include "content/common/input/input_event_ack_state.h" 30 #include "content/common/input/input_event_ack_state.h"
30 #include "content/public/browser/browser_plugin_guest_delegate.h" 31 #include "content/public/browser/browser_plugin_guest_delegate.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 namespace content { 64 namespace content {
64 65
65 class BrowserPluginGuestManager; 66 class BrowserPluginGuestManager;
66 class RenderViewHostImpl; 67 class RenderViewHostImpl;
67 class RenderWidgetHost; 68 class RenderWidgetHost;
68 class RenderWidgetHostView; 69 class RenderWidgetHostView;
69 class RenderWidgetHostViewBase; 70 class RenderWidgetHostViewBase;
70 class SiteInstance; 71 class SiteInstance;
71 struct DropData; 72 struct DropData;
72 73
74 typedef std::function<IPC::Message*(int browser_plugin_id)>
lazyboy 2015/10/16 00:15:48 Guess the mac bots didn't like it. Lucas and I cou
75 BrowserPluginMessageFunc;
76
73 // A browser plugin guest provides functionality for WebContents to operate in 77 // A browser plugin guest provides functionality for WebContents to operate in
74 // the guest role and implements guest-specific overrides for ViewHostMsg_* 78 // the guest role and implements guest-specific overrides for ViewHostMsg_*
75 // messages. 79 // messages.
76 // 80 //
77 // When a guest is initially created, it is in an unattached state. That is, 81 // When a guest is initially created, it is in an unattached state. That is,
78 // it is not visible anywhere and has no embedder WebContents assigned. 82 // it is not visible anywhere and has no embedder WebContents assigned.
79 // A BrowserPluginGuest is said to be "attached" if it has an embedder. 83 // A BrowserPluginGuest is said to be "attached" if it has an embedder.
80 // A BrowserPluginGuest can also create a new unattached guest via 84 // A BrowserPluginGuest can also create a new unattached guest via
81 // CreateNewWindow. The newly created guest will live in the same partition, 85 // CreateNewWindow. The newly created guest will live in the same partition,
82 // which means it can share storage and can script this guest. 86 // which means it can share storage and can script this guest.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // Therefore, the coordinates of the context menu event with respect to the 199 // Therefore, the coordinates of the context menu event with respect to the
196 // container window are modifed with the guest renderer process beiung unaware 200 // container window are modifed with the guest renderer process beiung unaware
197 // of the change. Then eventually, when the context menu event arrives at the 201 // of the change. Then eventually, when the context menu event arrives at the
198 // browser, it contains the wrong coordinates (BUG=470087). 202 // browser, it contains the wrong coordinates (BUG=470087).
199 // TODO(ekaramad): Find a more fundamental solution and remove this later. 203 // TODO(ekaramad): Find a more fundamental solution and remove this later.
200 void SetContextMenuPosition(const gfx::Point& position); 204 void SetContextMenuPosition(const gfx::Point& position);
201 205
202 // Helper to send messages to embedder. If this guest is not yet attached, 206 // Helper to send messages to embedder. If this guest is not yet attached,
203 // then IPCs will be queued until attachment. 207 // then IPCs will be queued until attachment.
204 void SendMessageToEmbedder(IPC::Message* msg); 208 void SendMessageToEmbedder(IPC::Message* msg);
209 void SendMessageToEmbedder(BrowserPluginMessageFunc msg_func);
205 210
206 // Returns whether the guest is attached to an embedder. 211 // Returns whether the guest is attached to an embedder.
207 bool attached() const { return attached_; } 212 bool attached() const { return attached_; }
208 213
209 // Returns true when an attachment has taken place since the last time the 214 // Returns true when an attachment has taken place since the last time the
210 // compositor surface was set. 215 // compositor surface was set.
211 bool has_attached_since_surface_set() const { 216 bool has_attached_since_surface_set() const {
212 return has_attached_since_surface_set_; 217 return has_attached_since_surface_set_;
213 } 218 }
214 219
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 // Subsequent frames are not generated until the IPC is ACKed. We would like 458 // Subsequent frames are not generated until the IPC is ACKed. We would like
454 // to ensure that the guest generates frames on attachment so we directly ACK 459 // to ensure that the guest generates frames on attachment so we directly ACK
455 // an unACKed CFS. ACKs could get lost between the time a guest is detached 460 // an unACKed CFS. ACKs could get lost between the time a guest is detached
456 // from a container and the time it is attached elsewhere. This mitigates this 461 // from a container and the time it is attached elsewhere. This mitigates this
457 // race by ensuring the guest is ACKed on attachment. 462 // race by ensuring the guest is ACKed on attachment.
458 scoped_ptr<FrameMsg_CompositorFrameSwapped_Params> last_pending_frame_; 463 scoped_ptr<FrameMsg_CompositorFrameSwapped_Params> last_pending_frame_;
459 464
460 // This is a queue of messages that are destined to be sent to the embedder 465 // This is a queue of messages that are destined to be sent to the embedder
461 // once the guest is attached to a particular embedder. 466 // once the guest is attached to a particular embedder.
462 std::deque<linked_ptr<IPC::Message> > pending_messages_; 467 std::deque<linked_ptr<IPC::Message> > pending_messages_;
468 std::deque<BrowserPluginMessageFunc> pending_message_funcs_;
463 469
464 BrowserPluginGuestDelegate* const delegate_; 470 BrowserPluginGuestDelegate* const delegate_;
465 471
466 // Weak pointer used to ask GeolocationPermissionContext about geolocation 472 // Weak pointer used to ask GeolocationPermissionContext about geolocation
467 // permission. 473 // permission.
468 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; 474 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_;
469 475
470 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); 476 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
471 }; 477 };
472 478
473 } // namespace content 479 } // namespace content
474 480
475 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 481 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698