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

Issue 8760024: Cross-process postMessage (Closed)

Created:
9 years ago by supersat
Modified:
3 years, 11 months ago
CC:
Charlie Reis, darin (slow to review), awong
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

Adds support for calling postMessage on a frame living in a different renderer. This requires keeping a frame map in the browser process, which tracks the relationships between tabs, subframes, and openers. These relationships don't change as a tab navigates from one process to another. With this map, the browser can then create "swapped out" RenderViews for a tab's opener(s). All swapped out RenderViews can then act as proxies to send and receive postMessages via the browser process. BUG=99202 TEST=Use Facebook Connect within a hosted app. (Revised and committed in http://codereview.chromium.org/9108001/)

Patch Set 1 #

Total comments: 51

Patch Set 2 : New patch, still not quite done #

Total comments: 38

Patch Set 3 : A new checkpoint #

Patch Set 4 : Minor update (that should actually compile, doh!) #

Patch Set 5 : Current version #

Patch Set 6 : Some cleanup #

Total comments: 93

Patch Set 7 : Current checkpoint #

Unified diffs Side-by-side diffs Delta from patch set Stats (+787 lines, -106 lines) Patch
M chrome/browser/extensions/app_process_apitest.cc View 1 2 3 4 5 6 4 chunks +6 lines, -15 lines 0 comments Download
M chrome/browser/tab_contents/render_view_host_delegate_helper.h View 1 2 3 4 5 6 3 chunks +4 lines, -3 lines 0 comments Download
M chrome/browser/tab_contents/render_view_host_delegate_helper.cc View 1 2 3 4 5 6 5 chunks +8 lines, -7 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents_view_gtk.h View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/tab_contents/tab_contents_view_gtk.cc View 1 2 3 4 5 6 1 chunk +4 lines, -3 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents_view_mac.h View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/tab_contents/tab_contents_view_mac.mm View 1 2 3 4 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/browser/ui/browser.cc View 1 2 3 4 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/ui/browser_navigator.cc View 1 2 3 4 5 1 chunk +4 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/tab_contents/tab_contents_view_views.h View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc View 1 2 3 4 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/common/extensions/extension_process_policy.cc View 1 2 3 4 1 chunk +0 lines, -19 lines 0 comments Download
A content/browser/content_frame.h View 1 2 3 4 5 6 1 chunk +93 lines, -0 lines 0 comments Download
A content/browser/content_frame.cc View 1 2 3 4 5 6 1 chunk +103 lines, -0 lines 0 comments Download
A content/browser/frame_map.h View 1 2 3 4 5 6 1 chunk +60 lines, -0 lines 0 comments Download
A content/browser/frame_map.cc View 1 2 3 4 5 6 1 chunk +100 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.h View 1 2 3 4 2 chunks +3 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.cc View 1 2 3 4 5 6 2 chunks +31 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_view_host.h View 1 2 3 4 5 3 chunks +11 lines, -1 line 0 comments Download
M content/browser/renderer_host/render_view_host.cc View 1 2 3 4 5 6 6 chunks +28 lines, -1 line 0 comments Download
M content/browser/renderer_host/render_view_host_delegate.h View 1 2 3 4 2 chunks +3 lines, -1 line 0 comments Download
M content/browser/renderer_host/render_view_host_unittest.cc View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/tab_contents/interstitial_page.cc View 1 2 3 4 3 chunks +6 lines, -3 lines 0 comments Download
M content/browser/tab_contents/navigation_controller.h View 1 2 3 4 4 chunks +6 lines, -2 lines 0 comments Download
M content/browser/tab_contents/navigation_controller.cc View 1 2 3 4 5 5 chunks +15 lines, -7 lines 0 comments Download
M content/browser/tab_contents/navigation_entry.h View 1 2 3 2 chunks +16 lines, -0 lines 0 comments Download
M content/browser/tab_contents/navigation_entry.cc View 1 2 3 4 5 6 3 chunks +5 lines, -2 lines 0 comments Download
M content/browser/tab_contents/render_view_host_manager.h View 1 2 4 chunks +12 lines, -3 lines 0 comments Download
M content/browser/tab_contents/render_view_host_manager.cc View 1 2 3 4 5 6 8 chunks +67 lines, -7 lines 0 comments Download
M content/browser/tab_contents/tab_contents.h View 1 2 3 4 5 6 chunks +14 lines, -2 lines 0 comments Download
M content/browser/tab_contents/tab_contents.cc View 1 2 3 4 5 6 7 chunks +23 lines, -7 lines 0 comments Download
M content/browser/tab_contents/test_tab_contents.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M content/browser/tab_contents/test_tab_contents.cc View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M content/common/swapped_out_messages.cc View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M content/common/view_messages.h View 1 2 3 4 5 6 3 chunks +26 lines, -0 lines 0 comments Download
M content/content_browser.gypi View 1 2 3 4 5 6 3 chunks +5 lines, -0 lines 0 comments Download
M content/public/browser/browser_context.h View 1 2 3 4 5 6 2 chunks +6 lines, -0 lines 0 comments Download
M content/renderer/render_thread_impl.cc View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M content/renderer/render_view_impl.h View 1 2 3 4 5 6 8 chunks +15 lines, -0 lines 0 comments Download
M content/renderer/render_view_impl.cc View 1 2 3 4 5 6 18 chunks +82 lines, -3 lines 0 comments Download
M content/test/render_view_fake_resources_test.cc View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M content/test/render_view_test.cc View 1 2 3 4 5 6 2 chunks +2 lines, -1 line 0 comments Download
M content/test/test_tab_contents_view.h View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M content/test/test_tab_contents_view.cc View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 13 (0 generated)
supersat
9 years ago (2011-12-01 19:12:20 UTC) #1
Charlie Reis
Just a few thoughts to get the review started, as you continue working on this. ...
9 years ago (2011-12-01 23:13:02 UTC) #2
supersat
An updated patch. What I think is still missing: * Tearing down all of the ...
9 years ago (2011-12-09 23:08:19 UTC) #3
Charlie Reis
Thanks Karl! Making progress. A few questions and style nits inline. http://codereview.chromium.org/8760024/diff/1/chrome/common/chrome_content_client.cc File chrome/common/chrome_content_client.cc (right): ...
9 years ago (2011-12-12 22:20:36 UTC) #4
supersat
I posted a new version of this patch. There are still a few loose ends ...
9 years ago (2011-12-15 19:30:47 UTC) #5
Charlie Reis
Thanks Karl! Darin, can you take a look at the approach to see if it's ...
9 years ago (2011-12-15 19:38:34 UTC) #6
Matt Perry
drive-by http://codereview.chromium.org/8760024/diff/34001/chrome/browser/extensions/app_process_apitest.cc File chrome/browser/extensions/app_process_apitest.cc (right): http://codereview.chromium.org/8760024/diff/34001/chrome/browser/extensions/app_process_apitest.cc#newcode363 chrome/browser/extensions/app_process_apitest.cc:363: // third load stop This comment should be ...
9 years ago (2011-12-20 19:46:35 UTC) #7
awong
Hey Karl, I took a first pass at ContentFrame + FrameMap. So far, my comments ...
9 years ago (2011-12-21 01:06:38 UTC) #8
awong
http://codereview.chromium.org/8760024/diff/34001/chrome/browser/tab_contents/render_view_host_delegate_helper.h File chrome/browser/tab_contents/render_view_host_delegate_helper.h (right): http://codereview.chromium.org/8760024/diff/34001/chrome/browser/tab_contents/render_view_host_delegate_helper.h#newcode101 chrome/browser/tab_contents/render_view_host_delegate_helper.h:101: content::ContentFrame* opener, The fact that these two APIs take ...
9 years ago (2011-12-21 01:56:07 UTC) #9
jam
I glanced through this, here are my initial comments. no major issues stick out to ...
9 years ago (2011-12-22 20:06:53 UTC) #10
awong
http://codereview.chromium.org/8760024/diff/34001/content/browser/content_frame.h File content/browser/content_frame.h (right): http://codereview.chromium.org/8760024/diff/34001/content/browser/content_frame.h#newcode21 content/browser/content_frame.h:21: // to the WebKit frame that's currently active. On ...
9 years ago (2011-12-22 20:09:04 UTC) #11
Charlie Reis
http://codereview.chromium.org/8760024/diff/34001/content/browser/content_frame.h File content/browser/content_frame.h (right): http://codereview.chromium.org/8760024/diff/34001/content/browser/content_frame.h#newcode22 content/browser/content_frame.h:22: class ContentFrame { On 2011/12/22 20:06:53, John Abd-El-Malek wrote: ...
9 years ago (2011-12-22 20:13:21 UTC) #12
supersat
9 years ago (2011-12-23 03:22:46 UTC) #13
Haven't addressed everything yet...

http://codereview.chromium.org/8760024/diff/34001/chrome/browser/extensions/a...
File chrome/browser/extensions/app_process_apitest.cc (right):

http://codereview.chromium.org/8760024/diff/34001/chrome/browser/extensions/a...
chrome/browser/extensions/app_process_apitest.cc:363: //    third load stop
On 2011/12/20 19:46:36, Matt Perry wrote:
> This comment should be updated. We were trying to explain why 3 navigations
> occur for what should have been a 2 navigation event.
> 
> I think you've fixed it so this redirect happens in 2 hops, like it should.
> First navigation is to path1/redirect.html, which loads, then completes, then
> issues a meta refresh. Second starts out going to localhost/server-redirect,
> then redirects back to path1/empty.html, then completes.

Done.

http://codereview.chromium.org/8760024/diff/34001/chrome/browser/tab_contents...
File chrome/browser/tab_contents/render_view_host_delegate_helper.h (right):

http://codereview.chromium.org/8760024/diff/34001/chrome/browser/tab_contents...
chrome/browser/tab_contents/render_view_host_delegate_helper.h:70: TabContents*
CreateNewWindowFromTabContents(
On 2011/12/21 01:06:38, awong wrote:
> This function needs to be renamed.

Done.

http://codereview.chromium.org/8760024/diff/34001/chrome/browser/tab_contents...
chrome/browser/tab_contents/render_view_host_delegate_helper.h:101:
content::ContentFrame* opener,
On 2011/12/21 01:56:07, awong wrote:
> The fact that these two APIs take a ContentFrame and return a TabContents
makes
> me wonder slightly about the relationship between ContentFrame and
TabContents.
> 
> A ContentFrame is a handle to any WebFrame (top-level of not).
> 
> A TabContents seems to be both a handle onto a top-level frame as well as an
> anchor point for various bits of navigation data + UI data.
> 
> Logically, has the handle to the "top-level" change from being it's
TabContents
> object to the corresponding ContentFrame object?

When the opener TabContents was passed in before, it was only used to copy the
size of the TabContents
(http://google.com/codesearch#OAMlx_jo-ck/src/content/browser/tab_contents/tab...).
Now we're also setting the opener of the top-level ContentFrame in TabContents.
This could be a subframe of another top-level frame, so we need to pass in a
ContentFrame instead. However, we still copy the container size from the
ContentFrame's enclosing TabContents.

http://codereview.chromium.org/8760024/diff/34001/content/browser/content_fra...
File content/browser/content_frame.h (right):

http://codereview.chromium.org/8760024/diff/34001/content/browser/content_fra...
content/browser/content_frame.h:12: #include <list>
On 2011/12/21 01:06:38, awong wrote:
> C++ includes go first. Separate by a newline.

Done.

http://codereview.chromium.org/8760024/diff/34001/content/browser/content_fra...
content/browser/content_frame.h:14: namespace content {
On 2011/12/21 01:06:38, awong wrote:
> newline after namespace opener.

Done.

http://codereview.chromium.org/8760024/diff/34001/content/browser/content_fra...
content/browser/content_frame.h:21: // to the WebKit frame that's currently
active.
On 2011/12/21 01:06:38, awong wrote:
> For single class files, It's generally preferable to stuff this as the file
> comment.

Discussed offline. Agreed that keeping the comment here is most consistent.

http://codereview.chromium.org/8760024/diff/34001/content/browser/content_fra...
content/browser/content_frame.h:23: friend class FrameMap;
On 2011/12/21 01:06:38, awong wrote:
> Ick. friends. I don't like friends. That's probably why I don't have any.
> 
> Can we get rid of your friends too? ;)

Everyone seems to be hating on friends, so I'll remove it. The idea was to
prevent anyone but the FrameMap from updating the ContentFrame, since the maps
in FrameMap need to stay in sync with the ContentFrame.

http://codereview.chromium.org/8760024/diff/34001/content/browser/content_fra...
content/browser/content_frame.h:26: // TODO(supersat): Comment this once I
figure out exactly what it'll contain
On 2011/12/21 01:06:38, awong wrote:
> Can we pull this out into the content namespace?  Nested classes are annoying.

> Since this is an identifier that is used external to this class, it feels like
> it should be de-nested.
> 
>
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Nested...
> 

Done.

http://codereview.chromium.org/8760024/diff/34001/content/browser/content_fra...
content/browser/content_frame.h:27: struct WebKitFrameIdTuple {
On 2011/12/21 01:06:38, awong wrote:
> Assuming this doesn't get fragmented/renamed into smaller structs, I would
drop
> the "Tuple" from the name. It doesn't add more any more description to the
name,
> and "struct" is more of a record type than a tuple since the members are
> label-based rather than positional.

Done.

http://codereview.chromium.org/8760024/diff/34001/content/browser/content_fra...
content/browser/content_frame.h:35: int64 frame_id;
On 2011/12/22 20:06:53, John Abd-El-Malek wrote:
> why use 64 bit numbers for frame id? 32bit is fine for route_ids, and i really
> doubt we'll ever wrap around

WebFrame's identifier is 64-bit. I'm not sure why it's 64-bit (it was this way
before WebFrame was upstreamed into WebKit), but it is.

http://codereview.chromium.org/8760024/diff/34001/content/browser/content_fra...
content/browser/content_frame.h:42: virtual ~ContentFrame();
On 2011/12/21 01:06:38, awong wrote:
> No methods are virtual.  Why is the destructor virtual?

Done.

http://codereview.chromium.org/8760024/diff/34001/content/browser/content_fra...
content/browser/content_frame.h:49: const WebKitFrameIdTuple
current_webkit_frame() const {
On 2011/12/21 01:06:38, awong wrote:
> What do you think about "active" instead of "current" as variable/API name? 
> That's the adjective you're using in the comments, and it seems more
> descriptive/less "context dependent" than "current."

Done.

http://codereview.chromium.org/8760024/diff/34001/content/browser/content_fra...
content/browser/content_frame.h:54: // frame.
On 2011/12/21 01:06:38, awong wrote:
> These are duplicate accessors for data that can be retrieved via
> current_webkit_frame().  Remove one API?
> 
> Having 2 mechanisms to access the same data make it harder to trace down state
> dependencies for future maintainers.

Done.

http://codereview.chromium.org/8760024/diff/34001/content/browser/tab_content...
File content/browser/tab_contents/navigation_entry.cc (right):

http://codereview.chromium.org/8760024/diff/34001/content/browser/tab_content...
content/browser/tab_contents/navigation_entry.cc:47:
opener_content_frame_id_(-1) {
On 2011/12/21 01:56:07, awong wrote:
> There should be a constant for an invalid frame ID.
> 
> The id generator should make sure to know to avoid this constant.

Done.

http://codereview.chromium.org/8760024/diff/34001/content/browser/tab_content...
File content/browser/tab_contents/render_view_host_manager.cc (right):

http://codereview.chromium.org/8760024/diff/34001/content/browser/tab_content...
content/browser/tab_contents/render_view_host_manager.cc:845: // If we already
have a swapped out RVH
On 2011/12/21 01:56:07, awong wrote:
> Use a period at the end of a comment.

Done.

http://codereview.chromium.org/8760024/diff/34001/content/browser/tab_content...
File content/browser/tab_contents/tab_contents.cc (right):

http://codereview.chromium.org/8760024/diff/34001/content/browser/tab_content...
content/browser/tab_contents/tab_contents.cc:223:
browser_context->frame_mapper().InitializeFrame(
On 2011/12/21 01:56:07, awong wrote:
> Is it possible for to change InitializeFrame() so that the unique_id is just
> generated internally rather than needing us to pass
> browser_context->frame_mapper().AllocateFrameId() in by hand?

Previously, no. Now, yes.

http://codereview.chromium.org/8760024/diff/34001/content/common/view_messages.h
File content/common/view_messages.h (right):

http://codereview.chromium.org/8760024/diff/34001/content/common/view_message...
content/common/view_messages.h:573: // The identifier of the ContentFrame we
need are becoming a proxy for.
On 2011/12/21 01:56:07, awong wrote:
> s/need//

Done.

http://codereview.chromium.org/8760024/diff/34001/content/common/view_message...
content/common/view_messages.h:643: // The route ID of the opener RenderView if
we need to set one (-1 otherwise)
On 2011/12/21 01:56:07, awong wrote:
> use a constant?

Done.

http://codereview.chromium.org/8760024/diff/34001/content/common/view_message...
content/common/view_messages.h:644: IPC_STRUCT_MEMBER(int32, opener_route_id)
On 2011/12/22 20:06:53, John Abd-El-Malek wrote:
> nit: we usually send routing ids as just ints

Done.

http://codereview.chromium.org/8760024/diff/34001/content/common/view_message...
content/common/view_messages.h:657: IPC_STRUCT_MEMBER(string16, sourceOrigin)
On 2011/12/21 01:56:07, awong wrote:
> lowercase_and_underscores.

Done.

http://codereview.chromium.org/8760024/diff/34001/content/public/browser/brow...
File content/public/browser/browser_context.h (right):

http://codereview.chromium.org/8760024/diff/34001/content/public/browser/brow...
content/public/browser/browser_context.h:107: FrameMap& frame_mapper() { return
frame_mapper_; }
On 2011/12/21 01:06:38, awong wrote:
> We should keep BrowserContext a pure interface.  Othewise, this can start
> growing into "real inheritance" with all the fragile base class issues that
> entails.
> 
> Just say no to inheritance.
> 
> Also, returning the mapper by reference seems odd. Return it by pointer if
it's
> modifyable.

Done.

http://codereview.chromium.org/8760024/diff/34001/content/renderer/render_vie...
File content/renderer/render_view_impl.cc (right):

http://codereview.chromium.org/8760024/diff/34001/content/renderer/render_vie...
content/renderer/render_view_impl.cc:991: // canBubble and cancellable are
always false
On 2011/12/21 01:56:07, awong wrote:
> |canBubble| and |cancellable| are always false.

Done.

http://codereview.chromium.org/8760024/diff/34001/content/renderer/render_vie...
content/renderer/render_view_impl.cc:3187: if (!targetOrig.isNull())
On 2011/12/21 01:56:07, awong wrote:
> s/targetOrig/targetOrigin/g

Done.

Powered by Google App Engine
This is Rietveld 408576698