New issue
Advanced search Search tips

Issue 710679 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Apr 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

Make CloudPolicyValidator memory management clearer

Project Member Reported by emaxx@chromium.org, Apr 11 2017

Issue description

We can use C++11 constructs for cleaning up the following cases:

1. Use of raw pointers when there's an ownership passing semantics in some places.
2. StartValidation() gathers ownership on the object (while RunValidation() not).
 

Comment 1 by emaxx@chromium.org, Apr 18 2017

Status: Started (was: Assigned)
Project Member

Comment 2 by bugdroid1@chromium.org, Apr 19 2017

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

commit 18f3a62dabe898a03ad69569feb0ce37c53fc001
Author: emaxx <emaxx@chromium.org>
Date: Wed Apr 19 13:37:09 2017

Make CloudPolicyValidator memory management clearer

1. Create() becomes returning a unique_ptr instead of a raw
pointer.

2. StartValidation() becomes accepting the validator as a
unique_ptr argument instead of taking ownership over "this".
This should prevent from making bugs leading to memory
leaks or double freeing, which were hard to notice with the
old interface.

3. Minor cleanup related to C++11 features.

No change of behavior is expected to be introduced.

BUG= 710679 
TEST=existing tests

Review-Url: https://codereview.chromium.org/2817643002
Cr-Commit-Position: refs/heads/master@{#465579}

[modify] https://crrev.com/18f3a62dabe898a03ad69569feb0ce37c53fc001/chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc
[modify] https://crrev.com/18f3a62dabe898a03ad69569feb0ce37c53fc001/chrome/browser/chromeos/policy/device_local_account_policy_store.cc
[modify] https://crrev.com/18f3a62dabe898a03ad69569feb0ce37c53fc001/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
[modify] https://crrev.com/18f3a62dabe898a03ad69569feb0ce37c53fc001/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc
[modify] https://crrev.com/18f3a62dabe898a03ad69569feb0ce37c53fc001/chrome/browser/chromeos/settings/session_manager_operation.cc
[modify] https://crrev.com/18f3a62dabe898a03ad69569feb0ce37c53fc001/components/policy/core/common/cloud/cloud_policy_validator.cc
[modify] https://crrev.com/18f3a62dabe898a03ad69569feb0ce37c53fc001/components/policy/core/common/cloud/cloud_policy_validator.h
[modify] https://crrev.com/18f3a62dabe898a03ad69569feb0ce37c53fc001/components/policy/core/common/cloud/cloud_policy_validator_unittest.cc
[modify] https://crrev.com/18f3a62dabe898a03ad69569feb0ce37c53fc001/components/policy/core/common/cloud/user_cloud_policy_store.cc
[modify] https://crrev.com/18f3a62dabe898a03ad69569feb0ce37c53fc001/components/policy/core/common/cloud/user_cloud_policy_store_base.cc

Comment 3 by emaxx@chromium.org, Apr 19 2017

Status: Fixed (was: Started)
Status: Verified (was: Fixed)
as per #2

Sign in to add a comment