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

Issue 6242010: Refactor away most of ExtensionRendererInfo (Closed)

Created:
9 years, 11 months ago by Aaron Boodman
Modified:
9 years, 6 months ago
CC:
chromium-reviews, Erik does not do reviews, brettw-cc_chromium.org, Aaron Boodman, pam+watch_chromium.org, Paweł Hajdan Jr., darin-cc_chromium.org
Visibility:
Public.

Description

Refactor away all the duplicate extension data structures in renderer processes by sending the full extension object instead. ExtensionRendererInfo remains, but it is now just a convenience wrapper around a map of Extension objects. This allows us to reuse all the helper methods on Extension, ExtensionIconSet, ExtensionExtent, etc without duplicating them in the renderer. Also changed broadcasts to renderers to send only changed information, not entire set of extension data again. BUG=70516 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=72654

Patch Set 1 #

Patch Set 2 : Make CanExecuteScriptOnPage an instance method #

Patch Set 3 : cleanup #

Patch Set 4 : Remove more deadness #

Total comments: 23

Patch Set 5 : address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+471 lines, -466 lines) Patch
M chrome/browser/extensions/execute_code_in_tab_function.cc View 1 1 chunk +2 lines, -9 lines 0 comments Download
M chrome/browser/extensions/extension_tabs_module.cc View 1 1 chunk +2 lines, -9 lines 0 comments Download
M chrome/browser/extensions/user_script_master.cc View 1 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/browser_render_process_host.cc View 1 2 3 4 3 chunks +93 lines, -101 lines 0 comments Download
M chrome/common/extensions/extension.h View 1 3 chunks +13 lines, -14 lines 0 comments Download
M chrome/common/extensions/extension.cc View 1 2 3 4 2 chunks +12 lines, -15 lines 0 comments Download
M chrome/common/render_messages.h View 1 2 3 1 chunk +1 line, -2 lines 0 comments Download
M chrome/common/render_messages_internal.h View 1 3 chunks +10 lines, -4 lines 0 comments Download
M chrome/common/render_messages_params.h View 1 2 3 4 2 chunks +23 lines, -25 lines 0 comments Download
M chrome/common/render_messages_params.cc View 1 2 3 4 4 chunks +68 lines, -54 lines 0 comments Download
M chrome/renderer/extensions/chrome_app_bindings.cc View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M chrome/renderer/extensions/event_bindings.cc View 1 2 3 4 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/renderer/extensions/extension_process_bindings.cc View 1 2 3 4 1 chunk +4 lines, -2 lines 0 comments Download
M chrome/renderer/extensions/extension_renderer_info.h View 1 2 3 4 1 chunk +25 lines, -47 lines 0 comments Download
M chrome/renderer/extensions/extension_renderer_info.cc View 1 2 3 4 1 chunk +30 lines, -79 lines 0 comments Download
M chrome/renderer/extensions/extension_renderer_info_unittest.cc View 1 chunk +97 lines, -53 lines 0 comments Download
M chrome/renderer/localized_error.h View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/renderer/localized_error.cc View 1 2 3 4 2 chunks +8 lines, -5 lines 0 comments Download
M chrome/renderer/mock_render_thread.h View 1 2 3 4 3 chunks +7 lines, -0 lines 0 comments Download
M chrome/renderer/mock_render_thread.cc View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/renderer/render_thread.h View 1 2 3 4 7 chunks +14 lines, -3 lines 0 comments Download
M chrome/renderer/render_thread.cc View 1 2 3 4 5 chunks +19 lines, -7 lines 0 comments Download
M chrome/renderer/render_view.cc View 1 2 3 4 6 chunks +18 lines, -20 lines 0 comments Download
M chrome/renderer/user_script_slave.h View 1 2 3 4 3 chunks +6 lines, -1 line 0 comments Download
M chrome/renderer/user_script_slave.cc View 1 2 3 4 2 chunks +5 lines, -11 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
Aaron Boodman
9 years, 11 months ago (2011-01-23 02:49:05 UTC) #1
Elliot Glaysher
I [heart] refactorings. Some very nitty nits. http://codereview.chromium.org/6242010/diff/9001/chrome/common/render_messages_params.h File chrome/common/render_messages_params.h (right): http://codereview.chromium.org/6242010/diff/9001/chrome/common/render_messages_params.h#newcode843 chrome/common/render_messages_params.h:843: dtor http://codereview.chromium.org/6242010/diff/9001/chrome/renderer/extensions/extension_renderer_info.h ...
9 years, 11 months ago (2011-01-24 19:00:28 UTC) #2
Matt Perry
Hooray! Mostly LGTM. Now, can we figure out a way to unify our three different ...
9 years, 11 months ago (2011-01-24 20:08:34 UTC) #3
Aaron Boodman
Addressed all comments. One question for Matt here: http://codereview.chromium.org/6242010/diff/9001/chrome/renderer/extensions/chrome_app_bindings.cc#newcode61 http://codereview.chromium.org/6242010/diff/9001/chrome/common/render_messages_params.cc File chrome/common/render_messages_params.cc (right): http://codereview.chromium.org/6242010/diff/9001/chrome/common/render_messages_params.cc#newcode1512 chrome/common/render_messages_params.cc:1512: ...
9 years, 11 months ago (2011-01-25 00:27:33 UTC) #4
Matt Perry
9 years, 11 months ago (2011-01-25 00:45:54 UTC) #5
LGTM

