Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick PR #3038: Replace starboard/common/log with base/logging in the common source files #3393

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion base/time/time_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "base/check_op.h"
#include "base/compiler_specific.h"
#include "base/environment.h"
#include "base/logging.h"
#include "base/test/gtest_util.h"
#include "base/threading/platform_thread.h"
#include "base/time/time_override.h"
Expand Down Expand Up @@ -1486,7 +1487,7 @@ ThreadTicks ThreadTicksOverride::now_ticks_;
#endif
TEST(ThreadTicks, MAYBE_NowOverride) {
if (starboard::CurrentMonotonicThreadTime() == 0) {
SB_LOG(INFO) << "Time thread now not supported. Test skipped.";
LOG(INFO) << "Time thread now not supported. Test skipped.";
return;
}

Expand Down
9 changes: 5 additions & 4 deletions cobalt/audio/audio_destination_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "cobalt/audio/audio_destination_node.h"

#include "base/logging.h"
#include "cobalt/audio/audio_context.h"

namespace cobalt {
Expand Down Expand Up @@ -59,7 +60,7 @@ void AudioDestinationNode::OnInputNodeConnected() {
if (!audio_device_) {
audio_device_.reset(
new AudioDevice(static_cast<int>(channel_count(NULL)), this));
SB_LOG(INFO) << "Created audio device " << audio_device_.get() << '.';
LOG(INFO) << "Created audio device " << audio_device_.get() << '.';
context()->PreventGarbageCollection();
}
delete_audio_device_ = false;
Expand All @@ -79,8 +80,8 @@ void AudioDestinationNode::FillAudioBus(bool all_consumed, AudioBus* audio_bus,
bool all_finished = true;
Input(0)->FillAudioBus(audio_bus, silence, &all_finished);
if (all_consumed && all_finished) {
SB_LOG(INFO) << "Schedule to destroy audio device " << audio_device_.get()
<< '.';
LOG(INFO) << "Schedule to destroy audio device " << audio_device_.get()
<< '.';
delete_audio_device_ = true;
task_runner_->PostTask(FROM_HERE,
base::Bind(&AudioDestinationNode::DestroyAudioDevice,
Expand All @@ -94,7 +95,7 @@ void AudioDestinationNode::DestroyAudioDevice() {
return;
}
if (delete_audio_device_) {
SB_LOG(INFO) << "Destroying audio device " << audio_device_.get() << '.';
LOG(INFO) << "Destroying audio device " << audio_device_.get() << '.';
audio_device_.reset();
context()->AllowGarbageCollection();
delete_audio_device_ = false;
Expand Down
26 changes: 13 additions & 13 deletions cobalt/audio/audio_file_reader_wav.cc
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,12 @@ void AudioFileReaderWAV::ParseWAV_data(const uint8* data, size_t offset,
#if SB_IS(LITTLE_ENDIAN)
if ((!is_src_sample_in_float && sample_type_ == kSampleTypeInt16) ||
(is_src_sample_in_float && sample_type_ == kSampleTypeFloat32)) {
SB_LOG(INFO) << "Copying " << size << " bytes of wav data.";
LOG(INFO) << "Copying " << size << " bytes of wav data.";
memcpy(audio_bus_->interleaved_data(), data + offset, size);
} else if (!is_src_sample_in_float && sample_type_ == kSampleTypeFloat32) {
// Convert from int16 to float32
SB_LOG(INFO) << "Converting " << number_of_frames_ * number_of_channels_
<< " samples from int16 to float32.";
LOG(INFO) << "Converting " << number_of_frames_ * number_of_channels_
<< " samples from int16 to float32.";
const int16* src_samples = reinterpret_cast<const int16*>(data + offset);
float* dest_samples =
reinterpret_cast<float*>(audio_bus_->interleaved_data());
Expand All @@ -230,8 +230,8 @@ void AudioFileReaderWAV::ParseWAV_data(const uint8* data, size_t offset,
}
} else {
// Convert from float32 to int16
SB_LOG(INFO) << "Converting " << number_of_frames_ * number_of_channels_
<< " samples from float32 to int16.";
LOG(INFO) << "Converting " << number_of_frames_ * number_of_channels_
<< " samples from float32 to int16.";
const float* src_samples = reinterpret_cast<const float*>(data + offset);
int16* dest_samples =
reinterpret_cast<int16*>(audio_bus_->interleaved_data());
Expand All @@ -244,8 +244,8 @@ void AudioFileReaderWAV::ParseWAV_data(const uint8* data, size_t offset,
}
#else // SB_IS(LITTLE_ENDIAN)
if (!is_src_sample_in_float && sample_type_ == kSampleTypeInt16) {
SB_LOG(INFO) << "Converting " << number_of_frames_ * number_of_channels_
<< " int16 samples from little endian to big endian.";
LOG(INFO) << "Converting " << number_of_frames_ * number_of_channels_
<< " int16 samples from little endian to big endian.";
const uint8_t* src_samples = data + offset;
int16* dest_samples =
reinterpret_cast<int16*>(audio_bus_->interleaved_data());
Expand All @@ -255,8 +255,8 @@ void AudioFileReaderWAV::ParseWAV_data(const uint8* data, size_t offset,
++dest_samples;
}
} else if (is_src_sample_in_float && sample_type_ == kSampleTypeFloat32) {
SB_LOG(INFO) << "Converting " << number_of_frames_ * number_of_channels_
<< " float32 samples from little endian to big endian.";
LOG(INFO) << "Converting " << number_of_frames_ * number_of_channels_
<< " float32 samples from little endian to big endian.";
const uint8_t* src_samples = data + offset;
float* dest_samples =
reinterpret_cast<float*>(audio_bus_->interleaved_data());
Expand All @@ -268,8 +268,8 @@ void AudioFileReaderWAV::ParseWAV_data(const uint8* data, size_t offset,
}
} else if (!is_src_sample_in_float && sample_type_ == kSampleTypeFloat32) {
// Convert from int16 to float32
SB_LOG(INFO) << "Converting " << number_of_frames_ * number_of_channels_
<< " int16 samples in little endian to float32 in big endian.";
LOG(INFO) << "Converting " << number_of_frames_ * number_of_channels_
<< " int16 samples in little endian to float32 in big endian.";
const uint8_t* src_samples = data + offset;
float* dest_samples =
reinterpret_cast<float*>(audio_bus_->interleaved_data());
Expand All @@ -281,8 +281,8 @@ void AudioFileReaderWAV::ParseWAV_data(const uint8* data, size_t offset,
}
} else {
// Convert from float32 to int16
SB_LOG(INFO) << "Converting " << number_of_frames_ * number_of_channels_
<< " float32 samples in little endian to int16 in big endian.";
LOG(INFO) << "Converting " << number_of_frames_ * number_of_channels_
<< " float32 samples in little endian to int16 in big endian.";
const uint8_t* src_samples = data + offset;
int16* dest_samples =
reinterpret_cast<int16*>(audio_bus_->interleaved_data());
Expand Down
2 changes: 1 addition & 1 deletion cobalt/base/localized_strings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ bool LocalizedStrings::LoadSingleString(const std::string& message) {
// A single message is a key/value pair with separator.
size_t separator_pos = message.find(';');
if (separator_pos == std::string::npos) {
SB_DLOG(ERROR) << "No separator found in: " << message;
DLOG(ERROR) << "No separator found in: " << message;
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions cobalt/bindings/testing/date_bindings_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ TEST_F(DateBindingsTest, StarboardTimeZone) {
EvaluateScript("new Date().toString();", &result);
base::Time now = base::Time::Now();

SB_LOG(INFO) << "JavaScript Date now is : " << result;
SB_LOG(INFO) << "and base::Time is: " << now;
LOG(INFO) << "JavaScript Date now is : " << result;
LOG(INFO) << "and base::Time is: " << now;

base::Time::Exploded exploded;
now.LocalExplode(&exploded);
Expand Down
2 changes: 1 addition & 1 deletion cobalt/browser/browser_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1714,7 +1714,7 @@ void BrowserModule::OnPollForRenderTimeout(const GURL& url) {
kRenderTimeoutErrorPercentage * (UINT64_MAX / 100)) {
OnError(url, std::string("Rendering Timeout"));
} else {
SB_DLOG(INFO) << "Received OnRenderTimeout, ignoring by random chance.";
DLOG(INFO) << "Received OnRenderTimeout, ignoring by random chance.";
}
} else {
timeout_polling_thread_.task_runner()->PostDelayedTask(
Expand Down
3 changes: 2 additions & 1 deletion cobalt/browser/memory_settings/pretty_print_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <vector>

#include "base/command_line.h"
#include "base/logging.h"
#include "cobalt/browser/memory_settings/memory_settings.h"
#include "cobalt/browser/memory_settings/test_common.h"
#include "cobalt/browser/switches.h"
Expand All @@ -46,7 +47,7 @@ bool HasTokensInOrder(const std::string& value,
EXPECT_NE(position, std::string::npos);
EXPECT_GE(position, current_position);
if (position == std::string::npos) {
SB_DLOG(INFO) << "Token \"" << token << "\" not found in order.";
DLOG(INFO) << "Token \"" << token << "\" not found in order.";
return false;
}
current_position = position + strlen(token);
Expand Down
4 changes: 2 additions & 2 deletions cobalt/browser/memory_settings/table_printer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "cobalt/browser/memory_settings/table_printer.h"

#include "starboard/common/log.h"
#include "base/logging.h"
#include "starboard/string.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand Down Expand Up @@ -46,7 +46,7 @@ bool HasTokensInOrder(const std::string& value,
EXPECT_NE(position, std::string::npos);
EXPECT_GE(position, current_position);
if (position == std::string::npos) {
SB_DLOG(INFO) << "Token \"" << token << "\" not found in order.";
DLOG(INFO) << "Token \"" << token << "\" not found in order.";
return false;
}
current_position = position + strlen(token);
Expand Down
5 changes: 3 additions & 2 deletions cobalt/browser/suspend_fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "cobalt/browser/suspend_fuzzer.h"

#include "base/logging.h"
#include "base/threading/thread_task_runner_handle.h"

namespace cobalt {
Expand Down Expand Up @@ -47,11 +48,11 @@ void SuspendFuzzer::DoStep() {
DCHECK(base::SequencedTaskRunner::GetCurrentDefault() ==
thread_.task_runner());
if (step_type_ == kShouldRequestFreeze) {
SB_DLOG(INFO) << "suspend_fuzzer: Requesting freeze.";
DLOG(INFO) << "suspend_fuzzer: Requesting freeze.";
SbSystemRequestFreeze();
step_type_ = kShouldRequestFocus;
} else if (step_type_ == kShouldRequestFocus) {
SB_DLOG(INFO) << "suspend_fuzzer: Requesting focus.";
DLOG(INFO) << "suspend_fuzzer: Requesting focus.";
SbSystemRequestFocus();
step_type_ = kShouldRequestFocus;
} else {
Expand Down
3 changes: 2 additions & 1 deletion cobalt/dom/on_screen_keyboard_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <memory>
#include <string>

#include "base/logging.h"
#include "cobalt/base/tokens.h"
#include "cobalt/bindings/testing/utils.h"
#include "cobalt/browser/on_screen_keyboard_extension_bridge.h"
Expand Down Expand Up @@ -203,7 +204,7 @@ class OnScreenKeyboardTest : public testing::TestWithJavaScript {
bool SkipLocale() {
bool skipTests = !browser::OnScreenKeyboardExtensionBridge::IsSupported();
if (skipTests) {
SB_LOG(INFO) << "On screen keyboard not supported. Test skipped.";
LOG(INFO) << "On screen keyboard not supported. Test skipped.";
}
return skipTests;
}
Expand Down
3 changes: 2 additions & 1 deletion cobalt/h5vcc/h5vcc_platform_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <utility>
#include <vector>

#include "base/logging.h"
#include "base/threading/thread_task_runner_handle.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/web/context.h"
Expand All @@ -42,7 +43,7 @@ scoped_refptr<H5vccPlatformService> H5vccPlatformService::Open(
static_cast<const ExtPlatformServiceApi*>(
SbSystemGetExtension(kCobaltExtensionPlatformServiceName));
if (!platform_service_api) {
SB_DLOG(WARNING) << "PlatformService is not implemented on this platform.";
DLOG(WARNING) << "PlatformService is not implemented on this platform.";
return NULL;
}
scoped_refptr<H5vccPlatformService> service = new H5vccPlatformService(
Expand Down
6 changes: 3 additions & 3 deletions cobalt/js_profiler/profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Profiler::Profiler(script::EnvironmentSettings* settings,
}
sample_interval_ = effective_sample_interval_ms;

SB_LOG(INFO) << "[PROFILER] START " + profiler_id_;
LOG(INFO) << "[PROFILER] START " + profiler_id_;
auto status = profiler_group_->ProfilerStart(
this, settings,
v8::CpuProfilingOptions(v8::kLeafNodeLineNumbers,
Expand Down Expand Up @@ -95,7 +95,7 @@ void Profiler::DispatchSampleBufferFullEvent() {

Profiler::ProfilerTracePromise Profiler::Stop(
script::EnvironmentSettings* environment_settings) {
SB_LOG(INFO) << "[PROFILER] STOPPING " + profiler_id_;
LOG(INFO) << "[PROFILER] STOPPING " + profiler_id_;
script::HandlePromiseWrappable promise =
web::get_script_value_factory(environment_settings)
->CreateInterfacePromise<scoped_refptr<ProfilerTraceWrapper>>();
Expand Down Expand Up @@ -123,7 +123,7 @@ void Profiler::PerformStop(
ProfilerGroup* profiler_group,
std::unique_ptr<script::ValuePromiseWrappable::Reference> promise_reference,
base::TimeTicks time_origin, std::string profiler_id) {
SB_LOG(INFO) << "[PROFILER] STOPPED " + profiler_id_;
LOG(INFO) << "[PROFILER] STOPPED " + profiler_id_;
auto trace = profiler_group->ProfilerStop(this);
scoped_refptr<ProfilerTraceWrapper> result(new ProfilerTraceWrapper(trace));
promise_reference->value().Resolve(result);
Expand Down
3 changes: 2 additions & 1 deletion cobalt/media/sandbox/format_guesstimator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <vector>

#include "base/bind.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/string_split.h"
Expand Down Expand Up @@ -153,7 +154,7 @@ FormatGuesstimator::FormatGuesstimator(const std::string& path_or_url,
bool is_from_root = !path_or_url.empty() && path_or_url[0] == '/';
auto path_from_root = (is_from_root ? "" : "/") + path_or_url;
progressive_url_ = GURL("file://" + path_from_root);
SB_LOG(INFO) << progressive_url_.spec();
LOG(INFO) << progressive_url_.spec();
mime_type_ = "video/mp4; codecs=\"avc1.640028, mp4a.40.2\"";
}
}
Expand Down
15 changes: 8 additions & 7 deletions cobalt/media/sandbox/web_media_player_sandbox.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/path_service.h"
#include "base/task/sequenced_task_runner.h"
Expand Down Expand Up @@ -120,7 +121,7 @@ class Application {
media_sandbox_.GetMediaModule());

if (!guesstimator1.is_valid()) {
SB_LOG(ERROR) << "Invalid path or url: " << argv[argc - 1];
LOG(ERROR) << "Invalid path or url: " << argv[argc - 1];
// Fall off to PrintUsage() and terminate.
} else if (guesstimator1.is_progressive()) {
InitializeProgressivePlayback(guesstimator1);
Expand All @@ -129,14 +130,14 @@ class Application {
InitializeAdaptivePlayback(guesstimator1);
return;
} else if (guesstimator1.is_audio() && guesstimator2.is_audio()) {
SB_LOG(ERROR) << "Failed to play because both " << argv[argc - 1]
<< " and " << argv[argc - 2]
<< " are audio streams, check usage for more details.";
LOG(ERROR) << "Failed to play because both " << argv[argc - 1]
<< " and " << argv[argc - 2]
<< " are audio streams, check usage for more details.";
// Fall off to PrintUsage() and terminate.
} else if (!guesstimator1.is_audio() && !guesstimator2.is_audio()) {
SB_LOG(ERROR) << "Failed to play because both " << argv[argc - 1]
<< " and " << argv[argc - 2]
<< " are video streams, check usage for more details.";
LOG(ERROR) << "Failed to play because both " << argv[argc - 1]
<< " and " << argv[argc - 2]
<< " are video streams, check usage for more details.";
// Fall off to PrintUsage() and terminate.
} else if (guesstimator1.is_audio()) {
InitializeAdaptivePlayback(guesstimator1, guesstimator2);
Expand Down
29 changes: 15 additions & 14 deletions cobalt/renderer/backend/graphics_system_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <algorithm>
#include <memory>

#include "base/logging.h"
#include "base/optional.h"
#include "base/time/time.h"
#include "cobalt/renderer/backend/default_graphics_system.h"
Expand Down Expand Up @@ -51,10 +52,10 @@ TEST(GraphicsSystemTest, FLAKY_GraphicsSystemCanBeInitializedOften) {
}
int64_t time_per_initialization_usec =
(starboard::CurrentMonotonicTime() - start) / kReferenceCount;
SB_LOG(INFO) << "Measured duration "
<< time_per_initialization_usec /
base::Time::kMicrosecondsPerMillisecond
<< "ms per initialization.";
LOG(INFO) << "Measured duration "
<< time_per_initialization_usec /
base::Time::kMicrosecondsPerMillisecond
<< "ms per initialization.";

// Graphics system initializations should not take more than the maximum of
// 250ms or three times as long as the time we just measured.
Expand All @@ -68,9 +69,9 @@ TEST(GraphicsSystemTest, FLAKY_GraphicsSystemCanBeInitializedOften) {
graphics_system.reset();
int64_t now = starboard::CurrentMonotonicTime();
int64_t elapsed_time_usec = now - last;
SB_LOG(INFO) << "Test duration "
<< elapsed_time_usec / base::Time::kMicrosecondsPerMillisecond
<< "ms.";
LOG(INFO) << "Test duration "
<< elapsed_time_usec / base::Time::kMicrosecondsPerMillisecond
<< "ms.";
ASSERT_LT(elapsed_time_usec, maximum_time_usec_per_initialization);
last = now;
}
Expand Down Expand Up @@ -100,10 +101,10 @@ TEST(GraphicsSystemTest, FLAKY_GraphicsContextCanBeInitializedOften) {
int64_t time_per_initialization_usec =
base::Time::kMicrosecondsPerMillisecond +
(starboard::CurrentMonotonicTime() - start) / kReferenceCount;
SB_LOG(INFO) << "Measured duration "
<< time_per_initialization_usec /
base::Time::kMicrosecondsPerMillisecond
<< "ms per initialization.";
LOG(INFO) << "Measured duration "
<< time_per_initialization_usec /
base::Time::kMicrosecondsPerMillisecond
<< "ms per initialization.";

// Graphics system and context initializations should not take more than the
// maximum of 250ms or three times as long as the time we just measured.
Expand All @@ -121,9 +122,9 @@ TEST(GraphicsSystemTest, FLAKY_GraphicsContextCanBeInitializedOften) {

int64_t now = starboard::CurrentMonotonicTime();
int64_t elapsed_time_usec = now - last;
SB_LOG(INFO) << "Test duration "
<< elapsed_time_usec / base::Time::kMicrosecondsPerMillisecond
<< "ms.";
LOG(INFO) << "Test duration "
<< elapsed_time_usec / base::Time::kMicrosecondsPerMillisecond
<< "ms.";
ASSERT_LT(elapsed_time_usec, maximum_time_usec_per_initialization);
last = now;
}
Expand Down
Loading
Loading