crashpad/util/win/scoped_set_event.cc
Mark Mentovai e2b9ab3ed2 win: Tests shouldn’t freak out when CodeView PDB links are absent
crashpad_snapshot_test PEImageReader.DebugDirectory was hanging when
crashpad_snapshot_test_image_reader.exe did not have a CodeView PDB
link. This occurred when linked by Lexan ld-link.exe without /DEBUG.

Bug: chromium:782781
Change-Id: I8fbc4d8decf6ac5e19f7ffeb230fd15d7c40fd51
Reviewed-on: https://chromium-review.googlesource.com/761320
Reviewed-by: Leonard Mosescu <mosescu@chromium.org>
2017-11-09 23:17:27 +00:00

41 lines
1.0 KiB
C++

// Copyright 2015 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "util/win/scoped_set_event.h"
#include "base/logging.h"
namespace crashpad {
ScopedSetEvent::ScopedSetEvent(HANDLE event) : event_(event) {
DCHECK(event_);
}
ScopedSetEvent::~ScopedSetEvent() {
if (event_) {
Set();
}
}
bool ScopedSetEvent::Set() {
bool rv = !!SetEvent(event_);
if (!rv) {
PLOG(ERROR) << "SetEvent";
}
event_ = nullptr;
return rv;
}
} // namespace crashpad