0
Files
src/rlz/lib/rlz_lib_clear.cc
Greg Thompson b2170dcecf Trim dependency creep in setup.exe by splitting RLZ into non-net and net bits.
This change introduces the //rlz:rlz_lib_no_network source_set for use
by Chrome's installer on Windows. This breaks a dependency on a slew of
networking pieces that bloat setup.exe. Results from building
chrome/installer/setup at r718552:

- before: 6536 build targets -- 2,590,720 bytes
- after : 2390 build targets -- 2,298,880 bytes

-   4,146 fewer build targets (63.43% reduction)
- 291,840 bytes smaller (11.26% reduction)

BUG=1026780

Change-Id: I99892e6b0b9f730e1467a9af1af55c42ddeb8903
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1932803
Reviewed-by: Roger Tawa <rogerta@chromium.org>
Commit-Queue: Greg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719145}
2019-11-26 15:07:39 +00:00

45 lines
1.2 KiB
C++

// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "rlz/lib/rlz_lib_clear.h"
#include "rlz/lib/assert.h"
#include "rlz/lib/rlz_value_store.h"
namespace rlz_lib {
bool ClearAllProductEvents(Product product) {
ScopedRlzValueStoreLock lock;
RlzValueStore* store = lock.GetStore();
if (!store || !store->HasAccess(RlzValueStore::kWriteAccess))
return false;
bool result;
result = store->ClearAllProductEvents(product);
result &= store->ClearAllStatefulEvents(product);
return result;
}
void ClearProductState(Product product, const AccessPoint* access_points) {
ScopedRlzValueStoreLock lock;
RlzValueStore* store = lock.GetStore();
if (!store || !store->HasAccess(RlzValueStore::kWriteAccess))
return;
// Delete all product specific state.
VERIFY(ClearAllProductEvents(product));
VERIFY(store->ClearPingTime(product));
// Delete all RLZ's for access points being uninstalled.
if (access_points) {
for (int i = 0; access_points[i] != NO_ACCESS_POINT; i++) {
VERIFY(store->ClearAccessPointRlz(access_points[i]));
}
}
store->CollectGarbage();
}
} // namespace rlz_lib