Make watchdog_noop inline to fix Mac build
Another change to fix the AOSP mac build. For
similar reasons to aosp/766061, the watchdog_noop.cc
file is not pulled in by mac builds on Android.
TBR: hjd
Change-Id: I0af86367f687b6c09ce62a8515517ed2e5c4dfed
diff --git a/include/perfetto/base/watchdog_noop.h b/include/perfetto/base/watchdog_noop.h
index 1c14b8a..e542aa6 100644
--- a/include/perfetto/base/watchdog_noop.h
+++ b/include/perfetto/base/watchdog_noop.h
@@ -31,7 +31,10 @@
Timer(const Timer&) {}
~Timer() {}
};
- static Watchdog* GetInstance();
+ static Watchdog* GetInstance() {
+ static Watchdog* watchdog = new Watchdog();
+ return watchdog;
+ }
Timer CreateFatalTimer(uint32_t /*ms*/) { return Timer(); }
void Start() {}
void SetMemoryLimit(uint32_t /*bytes*/, uint32_t /*window_ms*/) {}
diff --git a/src/base/BUILD.gn b/src/base/BUILD.gn
index db88974..68939a9 100644
--- a/src/base/BUILD.gn
+++ b/src/base/BUILD.gn
@@ -44,8 +44,6 @@
if (!build_with_chromium && (is_linux || is_android)) {
sources += [ "watchdog_posix.cc" ]
- } else {
- sources += [ "watchdog_noop.cc" ]
}
if (is_debug && build_standalone && !is_wasm) {
deps += [ ":debug_crash_stack_trace" ]
diff --git a/src/base/watchdog_noop.cc b/src/base/watchdog_noop.cc
deleted file mode 100644
index 97f0777..0000000
--- a/src/base/watchdog_noop.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * 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 "perfetto/base/watchdog_noop.h"
-
-namespace perfetto {
-namespace base {
-
-Watchdog* Watchdog::GetInstance() {
- static Watchdog* watchdog = new Watchdog();
- return watchdog;
-}
-
-} // namespace base
-} // namespace perfetto