diff --git base/win/com_init_util.cc base/win/com_init_util.cc index 57c3c6f8d8c5..fee206222ebf 100644 --- base/win/com_init_util.cc +++ base/win/com_init_util.cc @@ -35,7 +35,7 @@ struct OleTlsData { }; OleTlsData* GetOleTlsData() { - TEB* teb = NtCurrentTeb(); + auto teb = NtCurrentTeb(); return reinterpret_cast(teb->ReservedForOle); } diff --git build/config/jumbo.gni build/config/jumbo.gni index 0c84b283bf8f..e6f033a59151 100644 --- build/config/jumbo.gni +++ build/config/jumbo.gni @@ -11,13 +11,6 @@ declare_args() { jumbo_file_merge_limit = -1 } -# TODO(crbug.com/994387): Remove all uses of the jumbo_* templates from the -# BUILD.gn files, and then remove this whole file. -assert(!use_jumbo_build, - "The jumbo build is no longer supported. Please remove any uses of " + - "'use_jumbo_build', 'jumbo_build_excluded', or " + - "'jumbo_file_merge_limit' from your args.gn file and re-run GN.") - # Normal builds benefit from lots of jumbification jumbo_file_merge_default = 50 diff --git chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc index 3a6306647661..6ea29431a353 100644 --- chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc +++ chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc @@ -570,7 +570,7 @@ void IdentityGetAuthTokenFunction::OnIssueAdviceSuccess( void IdentityGetAuthTokenFunction::OnRemoteConsentSuccess( const RemoteConsentResolutionData& resolution_data) { - if (!base::FeatureList::IsEnabled(switches::kOAuthRemoteConsent)) { + if (!base::FeatureList::IsEnabled(::switches::kOAuthRemoteConsent)) { // Fallback to the issue advice flow. // TODO(https://crbug.com/1026237): Remove the fallback after making sure // that the new flow works correctly. diff --git chrome/browser/extensions/api/input_ime/input_ime_api.cc chrome/browser/extensions/api/input_ime/input_ime_api.cc index a7cea04fa3d0..60dc5475e747 100644 --- chrome/browser/extensions/api/input_ime/input_ime_api.cc +++ chrome/browser/extensions/api/input_ime/input_ime_api.cc @@ -19,7 +19,9 @@ namespace SendKeyEvents = extensions::api::input_ime::SendKeyEvents; using input_method::InputMethodEngineBase; namespace { +namespace i { const char kErrorRouterNotAvailable[] = "The router is not available."; +} const char kErrorSetKeyEventsFail[] = "Could not send key events."; InputMethodEngineBase* GetEngineIfActive(Profile* profile, @@ -27,7 +29,7 @@ InputMethodEngineBase* GetEngineIfActive(Profile* profile, std::string* error) { extensions::InputImeEventRouter* event_router = extensions::GetInputImeEventRouter(profile); - DCHECK(event_router) << kErrorRouterNotAvailable; + DCHECK(event_router) << i::kErrorRouterNotAvailable; InputMethodEngineBase* engine = event_router->GetEngineIfActive(extension_id, error); return engine; diff --git chrome/browser/native_file_system/chrome_native_file_system_permission_context.cc chrome/browser/native_file_system/chrome_native_file_system_permission_context.cc index e0da20cc3bb6..b3f6720dff90 100644 --- chrome/browser/native_file_system/chrome_native_file_system_permission_context.cc +++ chrome/browser/native_file_system/chrome_native_file_system_permission_context.cc @@ -194,6 +194,7 @@ bool ShouldBlockAccessToPath(const base::FilePath& check_path) { // Returns a callback that calls the passed in |callback| by posting a task to // the current sequenced task runner. +namespace i { template base::OnceCallback BindResultCallbackToCurrentSequence( @@ -207,6 +208,7 @@ BindResultCallbackToCurrentSequence( }, base::SequencedTaskRunnerHandle::Get(), std::move(callback)); } +} // namespace i void DoSafeBrowsingCheckOnUIThread( int process_id, @@ -402,7 +404,7 @@ void ChromeNativeFileSystemPermissionContext:: } auto result_callback = - BindResultCallbackToCurrentSequence(std::move(callback)); + i::BindResultCallbackToCurrentSequence(std::move(callback)); base::PostTask( FROM_HERE, {content::BrowserThread::UI}, diff --git chrome/browser/optimization_guide/optimization_guide_navigation_data.cc chrome/browser/optimization_guide/optimization_guide_navigation_data.cc index b532a58d5db7..e6d30ce29ea1 100644 --- chrome/browser/optimization_guide/optimization_guide_navigation_data.cc +++ chrome/browser/optimization_guide/optimization_guide_navigation_data.cc @@ -8,6 +8,7 @@ #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/strings/stringprintf.h" +#include "chrome/browser/optimization_guide/optimization_guide_util.h" #include "chrome/browser/optimization_guide/optimization_guide_web_contents_observer.h" #include "components/optimization_guide/hints_processing_util.h" #include "content/public/browser/navigation_handle.h" @@ -16,25 +17,6 @@ #include "services/metrics/public/cpp/ukm_source.h" #include "services/metrics/public/cpp/ukm_source_id.h" -namespace { - -// The returned string is used to record histograms for the optimization target. -// Also add the string to OptimizationGuide.OptimizationTargets histogram -// suffixes in histograms.xml. -std::string GetStringNameForOptimizationTarget( - optimization_guide::proto::OptimizationTarget optimization_target) { - switch (optimization_target) { - case optimization_guide::proto::OPTIMIZATION_TARGET_UNKNOWN: - return "Unknown"; - case optimization_guide::proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD: - return "PainfulPageLoad"; - } - NOTREACHED(); - return std::string(); -} - -} // namespace - OptimizationGuideNavigationData::OptimizationGuideNavigationData( int64_t navigation_id) : navigation_id_(navigation_id) {} diff --git chrome/browser/optimization_guide/prediction/prediction_manager.cc chrome/browser/optimization_guide/prediction/prediction_manager.cc index 7b7567f55df2..3b204a446187 100644 --- chrome/browser/optimization_guide/prediction/prediction_manager.cc +++ chrome/browser/optimization_guide/prediction/prediction_manager.cc @@ -62,7 +62,9 @@ bool ShouldUseCurrentOptimizationTargetDecision( // Delay between retries on failed fetch and store of prediction models and // host model features from the remote Optimization Guide Service. +namespace i { constexpr base::TimeDelta kFetchRetryDelay = base::TimeDelta::FromMinutes(16); +} // The amount of time to wait after a successful fetch of models and host model // features before requesting an update from the remote Optimization Guide @@ -72,11 +74,13 @@ constexpr base::TimeDelta kUpdateModelsAndFeaturesDelay = // Provide a random time delta in seconds before fetching models and host model // features. +namespace i { base::TimeDelta RandomFetchDelay() { return base::TimeDelta::FromSeconds(base::RandInt( optimization_guide::features::PredictionModelFetchRandomMinDelaySecs(), optimization_guide::features::PredictionModelFetchRandomMaxDelaySecs())); } +} // Util class for recording the state of a prediction model. The result is // recorded when it goes out of scope and its destructor is called. @@ -822,12 +826,12 @@ void PredictionManager::ScheduleModelsAndHostModelFeaturesFetch() { model_and_features_store_->GetHostModelFeaturesUpdateTime() - clock_->Now(); const base::TimeDelta time_until_retry = - GetLastFetchAttemptTime() + kFetchRetryDelay - clock_->Now(); + GetLastFetchAttemptTime() + i::kFetchRetryDelay - clock_->Now(); base::TimeDelta fetcher_delay = std::max(time_until_update_time, time_until_retry); if (fetcher_delay <= base::TimeDelta()) { SetLastModelAndFeaturesFetchAttemptTime(clock_->Now()); - fetch_timer_.Start(FROM_HERE, RandomFetchDelay(), this, + fetch_timer_.Start(FROM_HERE, i::RandomFetchDelay(), this, &PredictionManager::FetchModelsAndHostModelFeatures); return; } diff --git chrome/browser/performance_manager/decorators/process_priority_aggregator.cc chrome/browser/performance_manager/decorators/process_priority_aggregator.cc index 43ad1e7a3a42..e158b1dff474 100644 --- chrome/browser/performance_manager/decorators/process_priority_aggregator.cc +++ chrome/browser/performance_manager/decorators/process_priority_aggregator.cc @@ -22,6 +22,7 @@ class ProcessPriorityAggregatorAccess { namespace { +namespace i { class DataImpl : public ProcessPriorityAggregator::Data, public NodeAttachedDataImpl { public: @@ -37,6 +38,7 @@ class DataImpl : public ProcessPriorityAggregator::Data, return ProcessPriorityAggregatorAccess::GetUniquePtrStorage(process_node); } }; +} // namespace i } // namespace @@ -106,7 +108,7 @@ base::TaskPriority ProcessPriorityAggregator::Data::GetPriority() const { // static ProcessPriorityAggregator::Data* ProcessPriorityAggregator::Data::GetForTesting( ProcessNodeImpl* process_node) { - return DataImpl::Get(process_node); + return i::DataImpl::Get(process_node); } ProcessPriorityAggregator::ProcessPriorityAggregator() = default; @@ -114,7 +116,7 @@ ProcessPriorityAggregator::~ProcessPriorityAggregator() = default; void ProcessPriorityAggregator::OnFrameNodeAdded(const FrameNode* frame_node) { auto* process_node = ProcessNodeImpl::FromNode(frame_node->GetProcessNode()); - DataImpl* data = DataImpl::Get(process_node); + i::DataImpl* data = i::DataImpl::Get(process_node); data->Increment(frame_node->GetPriorityAndReason().priority()); // This is a nop if the priority didn't actually change. process_node->set_priority(data->GetPriority()); @@ -123,7 +125,7 @@ void ProcessPriorityAggregator::OnFrameNodeAdded(const FrameNode* frame_node) { void ProcessPriorityAggregator::OnBeforeFrameNodeRemoved( const FrameNode* frame_node) { auto* process_node = ProcessNodeImpl::FromNode(frame_node->GetProcessNode()); - DataImpl* data = DataImpl::Get(process_node); + i::DataImpl* data = i::DataImpl::Get(process_node); data->Decrement(frame_node->GetPriorityAndReason().priority()); // This is a nop if the priority didn't actually change. process_node->set_priority(data->GetPriority()); @@ -140,7 +142,7 @@ void ProcessPriorityAggregator::OnPriorityAndReasonChanged( // Update the distinct frame priority counts, and set the process priority // accordingly. auto* process_node = ProcessNodeImpl::FromNode(frame_node->GetProcessNode()); - DataImpl* data = DataImpl::Get(process_node); + i::DataImpl* data = i::DataImpl::Get(process_node); data->Decrement(previous_value.priority()); data->Increment(new_value.priority()); // This is a nop if the priority didn't actually change. @@ -160,8 +162,8 @@ void ProcessPriorityAggregator::OnTakenFromGraph(Graph* graph) { void ProcessPriorityAggregator::OnProcessNodeAdded( const ProcessNode* process_node) { auto* process_node_impl = ProcessNodeImpl::FromNode(process_node); - DCHECK(!DataImpl::Get(process_node_impl)); - DataImpl* data = DataImpl::GetOrCreate(process_node_impl); + DCHECK(!i::DataImpl::Get(process_node_impl)); + i::DataImpl* data = i::DataImpl::GetOrCreate(process_node_impl); DCHECK(data->IsEmpty()); DCHECK_EQ(base::TaskPriority::LOWEST, process_node_impl->priority()); DCHECK_EQ(base::TaskPriority::LOWEST, data->GetPriority()); @@ -171,7 +173,7 @@ void ProcessPriorityAggregator::OnBeforeProcessNodeRemoved( const ProcessNode* process_node) { #if DCHECK_IS_ON() auto* process_node_impl = ProcessNodeImpl::FromNode(process_node); - DataImpl* data = DataImpl::Get(process_node_impl); + i::DataImpl* data = i::DataImpl::Get(process_node_impl); DCHECK(data->IsEmpty()); #endif } diff --git chrome/browser/sharing/webrtc/ice_config_fetcher.cc chrome/browser/sharing/webrtc/ice_config_fetcher.cc index 6dee784e18f8..66bb7b805728 100644 --- chrome/browser/sharing/webrtc/ice_config_fetcher.cc +++ chrome/browser/sharing/webrtc/ice_config_fetcher.cc @@ -23,6 +23,7 @@ const char kIceConfigApiUrl[] = // configs. constexpr int kMaxBodySize = 16 * 1024; +namespace i { const net::NetworkTrafficAnnotationTag kTrafficAnnotation = net::DefineNetworkTrafficAnnotation("ice_config_fetcher", R"( semantics { @@ -48,6 +49,7 @@ const net::NetworkTrafficAnnotationTag kTrafficAnnotation = } } })"); +} // namespace i bool IsLoaderSuccessful(const network::SimpleURLLoader* loader) { if (!loader || loader->NetError() != net::OK) @@ -82,7 +84,7 @@ void IceConfigFetcher::GetIceServers(IceServerCallback callback) { "application/json"); url_loader_ = network::SimpleURLLoader::Create(std::move(resource_request), - kTrafficAnnotation); + i::kTrafficAnnotation); url_loader_->DownloadToString( url_loader_factory_.get(), base::BindOnce(&IceConfigFetcher::OnIceServersResponse, diff --git chrome/browser/ui/views/confirm_bubble_views.cc chrome/browser/ui/views/confirm_bubble_views.cc index fb01319cb878..3a66aa3aaa72 100644 --- chrome/browser/ui/views/confirm_bubble_views.cc +++ chrome/browser/ui/views/confirm_bubble_views.cc @@ -27,6 +27,7 @@ namespace { +namespace i { std::unique_ptr CreateExtraView(views::ButtonListener* listener) { auto help_button = CreateVectorImageButton(listener); help_button->SetFocusForPlatform(); @@ -34,6 +35,7 @@ std::unique_ptr CreateExtraView(views::ButtonListener* listener) { SetImageFromVectorIcon(help_button.get(), vector_icons::kHelpOutlineIcon); return help_button; } +} // namespace i } // namespace @@ -49,7 +51,7 @@ ConfirmBubbleViews::ConfirmBubbleViews( &ConfirmBubbleModel::Accept, base::Unretained(model_.get()))); DialogDelegate::set_cancel_callback(base::BindOnce( &ConfirmBubbleModel::Cancel, base::Unretained(model_.get()))); - help_button_ = DialogDelegate::SetExtraView(::CreateExtraView(this)); + help_button_ = DialogDelegate::SetExtraView(::i::CreateExtraView(this)); set_margins(ChromeLayoutProvider::Get()->GetDialogInsetsForContentType( views::TEXT, views::TEXT)); diff --git components/metrics/metrics_state_manager.cc components/metrics/metrics_state_manager.cc index 26b3faa7deae..75ae68d0b0b3 100644 --- components/metrics/metrics_state_manager.cc +++ components/metrics/metrics_state_manager.cc @@ -41,7 +41,9 @@ namespace { // The argument used to generate a non-identifying entropy source. We want no // more than 13 bits of entropy, so use this max to return a number in the range // [0, 7999] as the entropy source (12.97 bits of entropy). +namespace i { const int kMaxLowEntropySize = 8000; +} int64_t ReadEnabledDate(PrefService* local_state) { return local_state->GetInt64(prefs::kMetricsReportingEnabledTimestamp); @@ -298,7 +300,7 @@ std::unique_ptr MetricsStateManager::CreateLowEntropyProvider() { int source = GetLowEntropySource(); return std::make_unique( - base::checked_cast(source), kMaxLowEntropySize); + base::checked_cast(source), i::kMaxLowEntropySize); } // static diff --git content/browser/accessibility/accessibility_event_recorder_win.cc content/browser/accessibility/accessibility_event_recorder_win.cc index f4fcad03c04c..99b769763511 100644 --- content/browser/accessibility/accessibility_event_recorder_win.cc +++ content/browser/accessibility/accessibility_event_recorder_win.cc @@ -29,6 +29,7 @@ namespace content { namespace { +namespace i { std::string RoleVariantToString(const base::win::ScopedVariant& role) { if (role.type() == VT_I4) { return base::UTF16ToUTF8(IAccessibleRoleToString(V_I4(role.ptr()))); @@ -55,6 +56,7 @@ HRESULT QueryIAccessibleText(IAccessible* accessible, accessible_text) : hr; } +} // namespace i std::string BstrToPrettyUTF8(BSTR bstr) { base::string16 str16(bstr, SysStringLen(bstr)); @@ -291,7 +293,7 @@ void AccessibilityEventRecorderWin::OnWinEventHook(HWINEVENTHOOK handle, AccessibleStates ia2_state = 0; Microsoft::WRL::ComPtr iaccessible2; - hr = QueryIAccessible2(iaccessible.Get(), iaccessible2.GetAddressOf()); + hr = i::QueryIAccessible2(iaccessible.Get(), iaccessible2.GetAddressOf()); bool has_ia2 = SUCCEEDED(hr) && iaccessible2; base::string16 html_tag; @@ -332,7 +334,7 @@ void AccessibilityEventRecorderWin::OnWinEventHook(HWINEVENTHOOK handle, base::StringPrintf(" class=%s", base::UTF16ToUTF8(obj_class).c_str()); } - log += base::StringPrintf(" role=%s", RoleVariantToString(role).c_str()); + log += base::StringPrintf(" role=%s", i::RoleVariantToString(role).c_str()); if (name_bstr.Length() > 0) log += base::StringPrintf(" name=\"%s\"", BstrToPrettyUTF8(name_bstr).c_str()); @@ -367,7 +369,7 @@ void AccessibilityEventRecorderWin::OnWinEventHook(HWINEVENTHOOK handle, // For TEXT_REMOVED and TEXT_INSERTED events, query the text that was // inserted or removed and include that in the log. Microsoft::WRL::ComPtr accessible_text; - hr = QueryIAccessibleText(iaccessible.Get(), accessible_text.GetAddressOf()); + hr = i::QueryIAccessibleText(iaccessible.Get(), accessible_text.GetAddressOf()); if (SUCCEEDED(hr)) { if (event == IA2_EVENT_TEXT_REMOVED) { IA2TextSegment old_text; diff --git content/browser/devtools/protocol/storage_handler.cc content/browser/devtools/protocol/storage_handler.cc index 0db088ae7917..d4567efbf0b9 100644 --- content/browser/devtools/protocol/storage_handler.cc +++ content/browser/devtools/protocol/storage_handler.cc @@ -33,8 +33,10 @@ namespace content { namespace protocol { using ClearCookiesCallback = Storage::Backend::ClearCookiesCallback; +namespace i { using GetCookiesCallback = Storage::Backend::GetCookiesCallback; using SetCookiesCallback = Storage::Backend::SetCookiesCallback; +} struct UsageListInitializer { const char* type; @@ -284,7 +286,7 @@ void StorageHandler::GetCookies(Maybe browser_context_id, storage_partition->GetCookieManagerForBrowserProcess()->GetAllCookies( base::BindOnce( - [](std::unique_ptr callback, + [](std::unique_ptr callback, const std::vector& cookies) { callback->sendSuccess(NetworkHandler::BuildCookieArray(cookies)); }, @@ -294,7 +296,7 @@ void StorageHandler::GetCookies(Maybe browser_context_id, void StorageHandler::SetCookies( std::unique_ptr> cookies, Maybe browser_context_id, - std::unique_ptr callback) { + std::unique_ptr callback) { StoragePartition* storage_partition = nullptr; Response response = StorageHandler::FindStoragePartition(browser_context_id, &storage_partition); @@ -306,7 +308,7 @@ void StorageHandler::SetCookies( NetworkHandler::SetCookies( storage_partition, std::move(cookies), base::BindOnce( - [](std::unique_ptr callback, bool success) { + [](std::unique_ptr callback, bool success) { if (success) { callback->sendSuccess(); } else { diff --git content/browser/media/capture/frame_sink_video_capture_device.cc content/browser/media/capture/frame_sink_video_capture_device.cc index 2630aae48b16..475dc5572ef7 100644 --- content/browser/media/capture/frame_sink_video_capture_device.cc +++ content/browser/media/capture/frame_sink_video_capture_device.cc @@ -53,11 +53,13 @@ class ScopedFrameDoneHelper ~ScopedFrameDoneHelper() final = default; }; +namespace i { void BindWakeLockProvider( mojo::PendingReceiver receiver) { DCHECK_CURRENTLY_ON(BrowserThread::UI); GetDeviceService().BindWakeLockProvider(std::move(receiver)); } +} } // namespace @@ -364,7 +366,7 @@ void FrameSinkVideoCaptureDevice::RequestWakeLock() { mojo::Remote wake_lock_provider; auto receiver = wake_lock_provider.BindNewPipeAndPassReceiver(); base::PostTask(FROM_HERE, {BrowserThread::UI}, - base::BindOnce(&BindWakeLockProvider, std::move(receiver))); + base::BindOnce(&i::BindWakeLockProvider, std::move(receiver))); wake_lock_provider->GetWakeLockWithoutContext( device::mojom::WakeLockType::kPreventDisplaySleep, device::mojom::WakeLockReason::kOther, "screen capture", diff --git content/browser/renderer_host/media/media_devices_manager.cc content/browser/renderer_host/media/media_devices_manager.cc index f355780cbd83..b13c0b99a530 100644 --- content/browser/renderer_host/media/media_devices_manager.cc +++ content/browser/renderer_host/media/media_devices_manager.cc @@ -60,6 +60,7 @@ struct { // Frame rates for sources with no support for capability enumeration. const uint16_t kFallbackVideoFrameRates[] = {30, 60}; +namespace i { void SendLogMessage(const std::string& message) { MediaStreamManager::SendMessageToNativeLog("MDM::" + message); } @@ -77,12 +78,13 @@ const char* DeviceTypeToString(blink::MediaDeviceType device_type) { } return "UNKNOWN"; } +} // namespace i std::string GetDevicesEnumeratedLogString( blink::MediaDeviceType device_type, const blink::WebMediaDeviceInfoArray& device_infos) { std::string str = base::StringPrintf("DevicesEnumerated({type=%s}, ", - DeviceTypeToString(device_type)); + i::DeviceTypeToString(device_type)); base::StringAppendF(&str, "{labels=["); for (const auto& device_info : device_infos) base::StringAppendF(&str, "%s, ", device_info.label.c_str()); @@ -391,7 +393,7 @@ MediaDevicesManager::MediaDevicesManager( DCHECK(video_capture_manager_.get()); DCHECK(!stop_removed_input_device_cb_.is_null()); DCHECK(!ui_input_device_change_cb_.is_null()); - SendLogMessage("MediaDevicesManager()"); + i::SendLogMessage("MediaDevicesManager()"); cache_policies_.fill(CachePolicy::NO_CACHE); has_seen_result_.fill(false); } @@ -433,7 +435,7 @@ void MediaDevicesManager::EnumerateDevices( DCHECK(request_audio_input_capabilities && requested_types[blink::MEDIA_DEVICE_TYPE_AUDIO_INPUT] || !request_audio_input_capabilities); - SendLogMessage(base::StringPrintf( + i::SendLogMessage(base::StringPrintf( "EnumerateDevices({render_process_id=%d}, {render_frame_id=%d}, " "{request_audio=%s}, {request_video=%s})", render_process_id, render_frame_id, @@ -514,7 +516,7 @@ void MediaDevicesManager::StartMonitoring() { std::make_unique(); } #endif - SendLogMessage("StartMonitoring()"); + i::SendLogMessage("StartMonitoring()"); monitoring_started_ = true; base::SystemMonitor::Get()->AddDevicesChangedObserver(this); @@ -547,7 +549,7 @@ void MediaDevicesManager::StopMonitoring() { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (!monitoring_started_) return; - SendLogMessage(base::StringPrintf("StopMonitoring([this=%p])", this)); + i::SendLogMessage(base::StringPrintf("StopMonitoring([this=%p])", this)); base::SystemMonitor::Get()->RemoveDevicesChangedObserver(this); audio_service_device_listener_.reset(); monitoring_started_ = false; @@ -857,8 +859,8 @@ void MediaDevicesManager::DoEnumerateDevices(blink::MediaDeviceType type) { CacheInfo& cache_info = cache_infos_[type]; if (cache_info.is_update_ongoing()) return; - SendLogMessage(base::StringPrintf("DoEnumerateDevices({type=%s})", - DeviceTypeToString(type))); + i::SendLogMessage(base::StringPrintf("DoEnumerateDevices({type=%s})", + i::DeviceTypeToString(type))); cache_info.UpdateStarted(); switch (type) { @@ -928,7 +930,7 @@ void MediaDevicesManager::DevicesEnumerated( UpdateSnapshot(type, snapshot); cache_infos_[type].UpdateCompleted(); has_seen_result_[type] = true; - SendLogMessage(GetDevicesEnumeratedLogString(type, snapshot)); + i::SendLogMessage(GetDevicesEnumeratedLogString(type, snapshot)); if (cache_policies_[type] == CachePolicy::NO_CACHE) { for (auto& request : requests_) @@ -1047,8 +1049,8 @@ void MediaDevicesManager::HandleDevicesChanged(blink::MediaDeviceType type) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(IsValidMediaDeviceType(type)); if (!cache_infos_[type].is_update_ongoing()) { - SendLogMessage(base::StringPrintf("HandleDevicesChanged({type=%s}", - DeviceTypeToString(type))); + i::SendLogMessage(base::StringPrintf("HandleDevicesChanged({type=%s}", + i::DeviceTypeToString(type))); } cache_infos_[type].InvalidateCache(); DoEnumerateDevices(type); @@ -1151,9 +1153,9 @@ void MediaDevicesManager::NotifyDeviceChange( auto it = subscriptions_.find(subscription_id); if (it == subscriptions_.end()) return; - SendLogMessage( + i::SendLogMessage( base::StringPrintf("NotifyDeviceChange({subscription_id=%u}, {type=%s}", - subscription_id, DeviceTypeToString(type))); + subscription_id, i::DeviceTypeToString(type))); const SubscriptionRequest& request = it->second; request.listener_->OnDevicesChanged( diff --git content/browser/service_worker/service_worker_registry.cc content/browser/service_worker/service_worker_registry.cc index 7f3723d16532..b1baf98fe511 100644 --- content/browser/service_worker/service_worker_registry.cc +++ content/browser/service_worker/service_worker_registry.cc @@ -18,9 +18,11 @@ namespace content { namespace { +namespace i { void RunSoon(const base::Location& from_here, base::OnceClosure closure) { base::ThreadTaskRunnerHandle::Get()->PostTask(from_here, std::move(closure)); } +} void CompleteFindNow(scoped_refptr registration, blink::ServiceWorkerStatusCode status, @@ -39,7 +41,7 @@ void CompleteFindSoon( scoped_refptr registration, blink::ServiceWorkerStatusCode status, ServiceWorkerRegistry::FindRegistrationCallback callback) { - RunSoon(from_here, base::BindOnce(&CompleteFindNow, std::move(registration), + i::RunSoon(from_here, base::BindOnce(&CompleteFindNow, std::move(registration), status, std::move(callback))); } @@ -116,7 +118,7 @@ void ServiceWorkerRegistry::FindRegistrationForScope( const GURL& scope, FindRegistrationCallback callback) { if (storage()->IsDisabled()) { - RunSoon( + i::RunSoon( FROM_HERE, base::BindOnce(std::move(callback), blink::ServiceWorkerStatusCode::kErrorAbort, nullptr)); @@ -232,7 +234,7 @@ void ServiceWorkerRegistry::StoreRegistration( DCHECK(version); if (storage()->IsDisabled()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), blink::ServiceWorkerStatusCode::kErrorAbort)); return; @@ -265,7 +267,7 @@ void ServiceWorkerRegistry::StoreRegistration( version->script_cache_map()->GetResources(&resources); if (resources.empty()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), blink::ServiceWorkerStatusCode::kErrorFailed)); return; @@ -289,7 +291,7 @@ void ServiceWorkerRegistry::DeleteRegistration( const GURL& origin, StatusCallback callback) { if (storage()->IsDisabled()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), blink::ServiceWorkerStatusCode::kErrorAbort)); return; @@ -353,14 +355,14 @@ void ServiceWorkerRegistry::GetUserData(int64_t registration_id, GetUserDataCallback callback) { if (registration_id == blink::mojom::kInvalidServiceWorkerRegistrationId || keys.empty()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), std::vector(), blink::ServiceWorkerStatusCode::kErrorFailed)); return; } for (const std::string& key : keys) { if (key.empty()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), std::vector(), blink::ServiceWorkerStatusCode::kErrorFailed)); return; @@ -379,7 +381,7 @@ void ServiceWorkerRegistry::GetUserDataByKeyPrefix( GetUserDataCallback callback) { if (registration_id == blink::mojom::kInvalidServiceWorkerRegistrationId || key_prefix.empty()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), std::vector(), blink::ServiceWorkerStatusCode::kErrorFailed)); return; @@ -397,7 +399,7 @@ void ServiceWorkerRegistry::GetUserKeysAndDataByKeyPrefix( GetUserKeysAndDataCallback callback) { if (registration_id == blink::mojom::kInvalidServiceWorkerRegistrationId || key_prefix.empty()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), base::flat_map(), blink::ServiceWorkerStatusCode::kErrorFailed)); @@ -417,14 +419,14 @@ void ServiceWorkerRegistry::StoreUserData( StatusCallback callback) { if (registration_id == blink::mojom::kInvalidServiceWorkerRegistrationId || key_value_pairs.empty()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), blink::ServiceWorkerStatusCode::kErrorFailed)); return; } for (const auto& kv : key_value_pairs) { if (kv.first.empty()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), blink::ServiceWorkerStatusCode::kErrorFailed)); return; @@ -442,14 +444,14 @@ void ServiceWorkerRegistry::ClearUserData(int64_t registration_id, StatusCallback callback) { if (registration_id == blink::mojom::kInvalidServiceWorkerRegistrationId || keys.empty()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), blink::ServiceWorkerStatusCode::kErrorFailed)); return; } for (const std::string& key : keys) { if (key.empty()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), blink::ServiceWorkerStatusCode::kErrorFailed)); return; @@ -468,14 +470,14 @@ void ServiceWorkerRegistry::ClearUserDataByKeyPrefixes( StatusCallback callback) { if (registration_id == blink::mojom::kInvalidServiceWorkerRegistrationId || key_prefixes.empty()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), blink::ServiceWorkerStatusCode::kErrorFailed)); return; } for (const std::string& key_prefix : key_prefixes) { if (key_prefix.empty()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), blink::ServiceWorkerStatusCode::kErrorFailed)); return; @@ -492,7 +494,7 @@ void ServiceWorkerRegistry::ClearUserDataForAllRegistrationsByKeyPrefix( const std::string& key_prefix, StatusCallback callback) { if (key_prefix.empty()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), blink::ServiceWorkerStatusCode::kErrorFailed)); return; @@ -508,7 +510,7 @@ void ServiceWorkerRegistry::GetUserDataForAllRegistrations( const std::string& key, GetUserDataForAllRegistrationsCallback callback) { if (key.empty()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), std::vector>(), blink::ServiceWorkerStatusCode::kErrorFailed)); @@ -525,7 +527,7 @@ void ServiceWorkerRegistry::GetUserDataForAllRegistrationsByKeyPrefix( const std::string& key_prefix, GetUserDataForAllRegistrationsCallback callback) { if (key_prefix.empty()) { - RunSoon(FROM_HERE, + i::RunSoon(FROM_HERE, base::BindOnce(std::move(callback), std::vector>(), blink::ServiceWorkerStatusCode::kErrorFailed)); diff --git content/browser/web_package/web_bundle_blob_data_source.cc content/browser/web_package/web_bundle_blob_data_source.cc index ee575969d8e8..1f11b02fb049 100644 --- content/browser/web_package/web_bundle_blob_data_source.cc +++ content/browser/web_package/web_bundle_blob_data_source.cc @@ -23,6 +23,7 @@ namespace content { namespace { +namespace i { class MojoBlobReaderDelegate : public storage::MojoBlobReader::Delegate { public: using CompletionCallback = base::OnceCallback; @@ -43,6 +44,7 @@ class MojoBlobReaderDelegate : public storage::MojoBlobReader::Delegate { CompletionCallback completion_callback_; DISALLOW_COPY_AND_ASSIGN(MojoBlobReaderDelegate); }; +} // namespace i void OnReadComplete( data_decoder::mojom::BundleDataSource::ReadCallback callback, @@ -364,7 +366,7 @@ void WebBundleBlobDataSource::BlobDataSourceCore::OnBlobReadyForReadToDataPipe( } storage::MojoBlobReader::Create( blob_.get(), net::HttpByteRange::Bounded(offset, offset + length - 1), - std::make_unique(std::move(callback)), + std::make_unique(std::move(callback)), std::move(producer_handle)); } diff --git gpu/command_buffer/service/shared_image_backing_d3d.cc gpu/command_buffer/service/shared_image_backing_d3d.cc index 73533fba5b15..42859c57dcd7 100644 --- gpu/command_buffer/service/shared_image_backing_d3d.cc +++ gpu/command_buffer/service/shared_image_backing_d3d.cc @@ -15,6 +15,7 @@ namespace gpu { namespace { +namespace i { class ScopedRestoreTexture2D { public: explicit ScopedRestoreTexture2D(gl::GLApi* api) : api_(api) { @@ -32,6 +33,7 @@ class ScopedRestoreTexture2D { GLuint prev_binding_ = 0; DISALLOW_COPY_AND_ASSIGN(ScopedRestoreTexture2D); }; +} // namespace i } // anonymous namespace @@ -207,7 +209,7 @@ bool SharedImageBackingD3D::PresentSwapChain() { } gl::GLApi* const api = gl::g_current_gl_context; - ScopedRestoreTexture2D scoped_restore(api); + i::ScopedRestoreTexture2D scoped_restore(api); const GLenum target = GL_TEXTURE_2D; const GLuint service_id = diff --git media/muxers/webm_muxer.h media/muxers/webm_muxer.h index 0d9b8c6de789..d78badac69b2 100644 --- media/muxers/webm_muxer.h +++ media/muxers/webm_muxer.h @@ -13,6 +13,7 @@ #include "base/containers/circular_deque.h" #include "base/macros.h" #include "base/numerics/safe_math.h" +#include "base/optional.h" #include "base/strings/string_piece.h" #include "base/threading/thread_checker.h" #include "base/time/time.h" diff --git services/network/public/cpp/cert_verifier/nss_ocsp_session_url_loader.cc services/network/public/cpp/cert_verifier/nss_ocsp_session_url_loader.cc index 0a95dacbfba4..a120f442770c 100644 --- services/network/public/cpp/cert_verifier/nss_ocsp_session_url_loader.cc +++ services/network/public/cpp/cert_verifier/nss_ocsp_session_url_loader.cc @@ -22,9 +22,11 @@ namespace { // URL. const int kMaxResponseSizeInBytes = 5 * 1024 * 1024; +namespace i { bool CanFetchUrl(const GURL& url) { return url.SchemeIs("http"); } +} // namespace i } // namespace @@ -63,7 +65,7 @@ void OCSPRequestSessionDelegateURLLoader::StartLoad( const net::OCSPRequestSessionParams* params) { DCHECK(load_task_runner_->RunsTasksInCurrentSequence()); - if (!CanFetchUrl(params->url) || !delegate_factory_) { + if (!i::CanFetchUrl(params->url) || !delegate_factory_) { CancelLoad(); return; } @@ -142,7 +144,7 @@ void OCSPRequestSessionDelegateURLLoader::OnReceivedRedirect( std::vector* removed_headers) { DCHECK(load_task_runner_->RunsTasksInCurrentSequence()); - if (!CanFetchUrl(redirect_info.new_url)) { + if (!i::CanFetchUrl(redirect_info.new_url)) { CancelLoad(); // May delete |this| } } diff --git storage/browser/quota/quota_settings.cc storage/browser/quota/quota_settings.cc index b2210b55b40f..668246e5f363 100644 --- storage/browser/quota/quota_settings.cc +++ storage/browser/quota/quota_settings.cc @@ -21,7 +21,9 @@ namespace storage { namespace { +namespace i { const int64_t kMBytes = 1024 * 1024; +} const int kRandomizedPercentage = 10; // Skews |value| by +/- |percent|. @@ -35,7 +37,7 @@ storage::QuotaSettings CalculateIncognitoDynamicSettings( // The incognito pool size is a fraction of the amount of system memory, // and the amount is capped to a hard limit. double incognito_pool_size_ratio = 0.1; // 10% - int64_t max_incognito_pool_size = 300 * kMBytes; + int64_t max_incognito_pool_size = 300 * i::kMBytes; if (base::FeatureList::IsEnabled(features::kIncognitoDynamicQuota)) { const double lower_bound = features::kIncognitoQuotaRatioLowerBound.Get(); const double upper_bound = features::kIncognitoQuotaRatioUpperBound.Get(); @@ -89,7 +91,7 @@ base::Optional CalculateNominalDynamicSettings( // * 64GB storage -- min(6GB,2GB) = 2GB // * 16GB storage -- min(1.6GB,2GB) = 1.6GB // * 8GB storage -- min(800MB,2GB) = 800MB - const int64_t kShouldRemainAvailableFixed = 2048 * kMBytes; // 2GB + const int64_t kShouldRemainAvailableFixed = 2048 * i::kMBytes; // 2GB const double kShouldRemainAvailableRatio = 0.1; // 10% // The amount of the device's storage the browser attempts to @@ -104,7 +106,7 @@ base::Optional CalculateNominalDynamicSettings( // * 64GB storage -- min(640MB,1GB) = 640MB // * 16GB storage -- min(160MB,1GB) = 160MB // * 8GB storage -- min(80MB,1GB) = 80MB - const int64_t kMustRemainAvailableFixed = 1024 * kMBytes; // 1GB + const int64_t kMustRemainAvailableFixed = 1024 * i::kMBytes; // 1GB const double kMustRemainAvailableRatio = 0.01; // 1% // The fraction of the temporary pool that can be utilized by a single host. @@ -116,7 +118,7 @@ base::Optional CalculateNominalDynamicSettings( // SessionOnly (or ephemeral) origins are allotted a fraction of what // normal origins are provided, and the amount is capped to a hard limit. const double kSessionOnlyHostQuotaRatio = 0.1; // 10% - const int64_t kMaxSessionOnlyHostQuota = 300 * kMBytes; + const int64_t kMaxSessionOnlyHostQuota = 300 * i::kMBytes; storage::QuotaSettings settings; diff --git third_party/blink/renderer/core/animation/css_transform_interpolation_type.cc third_party/blink/renderer/core/animation/css_transform_interpolation_type.cc index 25afc795a40f..202e40badb96 100644 --- third_party/blink/renderer/core/animation/css_transform_interpolation_type.cc +++ third_party/blink/renderer/core/animation/css_transform_interpolation_type.cc @@ -45,6 +45,7 @@ class InheritedTransformChecker const TransformOperations inherited_transform_; }; +namespace i { class AlwaysInvalidateChecker : public CSSInterpolationType::CSSConversionChecker { public: @@ -53,6 +54,8 @@ class AlwaysInvalidateChecker return false; } }; +} // namespace i + } // namespace InterpolationValue CSSTransformInterpolationType::MaybeConvertNeutral( @@ -124,7 +127,7 @@ CSSTransformInterpolationType::PreInterpolationCompositeIfNeeded( // to disable that caching in this case. // TODO(crbug.com/1009230): Remove this once our interpolation code isn't // caching composited values. - conversion_checkers.push_back(std::make_unique()); + conversion_checkers.push_back(std::make_unique()); InterpolableTransformList& transform_list = To(*value.interpolable_value); diff --git third_party/blink/renderer/core/layout/ng/ng_absolute_utils.cc third_party/blink/renderer/core/layout/ng/ng_absolute_utils.cc index a8595ea2ff08..043350e75692 100644 --- third_party/blink/renderer/core/layout/ng/ng_absolute_utils.cc +++ third_party/blink/renderer/core/layout/ng/ng_absolute_utils.cc @@ -57,55 +57,57 @@ bool IsTopDominant(const WritingMode container_writing_mode, // A direction agnostic version of |NGLogicalStaticPosition::InlineEdge|, and // |NGLogicalStaticPosition::BlockEdge|. +namespace i { enum StaticPositionEdge { kStart, kCenter, kEnd }; +} -inline StaticPositionEdge GetStaticPositionEdge( +inline i::StaticPositionEdge GetStaticPositionEdge( NGLogicalStaticPosition::InlineEdge inline_edge) { switch (inline_edge) { case NGLogicalStaticPosition::InlineEdge::kInlineStart: - return kStart; + return i::kStart; case NGLogicalStaticPosition::InlineEdge::kInlineCenter: - return kCenter; + return i::kCenter; case NGLogicalStaticPosition::InlineEdge::kInlineEnd: - return kEnd; + return i::kEnd; } } -inline StaticPositionEdge GetStaticPositionEdge( +inline i::StaticPositionEdge GetStaticPositionEdge( NGLogicalStaticPosition::BlockEdge block_edge) { switch (block_edge) { case NGLogicalStaticPosition::BlockEdge::kBlockStart: - return kStart; + return i::kStart; case NGLogicalStaticPosition::BlockEdge::kBlockCenter: - return kCenter; + return i::kCenter; case NGLogicalStaticPosition::BlockEdge::kBlockEnd: - return kEnd; + return i::kEnd; } } -inline LayoutUnit StaticPositionStartInset(StaticPositionEdge edge, +inline LayoutUnit StaticPositionStartInset(i::StaticPositionEdge edge, LayoutUnit static_position_offset, LayoutUnit size) { switch (edge) { - case kStart: + case i::kStart: return static_position_offset; - case kCenter: + case i::kCenter: return static_position_offset - (size / 2); - case kEnd: + case i::kEnd: return static_position_offset - size; } } -inline LayoutUnit StaticPositionEndInset(StaticPositionEdge edge, +inline LayoutUnit StaticPositionEndInset(i::StaticPositionEdge edge, LayoutUnit static_position_offset, LayoutUnit available_size, LayoutUnit size) { switch (edge) { - case kStart: + case i::kStart: return available_size - static_position_offset - size; - case kCenter: + case i::kCenter: return available_size - static_position_offset - (size / 2); - case kEnd: + case i::kEnd: return available_size - static_position_offset; } } @@ -136,7 +138,7 @@ void ComputeAbsoluteSize(const LayoutUnit border_padding_size, const LayoutUnit min_size, const LayoutUnit max_size, const LayoutUnit static_position_offset, - StaticPositionEdge static_position_edge, + i::StaticPositionEdge static_position_edge, bool is_start_dominant, bool is_block_direction, base::Optional size, @@ -178,13 +180,13 @@ void ComputeAbsoluteSize(const LayoutUnit border_padding_size, LayoutUnit computed_available_size; switch (static_position_edge) { - case kStart: + case i::kStart: // The available-size for the start static-position "grows" towards the // end edge. // | *----------->| computed_available_size = available_size - static_position_offset; break; - case kCenter: + case i::kCenter: // The available-size for the center static-position "grows" towards // both edges (equally), and stops when it hits the first one. // |<-----*----> | @@ -192,7 +194,7 @@ void ComputeAbsoluteSize(const LayoutUnit border_padding_size, 2 * std::min(static_position_offset, available_size - static_position_offset); break; - case kEnd: + case i::kEnd: // The available-size for the end static-position "grows" towards the // start edge. // |<-----* | diff --git third_party/blink/renderer/modules/mediastream/input_device_info.cc third_party/blink/renderer/modules/mediastream/input_device_info.cc index 9ec87eb44495..74259742e417 100644 --- third_party/blink/renderer/modules/mediastream/input_device_info.cc +++ third_party/blink/renderer/modules/mediastream/input_device_info.cc @@ -23,6 +23,7 @@ namespace { // TODO(c.padhi): Merge this method with ToWebFacingMode() in // media_stream_constraints_util_video_device.h, see https://crbug.com/821668. +namespace i { WebMediaStreamTrack::FacingMode ToWebFacingMode( media::VideoFacingMode facing_mode) { switch (facing_mode) { @@ -37,6 +38,7 @@ WebMediaStreamTrack::FacingMode ToWebFacingMode( return WebMediaStreamTrack::FacingMode::kNone; } } +} // namespace i } // namespace @@ -53,7 +55,7 @@ void InputDeviceInfo::SetVideoInputCapabilities( // ComputeCapabilitiesForVideoSource() in media_stream_constraints_util.h, see // https://crbug.com/821668. platform_capabilities_.facing_mode = - ToWebFacingMode(video_input_capabilities->facing_mode); + i::ToWebFacingMode(video_input_capabilities->facing_mode); if (!video_input_capabilities->formats.IsEmpty()) { int max_width = 1; int max_height = 1; diff --git third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc index 060674f1e823..80ef06e6fbfb 100644 --- third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc +++ third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc @@ -38,9 +38,11 @@ using EchoCancellationType = namespace { +namespace k { void SendLogMessage(const std::string& message) { blink::WebRtcLogMessage("PLAS::" + message); } +} // Used as an identifier for ProcessedLocalAudioSource::From(). void* const kProcessedLocalAudioSourceIdentifier = @@ -114,7 +116,7 @@ ProcessedLocalAudioSource::ProcessedLocalAudioSource( volume_(0), allow_invalid_render_frame_id_for_testing_(false) { SetDevice(device); - SendLogMessage( + k::SendLogMessage( base::StringPrintf("ProcessedLocalAudioSource({session_id=%s})", device.session_id().ToString().c_str())); } @@ -135,7 +137,7 @@ ProcessedLocalAudioSource* ProcessedLocalAudioSource::From( void ProcessedLocalAudioSource::SendLogMessageWithSessionId( const std::string& message) const { - SendLogMessage(message + " [session_id=" + device().session_id().ToString() + + k::SendLogMessage(message + " [session_id=" + device().session_id().ToString() + "]"); } @@ -163,7 +165,7 @@ bool ProcessedLocalAudioSource::EnsureSourceIsStarted() { return false; } - SendLogMessage(GetEnsureSourceIsStartedLogString(device())); + k::SendLogMessage(GetEnsureSourceIsStartedLogString(device())); SendLogMessageWithSessionId(base::StringPrintf( "EnsureSourceIsStarted() => (audio_processing_properties=[%s])", GetAudioProcesingPropertiesLogString(audio_processing_properties_) @@ -240,7 +242,7 @@ bool ProcessedLocalAudioSource::EnsureSourceIsStarted() { channel_layout != media::CHANNEL_LAYOUT_STEREO && channel_layout != media::CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC && channel_layout != media::CHANNEL_LAYOUT_DISCRETE) { - SendLogMessage( + k::SendLogMessage( base::StringPrintf("EnsureSourceIsStarted() => (ERROR: " "input channel layout (%d) is not supported.", static_cast(channel_layout))); diff --git third_party/blink/renderer/modules/mediastream/user_media_processor.cc third_party/blink/renderer/modules/mediastream/user_media_processor.cc index 19292a2b3279..d734b2df93c6 100644 --- third_party/blink/renderer/modules/mediastream/user_media_processor.cc +++ third_party/blink/renderer/modules/mediastream/user_media_processor.cc @@ -122,9 +122,11 @@ const char* MediaStreamRequestResultToString(MediaStreamRequestResult value) { return "INVALID"; } +namespace l { void SendLogMessage(const std::string& message) { blink::WebRtcLogMessage("UMP::" + message); } +} std::string GetTrackLogString(const blink::WebMediaStreamTrack& track, bool is_pending) { @@ -494,10 +496,10 @@ void UserMediaProcessor::RequestInfo::StartAudioTrack( #if DCHECK_IS_ON() DCHECK(audio_capture_settings_.HasValue()); #endif - SendLogMessage(GetTrackLogString(track, is_pending)); + l::SendLogMessage(GetTrackLogString(track, is_pending)); blink::MediaStreamAudioSource* native_source = blink::MediaStreamAudioSource::From(track.Source()); - SendLogMessage(GetTrackSourceLogString(native_source)); + l::SendLogMessage(GetTrackSourceLogString(native_source)); // Add the source as pending since OnTrackStarted will expect it to be there. sources_waiting_for_callback_.push_back(native_source); @@ -518,7 +520,7 @@ UserMediaProcessor::RequestInfo::CreateAndStartVideoTrack( DCHECK(source.GetType() == blink::WebMediaStreamSource::kTypeVideo); DCHECK(web_request().Video()); DCHECK(video_capture_settings_.HasValue()); - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "UMP::RI::CreateAndStartVideoTrack({request_id=%d})", request_id())); blink::MediaStreamVideoSource* native_source = @@ -546,7 +548,7 @@ void UserMediaProcessor::RequestInfo::OnTrackStarted( blink::WebPlatformMediaStreamSource* source, MediaStreamRequestResult result, const blink::WebString& result_name) { - SendLogMessage(GetOnTrackStartedLogString(request_id(), source, result)); + l::SendLogMessage(GetOnTrackStartedLogString(request_id(), source, result)); auto** it = std::find(sources_waiting_for_callback_.begin(), sources_waiting_for_callback_.end(), source); DCHECK(it != sources_waiting_for_callback_.end()); @@ -605,7 +607,7 @@ void UserMediaProcessor::ProcessRequest( DCHECK(!current_request_info_); request_completed_cb_ = std::move(callback); current_request_info_ = MakeGarbageCollected(std::move(request)); - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "ProcessRequest({request_id=%d}, {audio=%d}, " "{video=%d})", current_request_info_->request_id(), @@ -623,7 +625,7 @@ void UserMediaProcessor::SetupAudioInput() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); DCHECK(current_request_info_->web_request().Audio()); - SendLogMessage( + l::SendLogMessage( base::StringPrintf("SetupAudioInput({request_id=%d}, {constraints=%s})", current_request_info_->request_id(), current_request_info_->request() @@ -643,7 +645,7 @@ void UserMediaProcessor::SetupAudioInput() { } if (blink::IsDeviceMediaType(audio_controls.stream_type)) { - SendLogMessage( + l::SendLogMessage( base::StringPrintf("SetupAudioInput({request_id=%d}) => " "(Requesting device capabilities)", current_request_info_->request_id())); @@ -712,7 +714,7 @@ void UserMediaProcessor::SelectAudioSettings( return; DCHECK(current_request_info_->stream_controls()->audio.requested); - SendLogMessage(base::StringPrintf("SelectAudioSettings({request_id=%d})", + l::SendLogMessage(base::StringPrintf("SelectAudioSettings({request_id=%d})", current_request_info_->request_id())); auto settings = SelectSettingsAudioCapture( capabilities, web_request.AudioConstraints(), @@ -790,7 +792,7 @@ void UserMediaProcessor::SetupVideoInput() { : StreamSelectionStrategy::FORCE_NEW_STREAM); return; } - SendLogMessage( + l::SendLogMessage( base::StringPrintf("SetupVideoInput. request_id=%d, video constraints=%s", current_request_info_->request_id(), current_request_info_->request() @@ -836,7 +838,7 @@ void UserMediaProcessor::SelectVideoDeviceSettings( DCHECK(current_request_info_->stream_controls()->video.requested); DCHECK(blink::IsDeviceMediaType( current_request_info_->stream_controls()->video.stream_type)); - SendLogMessage(base::StringPrintf("SelectVideoDeviceSettings. request_id=%d.", + l::SendLogMessage(base::StringPrintf("SelectVideoDeviceSettings. request_id=%d.", current_request_info_->request_id())); blink::VideoDeviceCaptureCapabilities capabilities; @@ -879,7 +881,7 @@ void UserMediaProcessor::SelectVideoDeviceSettings( void UserMediaProcessor::SelectVideoContentSettings() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); - SendLogMessage( + l::SendLogMessage( base::StringPrintf("SelectVideoContentSettings. request_id=%d.", current_request_info_->request_id())); gfx::Size screen_size = GetScreenSize(); @@ -912,7 +914,7 @@ void UserMediaProcessor::GenerateStreamForCurrentRequestInfo( blink::mojom::StreamSelectionStrategy strategy) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "GenerateStreamForCurrentRequestInfo({request_id=%d}, " "{audio.device_id=%s}, {video.device_id=%s})", current_request_info_->request_id(), @@ -965,7 +967,7 @@ void UserMediaProcessor::OnStreamGenerated( if (!IsCurrentRequestInfo(request_id)) { // This can happen if the request is canceled or the frame reloads while // MediaStreamDispatcherHost is processing the request. - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "OnStreamGenerated([request_id=%d]) => (ERROR: invalid request ID)", request_id)); OnStreamGeneratedForCancelledRequest(audio_devices, video_devices); @@ -976,7 +978,7 @@ void UserMediaProcessor::OnStreamGenerated( for (const auto* devices : {&audio_devices, &video_devices}) { for (const auto& device : *devices) { - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "OnStreamGenerated({request_id=%d}, {label=%s}, {device=[id: %s, " "name: " "%s]})", @@ -1007,7 +1009,7 @@ void UserMediaProcessor::OnStreamGenerated( } for (const auto& video_device : video_devices) { - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "OnStreamGenerated({request_id=%d}, {label=%s}, {device=[id: %s, " "name: %s]}) => (Requesting video device formats)", request_id, label.Utf8().c_str(), video_device.id.c_str(), @@ -1044,7 +1046,7 @@ void UserMediaProcessor::GotAllVideoInputFormatsForDevice( if (!IsCurrentRequestInfo(web_request)) return; - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "GotAllVideoInputFormatsForDevice({request_id=%d}, " "{label=%s}, {device=[id: %s]}, {success=%d})", current_request_info_->request_id(), label.Utf8().c_str(), @@ -1081,7 +1083,7 @@ gfx::Size UserMediaProcessor::GetScreenSize() { void UserMediaProcessor::OnStreamGeneratedForCancelledRequest( const Vector& audio_devices, const Vector& video_devices) { - SendLogMessage("OnStreamGeneratedForCancelledRequest()"); + l::SendLogMessage("OnStreamGeneratedForCancelledRequest()"); // Only stop the device if the device is not used in another MediaStream. for (auto* it = audio_devices.begin(); it != audio_devices.end(); ++it) { if (!FindLocalSource(*it)) { @@ -1155,7 +1157,7 @@ void UserMediaProcessor::OnStreamGenerationFailed( // MediaStreamDispatcherHost is processing the request. return; } - SendLogMessage(base::StringPrintf("OnStreamGenerationFailed({request_id=%d})", + l::SendLogMessage(base::StringPrintf("OnStreamGenerationFailed({request_id=%d})", current_request_info_->request_id())); GetUserMediaRequestFailed(result); @@ -1164,7 +1166,7 @@ void UserMediaProcessor::OnStreamGenerationFailed( void UserMediaProcessor::OnDeviceStopped(const MediaStreamDevice& device) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "OnDeviceStopped({session_id=%s}, {device_id=%s})", device.session_id().ToString().c_str(), device.id.c_str())); @@ -1227,7 +1229,7 @@ blink::WebMediaStreamSource UserMediaProcessor::InitializeVideoSourceObject( const MediaStreamDevice& device) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "UMP::InitializeVideoSourceObject({request_id=%d}, {device=[id: %s, " "name: %s]})", current_request_info_->request_id(), device.id.c_str(), @@ -1255,7 +1257,7 @@ blink::WebMediaStreamSource UserMediaProcessor::InitializeAudioSourceObject( bool* is_pending) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); - SendLogMessage( + l::SendLogMessage( base::StringPrintf("InitializeAudioSourceObject({session_id=%s})", device.session_id().ToString().c_str())); @@ -1398,7 +1400,7 @@ UserMediaProcessor::CreateVideoSource( void UserMediaProcessor::StartTracks(const String& label) { DCHECK(!current_request_info_->web_request().IsNull()); - SendLogMessage(base::StringPrintf("StartTracks({request_id=%d}, {label=%s})", + l::SendLogMessage(base::StringPrintf("StartTracks({request_id=%d}, {label=%s})", current_request_info_->request_id(), label.Utf8().c_str())); if (auto* media_stream_device_observer = GetMediaStreamDeviceObserver()) { @@ -1438,7 +1440,7 @@ void UserMediaProcessor::CreateVideoTracks( DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); DCHECK_EQ(devices.size(), webkit_tracks->size()); - SendLogMessage(base::StringPrintf("UMP::CreateVideoTracks({request_id=%d})", + l::SendLogMessage(base::StringPrintf("UMP::CreateVideoTracks({request_id=%d})", current_request_info_->request_id())); for (WTF::wtf_size_t i = 0; i < devices.size(); ++i) { @@ -1461,7 +1463,7 @@ void UserMediaProcessor::CreateAudioTracks( current_request_info_->audio_capture_settings().HasValue() && current_request_info_->audio_capture_settings() .render_to_associated_sink(); - SendLogMessage( + l::SendLogMessage( base::StringPrintf("CreateAudioTracks({render_to_associated_sink=%d})", render_to_associated_sink)); if (!render_to_associated_sink) { @@ -1491,7 +1493,7 @@ void UserMediaProcessor::OnCreateNativeTracksCompleted( MediaStreamRequestResult result, const String& constraint_name) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "UMP::OnCreateNativeTracksCompleted({request_id = %d}, {label=%s})", request_info->request_id(), label.Utf8().c_str())); if (result == MediaStreamRequestResult::OK) { @@ -1524,7 +1526,7 @@ void UserMediaProcessor::GetUserMediaRequestSucceeded( blink::WebUserMediaRequest web_request) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(IsCurrentRequestInfo(web_request)); - SendLogMessage( + l::SendLogMessage( base::StringPrintf("GetUserMediaRequestSucceeded({request_id=%d})", current_request_info_->request_id())); @@ -1544,7 +1546,7 @@ void UserMediaProcessor::DelayedGetUserMediaRequestSucceeded( const blink::WebMediaStream& stream, blink::WebUserMediaRequest web_request) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "DelayedGetUserMediaRequestSucceeded({request_id=%d}, {result=%s})", request_id, MediaStreamRequestResultToString(MediaStreamRequestResult::OK))); @@ -1558,7 +1560,7 @@ void UserMediaProcessor::GetUserMediaRequestFailed( const String& constraint_name) { DCHECK(current_request_info_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - SendLogMessage( + l::SendLogMessage( base::StringPrintf("GetUserMediaRequestFailed({request_id=%d})", current_request_info_->request_id())); @@ -1580,7 +1582,7 @@ void UserMediaProcessor::DelayedGetUserMediaRequestFailed( const String& constraint_name) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); blink::LogUserMediaRequestResult(result); - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "DelayedGetUserMediaRequestFailed({request_id=%d}, {result=%s})", request_id, MediaStreamRequestResultToString(result))); DeleteWebRequest(web_request); @@ -1700,7 +1702,7 @@ blink::WebMediaStreamSource UserMediaProcessor::FindOrInitializeSourceObject( bool UserMediaProcessor::RemoveLocalSource( const blink::WebMediaStreamSource& source) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "RemoveLocalSource({id=%s}, {name=%s}, {group_id=%s})", source.Id().Utf8().c_str(), source.GetName().Utf8().c_str(), source.GroupId().Utf8().c_str())); @@ -1797,7 +1799,7 @@ void UserMediaProcessor::OnLocalSourceStopped( const blink::WebMediaStreamSource& source) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); blink::WebPlatformMediaStreamSource* source_impl = source.GetPlatformSource(); - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "OnLocalSourceStopped({session_id=%s})", source_impl->device().session_id().ToString().c_str())); @@ -1816,7 +1818,7 @@ void UserMediaProcessor::StopLocalSource( const blink::WebMediaStreamSource& source, bool notify_dispatcher) { blink::WebPlatformMediaStreamSource* source_impl = source.GetPlatformSource(); - SendLogMessage(base::StringPrintf( + l::SendLogMessage(base::StringPrintf( "StopLocalSource({session_id=%s})", source_impl->device().session_id().ToString().c_str())); diff --git third_party/blink/renderer/modules/peerconnection/BUILD.gn third_party/blink/renderer/modules/peerconnection/BUILD.gn index 467410d76984..2cdb84e6bdae 100644 --- third_party/blink/renderer/modules/peerconnection/BUILD.gn +++ third_party/blink/renderer/modules/peerconnection/BUILD.gn @@ -5,6 +5,7 @@ import("//third_party/blink/renderer/modules/modules.gni") blink_modules_sources("peerconnection") { + never_build_jumbo = true sources = [ "adapters/dtls_transport_proxy.cc", "adapters/dtls_transport_proxy.h", diff --git third_party/blink/renderer/modules/xr/xr_hit_test_source.cc third_party/blink/renderer/modules/xr/xr_hit_test_source.cc index a7903d985d0b..e3bcef51a01e 100644 --- third_party/blink/renderer/modules/xr/xr_hit_test_source.cc +++ third_party/blink/renderer/modules/xr/xr_hit_test_source.cc @@ -10,10 +10,12 @@ #include "third_party/blink/renderer/platform/bindings/exception_state.h" namespace { +namespace i { const char kCannotCancelHitTestSource[] = "Hit test source could not be canceled! Ensure that it was not already " "canceled."; } +} namespace blink { @@ -27,7 +29,7 @@ uint64_t XRHitTestSource::id() const { void XRHitTestSource::cancel(ExceptionState& exception_state) { if (!xr_session_->RemoveHitTestSource(this)) { exception_state.ThrowDOMException(DOMExceptionCode::kInvalidStateError, - kCannotCancelHitTestSource); + i::kCannotCancelHitTestSource); } } diff --git third_party/blink/renderer/platform/audio/audio_delay_dsp_kernel.cc third_party/blink/renderer/platform/audio/audio_delay_dsp_kernel.cc index 3e2f1a5a3fad..613745b93595 100644 --- third_party/blink/renderer/platform/audio/audio_delay_dsp_kernel.cc +++ third_party/blink/renderer/platform/audio/audio_delay_dsp_kernel.cc @@ -32,7 +32,9 @@ namespace blink { // Delay nodes have a max allowed delay time of this many seconds. +namespace i { const float kMaxDelayTimeSeconds = 30; +} AudioDelayDSPKernel::AudioDelayDSPKernel(AudioDSPKernelProcessor* processor, size_t processing_size_in_frames) @@ -46,7 +48,7 @@ AudioDelayDSPKernel::AudioDelayDSPKernel(double max_delay_time, max_delay_time_(max_delay_time), write_index_(0) { DCHECK_GT(max_delay_time_, 0.0); - DCHECK_LE(max_delay_time_, kMaxDelayTimeSeconds); + DCHECK_LE(max_delay_time_, i::kMaxDelayTimeSeconds); DCHECK(std::isfinite(max_delay_time_)); size_t buffer_length = BufferLengthForDelay(max_delay_time, sample_rate); diff --git third_party/blink/renderer/platform/exported/web_cursor_info.cc third_party/blink/renderer/platform/exported/web_cursor_info.cc index 21c245ecef6e..851861b0e7fd 100644 --- third_party/blink/renderer/platform/exported/web_cursor_info.cc +++ third_party/blink/renderer/platform/exported/web_cursor_info.cc @@ -42,7 +42,7 @@ static SkBitmap GetCursorBitmap(const Cursor& cursor) { WebCursorInfo::WebCursorInfo(const Cursor& cursor) : type(static_cast(cursor.GetType())), - hot_spot(cursor.HotSpot()), + hot_spot(cursor.HotSpot().X(), cursor.HotSpot().Y()), image_scale_factor(cursor.ImageScaleFactor()), custom_image(GetCursorBitmap(cursor)) {} diff --git third_party/blink/renderer/platform/fonts/font_matching_metrics.cc third_party/blink/renderer/platform/fonts/font_matching_metrics.cc index a9a0511de039..0d3db36ad37f 100644 --- third_party/blink/renderer/platform/fonts/font_matching_metrics.cc +++ third_party/blink/renderer/platform/fonts/font_matching_metrics.cc @@ -14,6 +14,7 @@ constexpr double kUkmFontLoadCountBucketSpacing = 1.3; enum FontLoadContext { kTopLevel = 0, kSubFrame }; +namespace i { template HashSet Intersection(const HashSet& a, const HashSet& b) { HashSet result; @@ -23,6 +24,7 @@ HashSet Intersection(const HashSet& a, const HashSet& b) { } return result; } +} // namespace i } // namespace @@ -74,16 +76,16 @@ void FontMatchingMetrics::PublishUkmMetrics() { ukm::builders::FontMatchAttempts(source_id_) .SetLoadContext(top_level_ ? kTopLevel : kSubFrame) .SetSystemFontFamilySuccesses(ukm::GetExponentialBucketMin( - Intersection(successful_font_families_, system_font_families_).size(), + i::Intersection(successful_font_families_, system_font_families_).size(), kUkmFontLoadCountBucketSpacing)) .SetSystemFontFamilyFailures(ukm::GetExponentialBucketMin( - Intersection(failed_font_families_, system_font_families_).size(), + i::Intersection(failed_font_families_, system_font_families_).size(), kUkmFontLoadCountBucketSpacing)) .SetWebFontFamilySuccesses(ukm::GetExponentialBucketMin( - Intersection(successful_font_families_, web_font_families_).size(), + i::Intersection(successful_font_families_, web_font_families_).size(), kUkmFontLoadCountBucketSpacing)) .SetWebFontFamilyFailures(ukm::GetExponentialBucketMin( - Intersection(failed_font_families_, web_font_families_).size(), + i::Intersection(failed_font_families_, web_font_families_).size(), kUkmFontLoadCountBucketSpacing)) .SetLocalFontFailures(ukm::GetExponentialBucketMin( local_fonts_failed_.size(), kUkmFontLoadCountBucketSpacing)) diff --git third_party/blink/renderer/platform/mediastream/media_stream_audio_source.cc third_party/blink/renderer/platform/mediastream/media_stream_audio_source.cc index 4c60ce0cff03..a3ebe396867f 100644 --- third_party/blink/renderer/platform/mediastream/media_stream_audio_source.cc +++ third_party/blink/renderer/platform/mediastream/media_stream_audio_source.cc @@ -21,9 +21,11 @@ namespace blink { namespace { +namespace m { void SendLogMessage(const std::string& message) { blink::WebRtcLogMessage("MSAS::" + message); } +} // namespace m } // namespace @@ -55,7 +57,7 @@ MediaStreamAudioSource::MediaStreamAudioSource( disable_local_echo_(disable_local_echo), is_stopped_(false), task_runner_(std::move(task_runner)) { - SendLogMessage(base::StringPrintf( + m::SendLogMessage(base::StringPrintf( "MediaStreamAudioSource([this=%p] {is_local_source=%s})", this, (is_local_source ? "local" : "remote"))); } @@ -69,7 +71,7 @@ MediaStreamAudioSource::MediaStreamAudioSource( MediaStreamAudioSource::~MediaStreamAudioSource() { DCHECK(task_runner_->BelongsToCurrentThread()); - SendLogMessage( + m::SendLogMessage( base::StringPrintf("~MediaStreamAudioSource([this=%p])", this)); } @@ -86,7 +88,7 @@ bool MediaStreamAudioSource::ConnectToTrack( const WebMediaStreamTrack& blink_track) { DCHECK(task_runner_->BelongsToCurrentThread()); DCHECK(!blink_track.IsNull()); - SendLogMessage(base::StringPrintf("ConnectToTrack({track_id=%s})", + m::SendLogMessage(base::StringPrintf("ConnectToTrack({track_id=%s})", blink_track.Id().Utf8().c_str())); // Sanity-check that there is not already a MediaStreamAudioTrack instance @@ -181,7 +183,7 @@ void MediaStreamAudioSource::DoChangeSource( std::unique_ptr MediaStreamAudioSource::CreateMediaStreamAudioTrack(const std::string& id) { DCHECK(task_runner_->BelongsToCurrentThread()); - SendLogMessage( + m::SendLogMessage( base::StringPrintf("CreateMediaStreamAudioTrack({id=%s})", id.c_str())); return std::unique_ptr( new MediaStreamAudioTrack(is_local_source())); @@ -206,7 +208,7 @@ void MediaStreamAudioSource::ChangeSourceImpl( } void MediaStreamAudioSource::SetFormat(const media::AudioParameters& params) { - SendLogMessage(base::StringPrintf( + m::SendLogMessage(base::StringPrintf( "SetFormat([this=%p] {params=[%s]}, {old_params=[%s]})", this, params.AsHumanReadableString().c_str(), deliverer_.GetAudioParameters().AsHumanReadableString().c_str())); @@ -227,7 +229,7 @@ void MediaStreamAudioSource::DoStopSource() { void MediaStreamAudioSource::StopAudioDeliveryTo(MediaStreamAudioTrack* track) { DCHECK(task_runner_->BelongsToCurrentThread()); - SendLogMessage(base::StringPrintf("StopAudioDeliveryTo([this=%p])", this)); + m::SendLogMessage(base::StringPrintf("StopAudioDeliveryTo([this=%p])", this)); const bool did_remove_last_track = deliverer_.RemoveConsumer(track); DVLOG(1) << "Removed MediaStreamAudioTrack@" << track @@ -240,7 +242,7 @@ void MediaStreamAudioSource::StopAudioDeliveryTo(MediaStreamAudioTrack* track) { } void MediaStreamAudioSource::StopSourceOnError(const std::string& why) { - SendLogMessage(base::StringPrintf("StopSourceOnError([this=%p] {why=%s})", + m::SendLogMessage(base::StringPrintf("StopSourceOnError([this=%p] {why=%s})", this, why.c_str())); // Stop source when error occurs. PostCrossThreadTask( @@ -250,7 +252,7 @@ void MediaStreamAudioSource::StopSourceOnError(const std::string& why) { } void MediaStreamAudioSource::SetMutedState(bool muted_state) { - SendLogMessage(base::StringPrintf("SetMutedState([this=%p] {muted_state=%s})", + m::SendLogMessage(base::StringPrintf("SetMutedState([this=%p] {muted_state=%s})", this, (muted_state ? "true" : "false"))); PostCrossThreadTask( *task_runner_, FROM_HERE, diff --git third_party/blink/renderer/platform/mediastream/media_stream_audio_track.cc third_party/blink/renderer/platform/mediastream/media_stream_audio_track.cc index 2c73fb0c88bd..5d5a852b0699 100644 --- third_party/blink/renderer/platform/mediastream/media_stream_audio_track.cc +++ third_party/blink/renderer/platform/mediastream/media_stream_audio_track.cc @@ -18,22 +18,24 @@ namespace blink { namespace { +namespace i { void SendLogMessage(const std::string& message) { blink::WebRtcLogMessage("MSAT::" + message); } +} } // namespace MediaStreamAudioTrack::MediaStreamAudioTrack(bool is_local_track) : WebPlatformMediaStreamTrack(is_local_track), is_enabled_(1) { - SendLogMessage( + i::SendLogMessage( base::StringPrintf("MediaStreamAudioTrack([this=%p] {is_local_track=%s})", this, (is_local_track ? "local" : "remote"))); } MediaStreamAudioTrack::~MediaStreamAudioTrack() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - SendLogMessage(base::StringPrintf("~MediaStreamAudioTrack([this=%p])", this)); + i::SendLogMessage(base::StringPrintf("~MediaStreamAudioTrack([this=%p])", this)); Stop(); } @@ -49,7 +51,7 @@ MediaStreamAudioTrack* MediaStreamAudioTrack::From( void MediaStreamAudioTrack::AddSink(WebMediaStreamAudioSink* sink) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - SendLogMessage(base::StringPrintf("AddSink([this=%p])", this)); + i::SendLogMessage(base::StringPrintf("AddSink([this=%p])", this)); // If the track has already stopped, just notify the sink of this fact without // adding it. @@ -64,7 +66,7 @@ void MediaStreamAudioTrack::AddSink(WebMediaStreamAudioSink* sink) { void MediaStreamAudioTrack::RemoveSink(WebMediaStreamAudioSink* sink) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - SendLogMessage(base::StringPrintf("RemoveSink([this=%p])", this)); + i::SendLogMessage(base::StringPrintf("RemoveSink([this=%p])", this)); deliverer_.RemoveConsumer(sink); } @@ -74,7 +76,7 @@ media::AudioParameters MediaStreamAudioTrack::GetOutputFormat() const { void MediaStreamAudioTrack::SetEnabled(bool enabled) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - SendLogMessage(base::StringPrintf("SetEnabled([this=%p] {enabled=%s})", this, + i::SendLogMessage(base::StringPrintf("SetEnabled([this=%p] {enabled=%s})", this, (enabled ? "true" : "false"))); const bool previously_enabled = @@ -106,13 +108,13 @@ void MediaStreamAudioTrack::Start(base::OnceClosure stop_callback) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(!stop_callback.is_null()); DCHECK(stop_callback_.is_null()); - SendLogMessage(base::StringPrintf("Start([this=%p])", this)); + i::SendLogMessage(base::StringPrintf("Start([this=%p])", this)); stop_callback_ = std::move(stop_callback); } void MediaStreamAudioTrack::StopAndNotify(base::OnceClosure callback) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - SendLogMessage(base::StringPrintf("StopAndNotify([this=%p])", this)); + i::SendLogMessage(base::StringPrintf("StopAndNotify([this=%p])", this)); if (!stop_callback_.is_null()) std::move(stop_callback_).Run(); @@ -130,7 +132,7 @@ void MediaStreamAudioTrack::StopAndNotify(base::OnceClosure callback) { } void MediaStreamAudioTrack::OnSetFormat(const media::AudioParameters& params) { - SendLogMessage(base::StringPrintf("OnSetFormat([this=%p] {params: [%s]})", + i::SendLogMessage(base::StringPrintf("OnSetFormat([this=%p] {params: [%s]})", this, params.AsHumanReadableString().c_str())); deliverer_.OnSetFormat(params); @@ -141,7 +143,7 @@ void MediaStreamAudioTrack::OnData(const media::AudioBus& audio_bus, if (!received_audio_callback_) { // Add log message with unique this pointer id to mark the audio track as // alive at the first data callback. - SendLogMessage(base::StringPrintf( + i::SendLogMessage(base::StringPrintf( "OnData([this=%p] => (audio track is alive))", this)); received_audio_callback_ = true; } diff --git third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.cc third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.cc index cb12d36124c2..341845474fc3 100644 --- third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.cc +++ third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.cc @@ -25,7 +25,9 @@ namespace { const int kDefaultFps = 30; // Any reasonable size, will be overridden by the decoder anyway. +namespace i { const gfx::Size kDefaultSize(640, 480); +} struct CodecConfig { media::VideoCodec codec; @@ -182,8 +184,8 @@ RTCVideoDecoderFactory::GetSupportedFormats() const { media::VideoDecoderConfig config( codec_config.codec, codec_config.profile, media::VideoDecoderConfig::AlphaMode::kIsOpaque, - media::VideoColorSpace(), media::kNoTransformation, kDefaultSize, - gfx::Rect(kDefaultSize), kDefaultSize, media::EmptyExtraData(), + media::VideoColorSpace(), media::kNoTransformation, i::kDefaultSize, + gfx::Rect(i::kDefaultSize), i::kDefaultSize, media::EmptyExtraData(), media::EncryptionScheme::kUnencrypted); if (gpu_factories_->IsDecoderConfigSupported( RTCVideoDecoderAdapter::kImplementation, config) == diff --git third_party/blink/renderer/platform/peerconnection/webrtc_audio_sink.cc third_party/blink/renderer/platform/peerconnection/webrtc_audio_sink.cc index 7d747bc50090..59a6c42e3281 100644 --- third_party/blink/renderer/platform/peerconnection/webrtc_audio_sink.cc +++ third_party/blink/renderer/platform/peerconnection/webrtc_audio_sink.cc @@ -19,9 +19,11 @@ namespace { +namespace j { void SendLogMessage(const std::string& message) { blink::WebRtcLogMessage("WRAS::" + message); } +} } // namespace @@ -58,13 +60,13 @@ WebRtcAudioSink::WebRtcAudioSink( fifo_(ConvertToBaseRepeatingCallback( CrossThreadBindRepeating(&WebRtcAudioSink::DeliverRebufferedAudio, CrossThreadUnretained(this)))) { - SendLogMessage(base::StringPrintf("WebRtcAudioSink({label=%s})", + j::SendLogMessage(base::StringPrintf("WebRtcAudioSink({label=%s})", adapter_->label().c_str())); } WebRtcAudioSink::~WebRtcAudioSink() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - SendLogMessage(base::StringPrintf("~WebRtcAudioSink([label=%s])", + j::SendLogMessage(base::StringPrintf("~WebRtcAudioSink([label=%s])", adapter_->label().c_str())); } @@ -84,7 +86,7 @@ void WebRtcAudioSink::SetLevel( void WebRtcAudioSink::OnEnabledChanged(bool enabled) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - SendLogMessage(base::StringPrintf("OnEnabledChanged([label=%s] {enabled=%s})", + j::SendLogMessage(base::StringPrintf("OnEnabledChanged([label=%s] {enabled=%s})", adapter_->label().c_str(), (enabled ? "true" : "false"))); PostCrossThreadTask( @@ -105,7 +107,7 @@ void WebRtcAudioSink::OnData(const media::AudioBus& audio_bus, void WebRtcAudioSink::OnSetFormat(const media::AudioParameters& params) { DCHECK(params.IsValid()); - SendLogMessage(base::StringPrintf("OnSetFormat([label=%s] {params=[%s]})", + j::SendLogMessage(base::StringPrintf("OnSetFormat([label=%s] {params=[%s]})", adapter_->label().c_str(), params.AsHumanReadableString().c_str())); params_ = params; @@ -153,12 +155,12 @@ WebRtcAudioSink::Adapter::Adapter( main_task_runner_(std::move(main_task_runner)) { DCHECK(signaling_task_runner_); DCHECK(main_task_runner_); - SendLogMessage( + j::SendLogMessage( base::StringPrintf("Adapter::Adapter({label=%s})", label_.c_str())); } WebRtcAudioSink::Adapter::~Adapter() { - SendLogMessage( + j::SendLogMessage( base::StringPrintf("Adapter::~Adapter([label=%s])", label_.c_str())); if (audio_processor_) { PostCrossThreadTask(*main_task_runner_.get(), FROM_HERE, @@ -186,7 +188,7 @@ std::string WebRtcAudioSink::Adapter::kind() const { bool WebRtcAudioSink::Adapter::set_enabled(bool enable) { DCHECK(!signaling_task_runner_ || signaling_task_runner_->RunsTasksInCurrentSequence()); - SendLogMessage( + j::SendLogMessage( base::StringPrintf("Adapter::set_enabled([label=%s] {enable=%s})", label_.c_str(), (enable ? "true" : "false"))); return webrtc::MediaStreamTrack::set_enabled( @@ -197,7 +199,7 @@ void WebRtcAudioSink::Adapter::AddSink(webrtc::AudioTrackSinkInterface* sink) { DCHECK(!signaling_task_runner_ || signaling_task_runner_->RunsTasksInCurrentSequence()); DCHECK(sink); - SendLogMessage( + j::SendLogMessage( base::StringPrintf("Adapter::AddSink({label=%s})", label_.c_str())); base::AutoLock auto_lock(lock_); DCHECK(!base::Contains(sinks_, sink)); @@ -208,7 +210,7 @@ void WebRtcAudioSink::Adapter::RemoveSink( webrtc::AudioTrackSinkInterface* sink) { DCHECK(!signaling_task_runner_ || signaling_task_runner_->RunsTasksInCurrentSequence()); - SendLogMessage( + j::SendLogMessage( base::StringPrintf("Adapter::RemoveSink([label=%s])", label_.c_str())); base::AutoLock auto_lock(lock_); const auto it = std::find(sinks_.begin(), sinks_.end(), sink); @@ -230,7 +232,7 @@ bool WebRtcAudioSink::Adapter::GetSignalLevel(int* level) { // Convert from float in range [0.0,1.0] to an int in range [0,32767]. *level = static_cast(signal_level * std::numeric_limits::max() + 0.5f /* rounding to nearest int */); - SendLogMessage( + j::SendLogMessage( base::StringPrintf("Adapter::GetSignalLevel([label=%s]) => (level=%d)", label_.c_str(), *level)); return true; diff --git ui/base/x/x11_drag_context.cc ui/base/x/x11_drag_context.cc index 3ed9e98b2a20..8ada19c7afd9 100644 --- ui/base/x/x11_drag_context.cc +++ ui/base/x/x11_drag_context.cc @@ -13,6 +13,7 @@ namespace ui { namespace { +namespace i { // Window property that holds the supported drag and drop data types. // This property is set on the XDND source window when the drag and drop data @@ -34,6 +35,7 @@ const char kXdndActionLink[] = "XdndActionLink"; // Window property that will receive the drag and drop selection data. const char kChromiumDragReciever[] = "_CHROMIUM_DRAG_RECEIVER"; +} // namespace i } // namespace XDragContext::XDragContext(XID local_window, @@ -47,7 +49,7 @@ XDragContext::XDragContext(XID local_window, bool get_types_from_property = ((event.data.l[1] & 1) != 0); if (get_types_from_property) { - if (!GetAtomArrayProperty(source_window_, kXdndTypeList, + if (!GetAtomArrayProperty(source_window_, i::kXdndTypeList, &unfetched_targets_)) { return; } @@ -111,8 +113,8 @@ void XDragContext::RequestNextTarget() { Atom target = unfetched_targets_.back(); unfetched_targets_.pop_back(); - XConvertSelection(gfx::GetXDisplay(), gfx::GetAtom(kXdndSelection), target, - gfx::GetAtom(kChromiumDragReciever), local_window_, + XConvertSelection(gfx::GetXDisplay(), gfx::GetAtom(i::kXdndSelection), target, + gfx::GetAtom(i::kChromiumDragReciever), local_window_, position_time_stamp_); } @@ -127,7 +129,7 @@ void XDragContext::OnSelectionNotify(const XSelectionEvent& event) { DVLOG(1) << "SelectionNotify, format " << event.target; if (event.property != x11::None) { - DCHECK_EQ(event.property, gfx::GetAtom(kChromiumDragReciever)); + DCHECK_EQ(event.property, gfx::GetAtom(i::kChromiumDragReciever)); scoped_refptr data; Atom type = x11::None; @@ -155,7 +157,7 @@ void XDragContext::OnSelectionNotify(const XSelectionEvent& event) { void XDragContext::ReadActions() { if (!source_client_) { std::vector atom_array; - if (!GetAtomArrayProperty(source_window_, kXdndActionList, &atom_array)) + if (!GetAtomArrayProperty(source_window_, i::kXdndActionList, &atom_array)) actions_.clear(); else actions_.swap(atom_array); @@ -179,17 +181,17 @@ int XDragContext::GetDragOperation() const { void XDragContext::MaskOperation(Atom xdnd_operation, int* drag_operation) const { - if (xdnd_operation == gfx::GetAtom(kXdndActionCopy)) + if (xdnd_operation == gfx::GetAtom(i::kXdndActionCopy)) *drag_operation |= DragDropTypes::DRAG_COPY; - else if (xdnd_operation == gfx::GetAtom(kXdndActionMove)) + else if (xdnd_operation == gfx::GetAtom(i::kXdndActionMove)) *drag_operation |= DragDropTypes::DRAG_MOVE; - else if (xdnd_operation == gfx::GetAtom(kXdndActionLink)) + else if (xdnd_operation == gfx::GetAtom(i::kXdndActionLink)) *drag_operation |= DragDropTypes::DRAG_LINK; } bool XDragContext::DispatchXEvent(XEvent* xev) { if (xev->type == PropertyNotify && - xev->xproperty.atom == gfx::GetAtom(kXdndActionList)) { + xev->xproperty.atom == gfx::GetAtom(i::kXdndActionList)) { ReadActions(); return true; }