Skip to content

Commit

Permalink
Call SB_NOTIMPLEMENTED in perfetto when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsavage1 committed May 7, 2024
1 parent 5c1e1c9 commit e55acd9
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 12 deletions.
10 changes: 8 additions & 2 deletions third_party/perfetto/buildtools/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ config("sqlite_config") {
"-DSQLITE_OMIT_DEPRECATED",
"-DSQLITE_OMIT_SHARED_CACHE",
"-DHAVE_USLEEP",
# "-DHAVE_UTIME",
"-DHAVE_UTIME",
"-DSQLITE_BYTEORDER=1234",
"-DSQLITE_DEFAULT_AUTOVACUUM=0",
"-DSQLITE_DEFAULT_MMAP_SIZE=0",
Expand All @@ -1110,6 +1110,9 @@ config("sqlite_config") {
# we specify this flag.
cflags += [ "-Wno-language-extension-token" ]
}
if (use_cobalt_customizations) {
cflags -= [ "-DHAVE_UTIME" ]
}
}

source_set("sqlite") {
Expand All @@ -1130,7 +1133,10 @@ source_set("sqlite") {
}
public_configs = [ ":sqlite_config" ]
if (use_cobalt_customizations) {
deps = [ "../gn:default_deps" ]
deps = [
"../gn:default_deps",
"//starboard/common:common_headers_only",
]
} else {
deps = [ "//gn:default_deps" ]
}
Expand Down
14 changes: 8 additions & 6 deletions third_party/perfetto/buildtools/sqlite/sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,7 @@
/* This is not VxWorks. */
#define OS_VXWORKS 0
#if defined(STARBOARD)
// #define HAVE_FCHOWN 0
// #define HAVE_READLINK 0
// #define HAVE_LSTAT 0
#include "starboard/common/log.h"
#else
#define HAVE_FCHOWN 1
#define HAVE_READLINK 1
Expand Down Expand Up @@ -35597,8 +35595,8 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
&& (!defined(TARGET_OS_MACCATALYST) || (TARGET_OS_MACCATALYST==0))
# undef HAVE_GETHOSTUUID
# define HAVE_GETHOSTUUID 1
# else
// # warning "gethostuuid() is disabled."
# elif !defined(STARBOARD)
# warning "gethostuuid() is disabled."
# endif
# endif
#endif
Expand Down Expand Up @@ -39718,6 +39716,7 @@ static int unixDeviceCharacteristics(sqlite3_file *id){
*/
static int unixGetpagesize(void){
#if defined(STARBOARD)
SB_NOTIMPLEMENTED();
return 0;
#elif OS_VXWORKS
return 1024;
Expand Down Expand Up @@ -41305,7 +41304,9 @@ static const char *azTempDirs[] = {
** Initialize first two members of azTempDirs[] array.
*/
static void unixTempFileInit(void){
#if !defined(STARBOARD)
#if defined(STARBOARD)
SB_NOTIMPLEMENTED();
#else
azTempDirs[0] = getenv("SQLITE_TMPDIR");
azTempDirs[1] = getenv("TMPDIR");
#endif
Expand Down Expand Up @@ -41793,6 +41794,7 @@ static int unixOpen(
#endif
if( isAutoProxy && (zPath!=NULL) && (!noLock) && pVfs->xOpen ){
#if defined(STARBOARD)
SB_NOTIMPLEMENTED();
char *envforce = NULL;
#else
char *envforce = getenv("SQLITE_FORCE_PROXY_LOCKING");
Expand Down
1 change: 1 addition & 0 deletions third_party/perfetto/src/base/file_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ ScopedFstream OpenFstream(const char* path, const char* mode) {

bool FileExists(const std::string& path) {
#if defined(STARBOARD)
SB_NOTIMPLEMENTED();
return false;
#elif PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
return _access(path.c_str(), 0) == 0;
Expand Down
2 changes: 1 addition & 1 deletion third_party/perfetto/src/base/getopt_compat_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct OurGetopt {
char*& optarg = getopt_compat::optarg;
};

#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) && !defined(STARBOARD)
#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
struct SystemGetopt {
using LongOptionType = ::option;
using GetoptFn = decltype(&::getopt);
Expand Down
8 changes: 7 additions & 1 deletion third_party/perfetto/src/base/pipe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@

#include "perfetto/base/logging.h"

#if defined(STARBOARD)
#include "starboard/common/log.h"
#endif

namespace perfetto {
namespace base {

Expand All @@ -39,7 +43,9 @@ Pipe& Pipe::operator=(Pipe&&) = default;

Pipe Pipe::Create(Flags flags) {
PlatformHandle fds[2];
#if !defined(STARBOARD)
#if defined(STARBOARD)
SB_NOTIMPLEMENTED();
#else
#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
PERFETTO_CHECK(::CreatePipe(&fds[0], &fds[1], /*lpPipeAttributes=*/nullptr,
0 /*default size*/));
Expand Down
9 changes: 8 additions & 1 deletion third_party/perfetto/src/base/temp_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#include "perfetto/ext/base/file_utils.h"
#include "perfetto/ext/base/string_utils.h"

#if defined(STARBOARD)
#include "starboard/common/log.h"
#endif

#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
namespace {
std::string GetTempName() {
Expand All @@ -51,6 +55,7 @@ namespace base {
std::string GetSysTempDir() {
const char* tmpdir = nullptr;
#if defined(STARBOARD)
SB_NOTIMPLEMENTED();
return "";
#elif PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
if ((tmpdir = getenv("TMP")))
Expand All @@ -72,7 +77,9 @@ std::string GetSysTempDir() {
// static
TempFile TempFile::Create() {
TempFile temp_file;
#if !defined(STARBOARD)
#if defined(STARBOARD)
SB_NOTIMPLEMENTED();
#else
#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
temp_file.path_ = GetSysTempDir() + "\\" + GetTempName();
// Several tests want to read-back the temp file while still open. On Windows,
Expand Down
3 changes: 3 additions & 0 deletions third_party/perfetto/src/base/threading/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ perfetto_unittest_source_set("unittests") {
"../../../gn:default_deps",
"../../../gn:gtest_and_gmock",
]
if (is_starboard) {
deps += [ "//starboard/common:common_headers_only" ]
}
sources = [
"channel_unittest.cc",
"future_unittest.cc",
Expand Down
5 changes: 5 additions & 0 deletions third_party/perfetto/src/base/threading/channel_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include <poll.h>
#endif

#if defined(STARBOARD)
#include "starboard/common/log.h"
#endif

namespace perfetto {
namespace base {
namespace {
Expand All @@ -41,6 +45,7 @@ using WriteResult = Channel<int>::WriteResult;

bool IsReady(base::PlatformHandle fd) {
#if defined(STARBOARD)
SB_NOTIMPLEMENTED();
return false;
#elif PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
std::array<base::PlatformHandle, 1> poll_fds{fd};
Expand Down
8 changes: 7 additions & 1 deletion third_party/perfetto/src/base/unix_task_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@

#include "perfetto/ext/base/watchdog.h"

#if defined(STARBOARD)
#include "starboard/common/log.h"
#endif

namespace perfetto {
namespace base {

Expand Down Expand Up @@ -64,7 +68,9 @@ void UnixTaskRunner::Run() {
UpdateWatchTasksLocked();
}

#if !defined(STARBOARD)
#if defined(STARBOARD)
SB_NOTIMPLEMENTED();
#else
#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
DWORD timeout =
poll_timeout_ms >= 0 ? static_cast<DWORD>(poll_timeout_ms) : INFINITE;
Expand Down
3 changes: 3 additions & 0 deletions third_party/perfetto/src/trace_processor/sorter/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ source_set("sorter") {
"../types",
"../util:bump_allocator",
]
if (is_starboard) {
deps += [ "//starboard/common:common_headers_only" ]
}
}

perfetto_unittest_source_set("unittests") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#include "src/trace_processor/storage/trace_storage.h"
#include "src/trace_processor/util/bump_allocator.h"

#if defined(STARBOARD)
#include "starboard/common/log.h"
#endif

namespace perfetto {
namespace trace_processor {

Expand All @@ -35,6 +39,7 @@ TraceSorter::TraceSorter(TraceProcessorContext* context,
parser_(std::move(parser)),
sorting_mode_(sorting_mode) {
#if defined(STARBOARD)
SB_NOTIMPLEMENTED();
const char* env = nullptr;
#else
const char* env = getenv("TRACE_PROCESSOR_SORT_ONLY");
Expand Down

0 comments on commit e55acd9

Please sign in to comment.