mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-26 23:01:05 +08:00
Return a FilePath from Settings::file_path().
This makes it possible to #include "client/settings.h" for the interface even on Windows. Although Settings is not currently implemented on Windows (bug crashpad:13), it’s easier to have the interface declaration available without having to have it be guarded. TEST=crashpad_client_test SettingsTest.* BUG= R=rsesek@chromium.org Review URL: https://codereview.chromium.org/987383002
This commit is contained in:
parent
e4c8b6cc72
commit
bdcc1e7625
@ -17,15 +17,12 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "client/settings.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "util/file/file_io.h"
|
||||
#include "util/test/errors.h"
|
||||
#include "util/test/scoped_temp_dir.h"
|
||||
|
||||
#if !defined(OS_WIN)
|
||||
#include "client/settings.h"
|
||||
#endif
|
||||
|
||||
namespace crashpad {
|
||||
namespace test {
|
||||
namespace {
|
||||
|
@ -57,7 +57,7 @@ bool Settings::Initialize() {
|
||||
INITIALIZATION_STATE_SET_INITIALIZING(initialized_);
|
||||
|
||||
ScopedFileHandle handle(HANDLE_EINTR(
|
||||
open(file_path(),
|
||||
open(file_path().value().c_str(),
|
||||
O_CREAT | O_EXCL | O_WRONLY | O_EXLOCK,
|
||||
0644)));
|
||||
|
||||
@ -145,14 +145,15 @@ bool Settings::SetLastUploadAttemptTime(time_t time) {
|
||||
}
|
||||
|
||||
ScopedFileHandle Settings::OpenForReading() {
|
||||
ScopedFileHandle handle(HANDLE_EINTR(open(file_path(), O_RDONLY | O_SHLOCK)));
|
||||
ScopedFileHandle handle(HANDLE_EINTR(
|
||||
open(file_path().value().c_str(), O_RDONLY | O_SHLOCK)));
|
||||
PLOG_IF(ERROR, !handle.is_valid()) << "open for reading";
|
||||
return handle.Pass();
|
||||
}
|
||||
|
||||
ScopedFileHandle Settings::OpenForReadingAndWriting() {
|
||||
ScopedFileHandle handle(HANDLE_EINTR(
|
||||
open(file_path(), O_RDWR | O_EXLOCK | O_CREAT, 0644)));
|
||||
open(file_path().value().c_str(), O_RDWR | O_EXLOCK | O_CREAT, 0644)));
|
||||
PLOG_IF(ERROR, !handle.is_valid()) << "open for writing";
|
||||
return handle.Pass();
|
||||
}
|
||||
@ -224,7 +225,7 @@ bool Settings::RecoverSettings(FileHandle handle, Data* out_data) {
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Recovering settings file " << file_path();
|
||||
LOG(INFO) << "Recovering settings file " << file_path().value();
|
||||
|
||||
if (handle == kInvalidFileHandle) {
|
||||
LOG(ERROR) << "Invalid file handle";
|
||||
|
@ -133,7 +133,7 @@ class Settings {
|
||||
// on success and false on failure, with an error logged.
|
||||
bool InitializeSettings(FileHandle handle);
|
||||
|
||||
const char* file_path() { return file_path_.value().c_str(); }
|
||||
const base::FilePath& file_path() const { return file_path_; }
|
||||
|
||||
base::FilePath file_path_;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user