From 94a48415d4b8f242e18003ffb73869ccaf112c76 Mon Sep 17 00:00:00 2001 From: Andrew Savage Date: Mon, 3 Jun 2024 13:18:29 -0700 Subject: [PATCH] Clean up suspect changes in base/net (#3375) b/330364592 b/334975532 --- cobalt/h5vcc/dial/dial_http_response.cc | 6 +- cobalt/loader/image/animated_image_tracker.cc | 4 +- cobalt/loader/script_loader_factory.cc | 11 +--- cobalt/network/net_log_constants.cc | 24 ++------ cobalt/network/url_request_context.cc | 6 -- cobalt/websocket/BUILD.gn | 6 +- cobalt/websocket/mock_websocket_channel.cc | 24 -------- cobalt/websocket/mock_websocket_channel.h | 59 ------------------- components/prefs/BUILD.gn | 5 +- components/prefs/testing_pref_service.h | 2 +- components/variations/BUILD.gn | 8 ++- .../platform_configuration/configuration.gni | 2 +- 12 files changed, 21 insertions(+), 136 deletions(-) delete mode 100644 cobalt/websocket/mock_websocket_channel.cc delete mode 100644 cobalt/websocket/mock_websocket_channel.h diff --git a/cobalt/h5vcc/dial/dial_http_response.cc b/cobalt/h5vcc/dial/dial_http_response.cc index 6ab27274dfa1..325c150eb609 100644 --- a/cobalt/h5vcc/dial/dial_http_response.cc +++ b/cobalt/h5vcc/dial/dial_http_response.cc @@ -38,11 +38,9 @@ void DialHttpResponse::AddHeader(const std::string& header, std::unique_ptr DialHttpResponse::ToHttpServerResponseInfo() { if (!info_) { - info_.reset(new net::HttpServerResponseInfo()); + info_.reset( + new net::HttpServerResponseInfo(net::HttpStatusCode(response_code_))); } -#ifndef COBALT_PENDING_CLEAN_UP - info_->status_code() = net::HttpStatusCode(response_code_); -#endif info_->SetBody(body_, mime_type_); return std::move(info_); } diff --git a/cobalt/loader/image/animated_image_tracker.cc b/cobalt/loader/image/animated_image_tracker.cc index adda7dcfef56..04625d22f4cf 100644 --- a/cobalt/loader/image/animated_image_tracker.cc +++ b/cobalt/loader/image/animated_image_tracker.cc @@ -48,8 +48,8 @@ AnimatedImageTracker::AnimatedImageTracker( options.priority = animated_image_decode_thread_priority; animated_image_decode_thread_.StartWithOptions(options); #else - animated_image_decode_thread_.StartWithOptions(base::Thread::Options( - base::MessagePumpType::DEFAULT, 0 /* default stack size */)); + animated_image_decode_thread_.StartWithOptions( + base::Thread::Options(animated_image_decode_thread_priority)); #endif } diff --git a/cobalt/loader/script_loader_factory.cc b/cobalt/loader/script_loader_factory.cc index 0f52c35affaf..7a199df0e275 100644 --- a/cobalt/loader/script_loader_factory.cc +++ b/cobalt/loader/script_loader_factory.cc @@ -24,14 +24,6 @@ namespace cobalt { namespace loader { -namespace { - -// The ResourceLoader thread uses the default stack size, which is requested -// by passing in 0 for its stack size. -const size_t kLoadThreadStackSize = 0; - -} // namespace - ScriptLoaderFactory::ScriptLoaderFactory( const char* name, FetcherFactory* fetcher_factory, base::ThreadType loader_thread_priority) @@ -44,8 +36,7 @@ ScriptLoaderFactory::ScriptLoaderFactory( options.priority = loader_thread_priority; load_thread_.StartWithOptions(options); #else - load_thread_.StartWithOptions(base::Thread::Options( - base::MessagePumpType::DEFAULT, kLoadThreadStackSize)); + load_thread_.StartWithOptions(base::Thread::Options(loader_thread_priority)); #endif } diff --git a/cobalt/network/net_log_constants.cc b/cobalt/network/net_log_constants.cc index fdfbcc9b95ae..4c681b23461c 100644 --- a/cobalt/network/net_log_constants.cc +++ b/cobalt/network/net_log_constants.cc @@ -72,49 +72,37 @@ std::unique_ptr NetLogConstants::GetConstants() { // Add a dictionary with information about the relationship between load flag // enums and their symbolic names. { - std::unique_ptr dict(new base::Value::Dict()); + base::Value::Dict dict; -#define LOAD_FLAG(label, value) dict->Set(#label, static_cast(value)); +#define LOAD_FLAG(label, value) dict.Set(#label, static_cast(value)); #include "net/base/load_flags_list.h" #undef LOAD_FLAG -#ifdef REGULAR_UPSTREAM_CODE constants_dict->Set("loadFlag", std::move(dict)); -#else - constants_dict->Set("loadFlag", base::Value::Dict()); -#endif } // Add a dictionary with information about the relationship between load state // enums and their symbolic names. { - std::unique_ptr dict(new base::Value::Dict()); + base::Value::Dict dict; -#define LOAD_STATE(label, value) dict->Set(#label, static_cast(value)); +#define LOAD_STATE(label, value) dict.Set(#label, static_cast(value)); #include "net/base/load_states_list.h" #undef LOAD_STATE -#ifdef REGULAR_UPSTREAM_CODE constants_dict->Set("loadState", std::move(dict)); -#else - constants_dict->Set("loadState", base::Value::Dict()); -#endif } // Add information on the relationship between net error codes and their // symbolic names. { - std::unique_ptr dict(new base::Value::Dict()); + base::Value::Dict dict; -#define NET_ERROR(label, value) dict->Set(#label, static_cast(value)); +#define NET_ERROR(label, value) dict.Set(#label, static_cast(value)); #include "net/base/net_error_list.h" #undef NET_ERROR -#ifdef REGULAR_UPSTREAM_CODE constants_dict->Set("netError", std::move(dict)); -#else - constants_dict->Set("netError", base::Value::Dict()); -#endif } // Information about the relationship between event phase enums and their diff --git a/cobalt/network/url_request_context.cc b/cobalt/network/url_request_context.cc index 4eb48e119e7b..a8d416354ced 100644 --- a/cobalt/network/url_request_context.cc +++ b/cobalt/network/url_request_context.cc @@ -204,12 +204,6 @@ URLRequestContext::URLRequestContext( net::NetLog::Get(), /*quick_check_enabled=*/true)); #if !defined(QUIC_DISABLED_FOR_STARBOARD) -#ifndef COBALT_PENDING_CLEAN_UP - // TODO: Confirm this is not needed. - // ack decimation significantly increases download bandwidth on low-end - // android devices. - SetQuicFlag(&FLAGS_quic_reloadable_flag_quic_enable_ack_decimation, true); -#endif bool quic_enabled = configuration::Configuration::GetInstance()->CobaltEnableQuic(); if (quic_enabled) { diff --git a/cobalt/websocket/BUILD.gn b/cobalt/websocket/BUILD.gn index 37383b215e90..1e100e92a397 100644 --- a/cobalt/websocket/BUILD.gn +++ b/cobalt/websocket/BUILD.gn @@ -41,11 +41,7 @@ static_library("websocket") { target(gtest_target_type, "websocket_test") { testonly = true has_pedantic_warnings = true - sources = [ - "mock_websocket_channel.cc", - "mock_websocket_channel.h", - "web_socket_test.cc", - ] + sources = [ "web_socket_test.cc" ] deps = [ ":websocket", "//cobalt/base", diff --git a/cobalt/websocket/mock_websocket_channel.cc b/cobalt/websocket/mock_websocket_channel.cc deleted file mode 100644 index fac87a19d311..000000000000 --- a/cobalt/websocket/mock_websocket_channel.cc +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "cobalt/websocket/mock_websocket_channel.h" - -#include "cobalt/websocket/cobalt_web_socket_event_handler.h" - -// Generated constructors and destructors for GMock objects are very large. By -// putting them in a separate file we can speed up compile times. - -namespace cobalt { -namespace websocket { - -MockWebSocketChannel::MockWebSocketChannel( - WebSocketImpl* impl, network::NetworkModule* network_module) - : net::WebSocketChannel(std::unique_ptr( - new CobaltWebSocketEventHandler(impl)), - nullptr) {} - -MockWebSocketChannel::~MockWebSocketChannel() = default; - -} // namespace websocket -} // namespace cobalt diff --git a/cobalt/websocket/mock_websocket_channel.h b/cobalt/websocket/mock_websocket_channel.h deleted file mode 100644 index a6d766e4214f..000000000000 --- a/cobalt/websocket/mock_websocket_channel.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2019 The Cobalt Authors. All Rights Reserved. -// -// 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. - -#ifndef COBALT_WEBSOCKET_MOCK_WEBSOCKET_CHANNEL_H_ -#define COBALT_WEBSOCKET_MOCK_WEBSOCKET_CHANNEL_H_ - -#include -#include - -#include "base/memory/scoped_refptr.h" -#include "base/synchronization/lock.h" -#include "cobalt/network/network_module.h" -#include "cobalt/websocket/web_socket_impl.h" -#include "net/websockets/websocket_channel.h" -#include "testing/gmock/include/gmock/gmock.h" - -namespace cobalt { -namespace websocket { - -class SourceLocation; - -class MockWebSocketChannel : public net::WebSocketChannel { - public: - MockWebSocketChannel(WebSocketImpl* impl, - network::NetworkModule* network_module); - ~MockWebSocketChannel(); - - MOCK_METHOD4(MockSendFrame, - net::WebSocketChannel::ChannelState( - bool fin, net::WebSocketFrameHeader::OpCode op_code, - scoped_refptr buffer, size_t buffer_size)); - net::WebSocketChannel::ChannelState SendFrame( - bool fin, net::WebSocketFrameHeader::OpCode op_code, - scoped_refptr buffer, size_t buffer_size) { - base::AutoLock scoped_lock(lock_); - return MockSendFrame(fin, op_code, buffer, buffer_size); - } - - base::Lock& lock() { return lock_; } - - private: - base::Lock lock_; -}; - -} // namespace websocket -} // namespace cobalt - -#endif // COBALT_WEBSOCKET_MOCK_WEBSOCKET_CHANNEL_H_ diff --git a/components/prefs/BUILD.gn b/components/prefs/BUILD.gn index ec4efb30b541..ee349a03c47a 100644 --- a/components/prefs/BUILD.gn +++ b/components/prefs/BUILD.gn @@ -56,10 +56,7 @@ static_library("prefs") { configs += [ ":prefs_config" ] - deps = [ - "//base", - # "//base/util/values:values_util", - ] + deps = [ "//base" ] } source_set("test_support") { diff --git a/components/prefs/testing_pref_service.h b/components/prefs/testing_pref_service.h index 8c713dc4982b..f0b05fa800e1 100644 --- a/components/prefs/testing_pref_service.h +++ b/components/prefs/testing_pref_service.h @@ -220,7 +220,7 @@ void TestingPrefServiceBase:: SetPref(TestingPrefStore* pref_store, const std::string& path, std::unique_ptr value) { - pref_store->SetValue(path, base::Value(), + pref_store->SetValue(path, base::Value(std::move(*value)), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } diff --git a/components/variations/BUILD.gn b/components/variations/BUILD.gn index 34d3b8fbe7cf..d05dfc245432 100644 --- a/components/variations/BUILD.gn +++ b/components/variations/BUILD.gn @@ -23,8 +23,8 @@ static_library("variations") { "client_filterable_state.h", "entropy_provider.cc", "entropy_provider.h", - # "experiment_labels.cc", - # "experiment_labels.h", + "experiment_labels.cc", + "experiment_labels.h", "hashing.cc", "hashing.h", "metrics.cc", @@ -84,6 +84,10 @@ static_library("variations") { "proto/permuted_entropy_cache.proto", "proto/study.proto", "proto/variations_seed.proto", + + # These can't be by compiled and aren't used in Cobalt. + "experiment_labels.cc", + "experiment_labels.h", ] } diff --git a/starboard/linux/shared/platform_configuration/configuration.gni b/starboard/linux/shared/platform_configuration/configuration.gni index 852b0083000f..60ff849320e5 100644 --- a/starboard/linux/shared/platform_configuration/configuration.gni +++ b/starboard/linux/shared/platform_configuration/configuration.gni @@ -38,6 +38,6 @@ platform_tests_path = "//starboard/linux/shared:starboard_platform_tests($starboard_toolchain)" # TODO(b/330364592): re-enable when in-app-dial is fixed. -enable_in_app_dial = false +enable_in_app_dial = true v8_enable_webassembly = true