Skip to content
6 changes: 4 additions & 2 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ set(common_SRCS
src/function_registry.cc
src/future.cc
src/future_manager.cc
src/heartbeat_date_storage_desktop.cc
src/heartbeat_info_desktop.cc
src/path.cc
src/reference_counted_future_impl.cc
src/scheduler.cc
Expand Down Expand Up @@ -164,11 +162,15 @@ set(app_android_SRCS
set(app_ios_SRCS
src/app_ios.mm
src/util_ios.mm
src/heartbeat_date_storage_desktop.cc
src/heartbeat_info_desktop.cc
src/invites/ios/invites_receiver_internal_ios.mm
src/invites/ios/invites_ios_startup.mm
src/uuid_ios_darwin.mm)
set(app_desktop_SRCS
src/app_desktop.cc
src/heartbeat_date_storage_desktop.cc
src/heartbeat_info_desktop.cc
src/invites/stub/invites_receiver_internal_stub.cc
src/variant_util.cc)
if(ANDROID)
Expand Down
12 changes: 7 additions & 5 deletions app/src/heartbeat_date_storage_desktop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <fstream>
#include <utility>

#include <app/src/mutex.h>

#include "app/src/filesystem.h"

namespace FIREBASE_NAMESPACE {
Expand All @@ -29,8 +31,8 @@ const char kHeartbeatDir[] = "firebase-heartbeat";
const char kHeartbeatFilename[] = "HEARTBEAT_INFO_STORAGE";

// Returns the mutex that protects accesses to the storage file.
std::mutex& FileMutex() {
static std::mutex* mutex_ = new std::mutex();
Mutex& FileMutex() {
static Mutex* mutex_ = new Mutex(Mutex::kModeNonRecursive);
return *mutex_;
}

Expand All @@ -47,7 +49,7 @@ std::string GetFilename(std::string& error) {
} // namespace

HeartbeatDateStorage::HeartbeatDateStorage() : filename_(GetFilename(error_)) {
std::lock_guard<std::mutex> lock(FileMutex());
MutexLock lock(FileMutex());

// Ensure the file exists, otherwise the first attempt to read it would
// fail.
Expand All @@ -69,7 +71,7 @@ bool HeartbeatDateStorage::ReadPersisted() {

HeartbeatMap result;

std::lock_guard<std::mutex> lock(FileMutex());
MutexLock lock(FileMutex());

std::ifstream f(filename_);
if (!f) {
Expand Down Expand Up @@ -102,7 +104,7 @@ bool HeartbeatDateStorage::ReadPersisted() {
bool HeartbeatDateStorage::WritePersisted() const {
if (!IsValid()) return false;

std::lock_guard<std::mutex> lock(FileMutex());
MutexLock lock(FileMutex());

std::ofstream f(filename_, std::ios_base::trunc);
if (!f) {
Expand Down
1 change: 0 additions & 1 deletion app/src/heartbeat_date_storage_desktop.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#include <ctime>
#include <map>
#include <mutex> // NOLINT(build/c++11)
#include <string>

namespace FIREBASE_NAMESPACE {
Expand Down
2 changes: 1 addition & 1 deletion app/tests/heartbeat_info_desktop_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <vector>

#include "app/src/heartbeat_date_storage_desktop.h"
#include "testing/base/public/gmock.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"

namespace firebase {
Expand Down
2 changes: 1 addition & 1 deletion app/tests/util_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "app/src/util.h"

#include "testing/base/public/gmock.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"

namespace firebase {
Expand Down
2 changes: 1 addition & 1 deletion cmake/external/firestore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ endif()
# Using a firestore version that has been updated to use
# nanopb 0.3.9.6 instead of 0.3.9.5. This was necessary
# because nanopb 0.3.9.5 doesn't build with python3.
set(version f33276f5305bb81b67e006f50b14f4a2adc3cb60)
set(version c887ea1a8de22bbd980e2aca0ac51bb074201b96)
ExternalProject_Add(
firestore

Expand Down
12 changes: 1 addition & 11 deletions database/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,8 @@ elseif(IOS)
set(database_platform_SRCS
"${ios_SRCS}")
else()
# Add platform-specific util files.
if(MSVC)
set(desktop_extra_SRCS src/desktop/util_desktop_windows.cc)
elseif(APPLE)
set(desktop_extra_SRCS src/desktop/util_desktop_macos.mm)
else()
# Linux
set(desktop_extra_SRCS src/desktop/util_desktop_linux.cc)
endif()
set(database_platform_SRCS
"${desktop_SRCS}"
"${desktop_extra_SRCS}")
"${desktop_SRCS}")
endif()

if(ANDROID OR IOS)
Expand Down
2 changes: 1 addition & 1 deletion testing/util_android_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "testing/run_all_tests.h"
#include "testing/util_android.h"
#include "testing/base/public/gmock.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"

namespace firebase {
Expand Down
2 changes: 1 addition & 1 deletion testing/util_ios_test.mm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "testing/config.h"
#include "testing/ticker.h"
#include "testing/util_ios.h"
#include "testing/base/public/gmock.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"

namespace firebase {
Expand Down