http://codereview.chromium.org/6242010/diff/9001/chrome/common/render_message...
File chrome/common/render_messages_params.cc (right):

http://codereview.chromium.org/6242010/diff/9001/chrome/common/render_message...
chrome/common/render_messages_params.cc:1512:
l->append("<ViewMsg_ExtensionLoaded_Params>");
On 2011/01/25 00:27:33, Aaron Boodman wrote:
> On 2011/01/24 20:08:34, Matt Perry wrote:
> > nit: might also put the extension ID here
> 
> We do not have the ID handy, all we have is the key. I've modified the IPC
> message to store the ID in addition, though it is only needed for this
logging.

In that case, I don't think it's really needed, just a nice to have. But if
you've already added it, may as well keep it.

http://codereview.chromium.org/6242010/diff/9001/chrome/common/render_message...
File chrome/common/render_messages_params.h (right):

http://codereview.chromium.org/6242010/diff/9001/chrome/common/render_message...
chrome/common/render_messages_params.h:841: const
ViewMsg_ExtensionLoaded_Params& other);
On 2011/01/25 00:27:33, Aaron Boodman wrote:
> On 2011/01/24 20:08:34, Matt Perry wrote:
> > when is this copy constructor used?
> 
> It is used when ViewMsg_ExtensionLoaded is instantiated. It only happens on
> older compilers, and I didn't dig into the IPC macro pile to figure exactly
what
> causes it. I added a comment explaining this.

I see. In that case, maybe making a deep copy of the manifest is not needed. You
could do
  manifest(other.release())
instead, though manifest might need to be marked mutable.

http://codereview.chromium.org/6242010/diff/9001/chrome/renderer/extensions/c...
File chrome/renderer/extensions/chrome_app_bindings.cc (right):

http://codereview.chromium.org/6242010/diff/9001/chrome/renderer/extensions/c...
chrome/renderer/extensions/chrome_app_bindings.cc:61:
RenderThread::current()->extensions()->GetByURL(url) != NULL;
On 2011/01/25 00:27:33, Aaron Boodman wrote:
> On 2011/01/24 20:08:34, Matt Perry wrote:
> > note that RenderThread::current() will be NULL in unit tests.
> 
> Really? RenderThread::current() is backed by lazy TLS. It seems like it will
> just create an instance.

Oh, well maybe things have changed since I last looked. If unit tests don't
crash, then I guess this is fine.

Powered by Google App Engine
This is Rietveld 408576698