New issue
Advanced search Search tips

Issue 770007 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

extensions::ExternalInstallInfo and related are awfully pointer-y

Project Member Reported by rdevlin....@chromium.org, Sep 29 2017

Issue description

extensions::ExternalInstallInfo [1] is awfully pointery.  Each subclass (ExternalInstallInfoFile and ExternalInstallInfoUpdateUrl) has a member stored in a unique_ptr for no real reason, and they are passed around in vectors of unique pointers.  We should un-pointer-ify them to reduce allocation cost as well as necessary nullchecks and redirections.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Sep 29 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d4c2a8f3fe9881cf21d00787c7ca422a0bbf6c2d

commit d4c2a8f3fe9881cf21d00787c7ca422a0bbf6c2d
Author: Devlin Cronin <rdevlin.cronin@chromium.org>
Date: Fri Sep 29 17:08:30 2017

[Extensions] Make ExternalInstallInfo less pointer-y

Remove the std::unique_ptr<> members from ExternalInstallInfoFile and
ExternalInstallInfoUpdateUrl. These were used to hold the version and
url members, but each of these will never be null and are cheaply 
copyable (or, in the case of GURL, movable), so have no reason to
be pointers.

Bug:  770007 
Change-Id: I4b9c3ef8c9888a2d460ab082a9fa3339423a5ee6
Reviewed-on: https://chromium-review.googlesource.com/691045
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: Karan Bhatia <karandeepb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505398}
[modify] https://crrev.com/d4c2a8f3fe9881cf21d00787c7ca422a0bbf6c2d/chrome/browser/extensions/content_verifier_browsertest.cc
[modify] https://crrev.com/d4c2a8f3fe9881cf21d00787c7ca422a0bbf6c2d/chrome/browser/extensions/extension_service.cc
[modify] https://crrev.com/d4c2a8f3fe9881cf21d00787c7ca422a0bbf6c2d/chrome/browser/extensions/extension_service_unittest.cc
[modify] https://crrev.com/d4c2a8f3fe9881cf21d00787c7ca422a0bbf6c2d/chrome/browser/extensions/external_provider_impl.cc
[modify] https://crrev.com/d4c2a8f3fe9881cf21d00787c7ca422a0bbf6c2d/extensions/browser/external_install_info.cc
[modify] https://crrev.com/d4c2a8f3fe9881cf21d00787c7ca422a0bbf6c2d/extensions/browser/external_install_info.h
[modify] https://crrev.com/d4c2a8f3fe9881cf21d00787c7ca422a0bbf6c2d/extensions/browser/mock_external_provider.cc

Project Member

Comment 2 by bugdroid1@chromium.org, Oct 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/19f70b6a0d53a9cce4aff3cb62fbaef8be3981d4

commit 19f70b6a0d53a9cce4aff3cb62fbaef8be3981d4
Author: Devlin Cronin <rdevlin.cronin@chromium.org>
Date: Sun Oct 01 04:14:05 2017

[Extensions] Don't store ExternalInstallInfo in vectors of pointers

ExternalInstallInfos are currently stored in
std::vector<std::unique_ptr<T>>s, but they should just be stored in
std::vector<T>s (where T is either ExternalInstallInfoFile or
ExternalInstallInfoUpdateUrl). Once constructed, the vectors
themselves are never passed, so the only time moves are necessary is
during vector resizing, which for the number of external extensions
users should be relatively rare. Additionally, the structs themselves
are fairly cheap to move. Save on dynamic allocations and just store
these in std::vectors.

TBR=stevenjb@chromium.org for customization/customization_document_unittest.cc

Bug:  770007 
Change-Id: Ic3e3ea2de8ee09455fc021914eba20e1bdca2df0
Reviewed-on: https://chromium-review.googlesource.com/692975
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: Karan Bhatia <karandeepb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505501}
[modify] https://crrev.com/19f70b6a0d53a9cce4aff3cb62fbaef8be3981d4/chrome/browser/chromeos/customization/customization_document_unittest.cc
[modify] https://crrev.com/19f70b6a0d53a9cce4aff3cb62fbaef8be3981d4/chrome/browser/chromeos/extensions/device_local_account_external_policy_loader_unittest.cc
[modify] https://crrev.com/19f70b6a0d53a9cce4aff3cb62fbaef8be3981d4/chrome/browser/extensions/extension_service.cc
[modify] https://crrev.com/19f70b6a0d53a9cce4aff3cb62fbaef8be3981d4/chrome/browser/extensions/extension_service.h
[modify] https://crrev.com/19f70b6a0d53a9cce4aff3cb62fbaef8be3981d4/chrome/browser/extensions/extension_service_unittest.cc
[modify] https://crrev.com/19f70b6a0d53a9cce4aff3cb62fbaef8be3981d4/chrome/browser/extensions/external_policy_loader_unittest.cc
[modify] https://crrev.com/19f70b6a0d53a9cce4aff3cb62fbaef8be3981d4/chrome/browser/extensions/external_provider_impl.cc
[modify] https://crrev.com/19f70b6a0d53a9cce4aff3cb62fbaef8be3981d4/chrome/browser/extensions/external_provider_impl.h
[modify] https://crrev.com/19f70b6a0d53a9cce4aff3cb62fbaef8be3981d4/extensions/browser/external_install_info.cc
[modify] https://crrev.com/19f70b6a0d53a9cce4aff3cb62fbaef8be3981d4/extensions/browser/external_install_info.h
[modify] https://crrev.com/19f70b6a0d53a9cce4aff3cb62fbaef8be3981d4/extensions/browser/external_provider_interface.h

Project Member

Comment 3 by bugdroid1@chromium.org, Oct 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/92c52cac628a9ac111a2aa7e5b59996610f38e34

commit 92c52cac628a9ac111a2aa7e5b59996610f38e34
Author: Devlin Cronin <rdevlin.cronin@chromium.org>
Date: Mon Oct 02 21:29:01 2017

[Extensions] Allocate ExternalInstallInfos on the stack in unittests

ExtensionService unittests construct a bunch of ExternalInstallInfos,
but for some reason choose smart pointers over stack allocation (even
though they aren't passed anywhere). Use stack allocation instead.

Bug:  770007 
Change-Id: Ic5a2ee425581b7f887b95a49d9409a5238d2394d
Reviewed-on: https://chromium-review.googlesource.com/693396
Reviewed-by: Karan Bhatia <karandeepb@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505790}
[modify] https://crrev.com/92c52cac628a9ac111a2aa7e5b59996610f38e34/chrome/browser/extensions/extension_service_unittest.cc

Status: Fixed (was: Assigned)

Sign in to add a comment