diff --git a/BUILD.gn b/BUILD.gn index 47e8e92..90f92c53 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -1151,6 +1151,14 @@ "//tools/imagediff", ] } + script_test("wpt_tests_isolate_content_shell") { + script = "//testing/scripts/run_wpt_tests.py" + args = [ "--product=content_shell" ] + data_deps = [ + ":blink_web_tests_support_data", + "//third_party/blink/tools:wpt_tests_isolate", + ] + } } group("blink_web_tests_support_data") {
diff --git a/DEPS b/DEPS index bdc502da..f4ff68c 100644 --- a/DEPS +++ b/DEPS
@@ -300,7 +300,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': 'dee2a6ebfcdfff981b8b0a520c23220ab5673089', + 'skia_revision': '680fe13614935414316e65cacc54e6c05ea2be2d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -308,7 +308,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': '15b1678f2ed1dbd37c1684403ff0fcb479dde0ec', + 'angle_revision': 'f6842cc2cd94a7268f46add4c688a99ed98acc5a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -323,7 +323,7 @@ # # Note this revision should be updated with # third_party/boringssl/roll_boringssl.py, not roll-dep. - 'boringssl_revision': 'adaa322b63d1bfbd1abcf4a308926a9a83a6acbe', + 'boringssl_revision': 'ebd8b8965c74ab06bb91f7a00b23822e1f1f26ca', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Fuchsia sdk # and whatever else without interference from each other. @@ -379,7 +379,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': '4969d42cdf99eb6094d0691110197b41d5c0f6c8', + 'devtools_frontend_revision': '7b37e23c2e7245f4bf3aef7e93f20d7df5ecf561', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -483,7 +483,7 @@ # If you change this, also update the libc++ revision in # //buildtools/deps_revisions.gni. - 'libcxx_revision': '60c266d87cfd8cd7c9a541ea7095ee44a235a3ec', + 'libcxx_revision': 'aa3a6cd0f158bdc037268cbe06e2bfd8067fa951', # GN CIPD package version. 'gn_version': 'git_revision:0bcd37bd2b83f1a9ee17088037ebdfe6eab6d31a', @@ -1341,7 +1341,7 @@ Var('chromium_git') + '/chromium/deps/hunspell_dictionaries.git' + '@' + '41cdffd71c9948f63c7ad36e1fb0ff519aa7a37e', 'src/third_party/icu': - Var('chromium_git') + '/chromium/deps/icu.git' + '@' + '31c77cbfff890d173237f51b3c5930416b3d5b24', + Var('chromium_git') + '/chromium/deps/icu.git' + '@' + 'bbdc7d8936bd9b896ff9c9822b697554b73c1c9d', 'src/third_party/icu4j': { 'packages': [ @@ -1616,7 +1616,7 @@ 'packages': [ { 'package': 'chromium/third_party/r8', - 'version': '67dSHl38KOWsT791ovMUFl0ETdJP2RHkRpgr5STYS7sC', + 'version': '_rv7EargK1mPOQPb7922ENB7-AaUTJZCxBWNBeLVsfQC', }, ], 'condition': 'checkout_android', @@ -1707,7 +1707,7 @@ 'dep_type': 'cipd', }, - 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@e623f608cbf37ee753b3abb9d55b9540506edde6', + 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@6dd4b0a4630bb70cbcaf1f116074dc671f2ab4d8', 'src/third_party/vulkan_memory_allocator': Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git' + '@' + 'ebe84bec02c041d28f902da0214bf442743fc907', @@ -1743,10 +1743,10 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '44e4c8770158c505b03ee7feafa4859d083b0912', 'src/third_party/webgpu-cts/src': - Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '7ecbc03b24dc0975fd6e49fc385bae6957e89c5b', + Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'de9176b5621f98e7b86ce1288e716eec9a882f8e', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'b61f39e00e22e80029de32710dd21f5fef6012e7', + Var('webrtc_git') + '/src.git' + '@' + '252fdcec6be88427bf6698e2d76bb48223992ba1', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1819,7 +1819,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@42e3d00504323f2a52adfaf3df1e1c093b399171', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@39eaabb99d4294e31947ebe6dfb5473ea827e25d', 'condition': 'checkout_src_internal', },
diff --git a/WATCHLISTS b/WATCHLISTS index 59d1583..1c59aa0 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -3002,7 +3002,8 @@ 'kainino+watch@chromium.org'], 'webid': ['yigu+watch@chromium.org', 'cbiesinger@chromium.org', - 'icer@chromium.org'], + 'icer@chromium.org', + 'npm+watch@chromium.org'], 'weblayer': ['cricke+watch@chromium.org'], 'weblayer_safe_browsing' : ['carlosil+watch@chromium.org'], 'weblayer_ssl' : ['carlosil+watch@chromium.org'],
diff --git a/android_webview/browser/aw_feature_list_creator.cc b/android_webview/browser/aw_feature_list_creator.cc index a7ab41d..73fcb0f0 100644 --- a/android_webview/browser/aw_feature_list_creator.cc +++ b/android_webview/browser/aw_feature_list_creator.cc
@@ -254,6 +254,8 @@ // back to the provider we previously gave to FieldTrialList, which is a low // entropy provider. The X-Client-Data header is not reported on WebView, so // we pass an empty object as the |low_entropy_source_value|. + // If you update this, consider whether "WebViewEnvironment" in + // components/variations/variations_seed_processor_unittest.cc needs updates. variations_field_trial_creator_->SetUpFieldTrials( variation_ids, command_line->GetSwitchValueASCII(
diff --git a/android_webview/browser/aw_web_contents_delegate.cc b/android_webview/browser/aw_web_contents_delegate.cc index 23d2d07a..0c003a54 100644 --- a/android_webview/browser/aw_web_contents_delegate.cc +++ b/android_webview/browser/aw_web_contents_delegate.cc
@@ -147,7 +147,7 @@ std::unique_ptr<WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) { JNIEnv* env = AttachCurrentThread();
diff --git a/android_webview/browser/aw_web_contents_delegate.h b/android_webview/browser/aw_web_contents_delegate.h index e565c40..736259d 100644 --- a/android_webview/browser/aw_web_contents_delegate.h +++ b/android_webview/browser/aw_web_contents_delegate.h
@@ -44,7 +44,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override;
diff --git a/android_webview/browser/gfx/BUILD.gn b/android_webview/browser/gfx/BUILD.gn index 7062171..e2365e9e 100644 --- a/android_webview/browser/gfx/BUILD.gn +++ b/android_webview/browser/gfx/BUILD.gn
@@ -28,8 +28,6 @@ "child_frame.h", "compositor_frame_consumer.h", "compositor_frame_producer.h", - "deferred_gpu_command_service.cc", - "deferred_gpu_command_service.h", "display_scheduler_webview.cc", "display_scheduler_webview.h", "display_webview.cc",
diff --git a/android_webview/browser/gfx/deferred_gpu_command_service.cc b/android_webview/browser/gfx/deferred_gpu_command_service.cc deleted file mode 100644 index 22fb354..0000000 --- a/android_webview/browser/gfx/deferred_gpu_command_service.cc +++ /dev/null
@@ -1,82 +0,0 @@ -// Copyright 2014 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 "android_webview/browser/gfx/deferred_gpu_command_service.h" - -#include "android_webview/browser/gfx/gpu_service_webview.h" -#include "android_webview/browser/gfx/task_forwarding_sequence.h" -#include "android_webview/browser/gfx/task_queue_webview.h" -#include "ui/gl/gl_share_group.h" - -namespace android_webview { - -// static -DeferredGpuCommandService* -DeferredGpuCommandService::CreateDeferredGpuCommandService() { - return new DeferredGpuCommandService(TaskQueueWebView::GetInstance(), - GpuServiceWebView::GetInstance()); -} - -// static -DeferredGpuCommandService* DeferredGpuCommandService::GetInstance() { - static DeferredGpuCommandService* service = CreateDeferredGpuCommandService(); - return service; -} - -DeferredGpuCommandService::DeferredGpuCommandService( - TaskQueueWebView* task_queue, - GpuServiceWebView* gpu_service) - : gpu::CommandBufferTaskExecutor(gpu_service->gpu_preferences(), - gpu_service->gpu_feature_info(), - gpu_service->sync_point_manager(), - gpu_service->mailbox_manager(), - gl::GLSurfaceFormat(), - gpu_service->shared_image_manager(), - nullptr), - task_queue_(task_queue), - gpu_service_(gpu_service) {} - -DeferredGpuCommandService::~DeferredGpuCommandService() {} - -// Called from different threads! -std::unique_ptr<gpu::SingleTaskSequence> -DeferredGpuCommandService::CreateSequence() { - return std::make_unique<TaskForwardingSequence>( - this->task_queue_, this->gpu_service_->sync_point_manager()); -} - -void DeferredGpuCommandService::ScheduleOutOfOrderTask(base::OnceClosure task) { - task_queue_->ScheduleTask(std::move(task), true /* out_of_order */); -} - -void DeferredGpuCommandService::ScheduleDelayedWork( - base::OnceClosure callback) { - task_queue_->ScheduleIdleTask(std::move(callback)); -} - -void DeferredGpuCommandService::PostNonNestableToClient( - base::OnceClosure callback) { - task_queue_->ScheduleClientTask(std::move(callback)); -} - -bool DeferredGpuCommandService::ForceVirtualizedGLContexts() const { - return true; -} - -bool DeferredGpuCommandService::ShouldCreateMemoryTracker() const { - return false; -} - -scoped_refptr<gpu::SharedContextState> -DeferredGpuCommandService::GetSharedContextState() { - return nullptr; -} - -scoped_refptr<gl::GLShareGroup> DeferredGpuCommandService::GetShareGroup() { - if (!share_group_) - share_group_ = base::MakeRefCounted<gl::GLShareGroup>(); - return share_group_; -} - -} // namespace android_webview
diff --git a/android_webview/browser/gfx/deferred_gpu_command_service.h b/android_webview/browser/gfx/deferred_gpu_command_service.h deleted file mode 100644 index 13823b4..0000000 --- a/android_webview/browser/gfx/deferred_gpu_command_service.h +++ /dev/null
@@ -1,57 +0,0 @@ -// Copyright 2014 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. - -#ifndef ANDROID_WEBVIEW_BROWSER_GFX_DEFERRED_GPU_COMMAND_SERVICE_H_ -#define ANDROID_WEBVIEW_BROWSER_GFX_DEFERRED_GPU_COMMAND_SERVICE_H_ - -#include "base/memory/raw_ptr.h" -#include "gpu/command_buffer/service/command_buffer_task_executor.h" - -namespace gl { -class GLShareGroup; -} - -namespace android_webview { - -class GpuServiceWebView; -class TaskQueueWebView; - -// Implementation for gpu service objects accessor for command buffer WebView. -class DeferredGpuCommandService : public gpu::CommandBufferTaskExecutor { - public: - static DeferredGpuCommandService* GetInstance(); - - DeferredGpuCommandService(const DeferredGpuCommandService&) = delete; - DeferredGpuCommandService& operator=(const DeferredGpuCommandService&) = - delete; - - // gpu::CommandBufferTaskExecutor implementation. - bool ForceVirtualizedGLContexts() const override; - bool ShouldCreateMemoryTracker() const override; - std::unique_ptr<gpu::SingleTaskSequence> CreateSequence() override; - void ScheduleOutOfOrderTask(base::OnceClosure task) override; - void ScheduleDelayedWork(base::OnceClosure task) override; - void PostNonNestableToClient(base::OnceClosure callback) override; - scoped_refptr<gpu::SharedContextState> GetSharedContextState() override; - scoped_refptr<gl::GLShareGroup> GetShareGroup() override; - - protected: - ~DeferredGpuCommandService() override; - - private: - friend class TaskForwardingSequence; - - DeferredGpuCommandService(TaskQueueWebView* task_queue, - GpuServiceWebView* gpu_service); - - static DeferredGpuCommandService* CreateDeferredGpuCommandService(); - - raw_ptr<TaskQueueWebView> task_queue_; - raw_ptr<GpuServiceWebView> gpu_service_; - scoped_refptr<gl::GLShareGroup> share_group_; -}; - -} // namespace android_webview - -#endif // ANDROID_WEBVIEW_BROWSER_GFX_DEFERRED_GPU_COMMAND_SERVICE_H_
diff --git a/android_webview/browser/gfx/gpu_service_webview.cc b/android_webview/browser/gfx/gpu_service_webview.cc index f99abf2..be885fb 100644 --- a/android_webview/browser/gfx/gpu_service_webview.cc +++ b/android_webview/browser/gfx/gpu_service_webview.cc
@@ -9,6 +9,7 @@ #include "content/public/browser/gpu_data_manager.h" #include "content/public/browser/gpu_utils.h" #include "gpu/command_buffer/service/mailbox_manager_factory.h" +#include "gpu/command_buffer/service/scheduler.h" #include "gpu/command_buffer/service/shared_image/shared_image_manager.h" #include "gpu/command_buffer/service/sync_point_manager.h" #include "gpu/config/gpu_util.h" @@ -40,10 +41,12 @@ // main thread, so it should be thread safe. auto shared_image_manager = std::make_unique<gpu::SharedImageManager>( true /* is_thread_safe */, true /* display_context_on_another_thread */); - return new GpuServiceWebView(std::move(sync_point_manager), - std::move(mailbox_manager), - std::move(shared_image_manager), gpu_info, - gpu_preferences, gpu_feature_info); + auto scheduler = std::make_unique<gpu::Scheduler>(sync_point_manager.get(), + gpu_preferences); + return new GpuServiceWebView( + std::move(sync_point_manager), std::move(mailbox_manager), + std::move(shared_image_manager), std::move(scheduler), gpu_info, + gpu_preferences, gpu_feature_info); } GpuServiceWebView::~GpuServiceWebView() = default; @@ -52,12 +55,14 @@ std::unique_ptr<gpu::SyncPointManager> sync_point_manager, std::unique_ptr<gpu::MailboxManager> mailbox_manager, std::unique_ptr<gpu::SharedImageManager> shared_image_manager, + std::unique_ptr<gpu::Scheduler> scheduler, const gpu::GPUInfo& gpu_info, const gpu::GpuPreferences& gpu_preferences, const gpu::GpuFeatureInfo& gpu_feature_info) : sync_point_manager_(std::move(sync_point_manager)), mailbox_manager_(std::move(mailbox_manager)), shared_image_manager_(std::move(shared_image_manager)), + scheduler_(std::move(scheduler)), gpu_info_(gpu_info), gpu_preferences_(gpu_preferences), gpu_feature_info_(gpu_feature_info) {}
diff --git a/android_webview/browser/gfx/gpu_service_webview.h b/android_webview/browser/gfx/gpu_service_webview.h index e5eb52fc..974eacc 100644 --- a/android_webview/browser/gfx/gpu_service_webview.h +++ b/android_webview/browser/gfx/gpu_service_webview.h
@@ -16,8 +16,9 @@ namespace gpu { class MailboxManager; -class SyncPointManager; +class Scheduler; class SharedImageManager; +class SyncPointManager; } // namespace gpu namespace android_webview { @@ -47,6 +48,8 @@ return shared_image_manager_.get(); } + gpu::Scheduler* scheduler() const { return scheduler_.get(); } + const gpu::GPUInfo& gpu_info() const { return gpu_info_; } const gpu::GpuPreferences& gpu_preferences() const { @@ -65,6 +68,7 @@ std::unique_ptr<gpu::SyncPointManager> sync_pointer_manager, std::unique_ptr<gpu::MailboxManager> mailbox_manager, std::unique_ptr<gpu::SharedImageManager> shared_image_manager, + std::unique_ptr<gpu::Scheduler> scheduler, const gpu::GPUInfo& gpu_info, const gpu::GpuPreferences& gpu_preferences, const gpu::GpuFeatureInfo& gpu_feature_info); @@ -72,6 +76,7 @@ std::unique_ptr<gpu::SyncPointManager> sync_point_manager_; std::unique_ptr<gpu::MailboxManager> mailbox_manager_; std::unique_ptr<gpu::SharedImageManager> shared_image_manager_; + std::unique_ptr<gpu::Scheduler> scheduler_; gpu::GPUInfo gpu_info_; gpu::GpuPreferences gpu_preferences_;
diff --git a/android_webview/browser/gfx/output_surface_provider_webview.cc b/android_webview/browser/gfx/output_surface_provider_webview.cc index 52c859cc..78393c6b1 100644 --- a/android_webview/browser/gfx/output_surface_provider_webview.cc +++ b/android_webview/browser/gfx/output_surface_provider_webview.cc
@@ -8,7 +8,6 @@ #include "android_webview/browser/gfx/aw_gl_surface_external_stencil.h" #include "android_webview/browser/gfx/aw_vulkan_context_provider.h" -#include "android_webview/browser/gfx/deferred_gpu_command_service.h" #include "android_webview/browser/gfx/gpu_service_webview.h" #include "android_webview/browser/gfx/skia_output_surface_dependency_webview.h" #include "android_webview/browser/gfx/task_queue_webview.h" @@ -20,6 +19,7 @@ #include "base/no_destructor.h" #include "components/viz/common/features.h" #include "components/viz/service/display_embedder/skia_output_surface_impl.h" +#include "gpu/command_buffer/service/feature_info.h" #include "gpu/command_buffer/service/single_task_sequence.h" #include "gpu/config/gpu_finch_features.h" #include "gpu/config/gpu_switches.h"
diff --git a/android_webview/browser/gfx/skia_output_surface_dependency_webview.cc b/android_webview/browser/gfx/skia_output_surface_dependency_webview.cc index 9f20c046..5b8609c8 100644 --- a/android_webview/browser/gfx/skia_output_surface_dependency_webview.cc +++ b/android_webview/browser/gfx/skia_output_surface_dependency_webview.cc
@@ -39,7 +39,8 @@ std::unique_ptr<gpu::SingleTaskSequence> SkiaOutputSurfaceDependencyWebView::CreateSequence() { return std::make_unique<TaskForwardingSequence>( - this->task_queue_, this->gpu_service_->sync_point_manager()); + task_queue_, gpu_service_->sync_point_manager(), + gpu_service_->scheduler()); } gpu::SharedImageManager*
diff --git a/android_webview/browser/gfx/task_forwarding_sequence.cc b/android_webview/browser/gfx/task_forwarding_sequence.cc index d31754b9..c2b0c03 100644 --- a/android_webview/browser/gfx/task_forwarding_sequence.cc +++ b/android_webview/browser/gfx/task_forwarding_sequence.cc
@@ -8,16 +8,19 @@ #include "base/bind.h" #include "base/synchronization/waitable_event.h" #include "base/trace_event/trace_event.h" +#include "gpu/command_buffer/service/scheduler.h" #include "gpu/command_buffer/service/sync_point_manager.h" namespace android_webview { TaskForwardingSequence::TaskForwardingSequence( TaskQueueWebView* task_queue, - gpu::SyncPointManager* sync_point_manager) + gpu::SyncPointManager* sync_point_manager, + gpu::Scheduler* scheduler) : gpu::SingleTaskSequence(), task_queue_(task_queue), sync_point_manager_(sync_point_manager), + scheduler_(scheduler), sync_point_order_data_(sync_point_manager_->CreateSyncPointOrderData()) {} TaskForwardingSequence::~TaskForwardingSequence() { @@ -44,7 +47,7 @@ task_queue_->ScheduleTask( base::BindOnce(&TaskForwardingSequence::RunTask, std::move(task), std::move(sync_token_fences), order_num, - sync_point_manager_, sync_point_order_data_), + sync_point_manager_, scheduler_, sync_point_order_data_), false /* out_of_order */); } @@ -59,7 +62,7 @@ task_queue_->ScheduleOrRetainTask( base::BindOnce(&TaskForwardingSequence::RunTask, std::move(task), std::move(sync_token_fences), order_num, - sync_point_manager_, sync_point_order_data_)); + sync_point_manager_, scheduler_, sync_point_order_data_)); } // Should not be called because tasks aren't reposted to wait for sync tokens, @@ -75,6 +78,7 @@ std::vector<gpu::SyncToken> sync_token_fences, uint32_t order_num, gpu::SyncPointManager* sync_point_manager, + gpu::Scheduler* scheduler, scoped_refptr<gpu::SyncPointOrderData> sync_point_order_data) { // Block thread when waiting for sync token. This avoids blocking when we // encounter the wait command later. @@ -84,8 +88,13 @@ sync_token, sync_point_order_data->sequence_id(), order_num, base::BindOnce(&base::WaitableEvent::Signal, base::Unretained(&completion)))) { - TRACE_EVENT0("android_webview", - "TaskForwardingSequence::RunTask::WaitSyncToken"); + gpu::SequenceId release_sequence_id = + sync_point_manager->GetSyncTokenReleaseSequenceId(sync_token); + TRACE_EVENT1("android_webview", + "TaskForwardingSequence::RunTask::WaitSyncToken", + "sequence_id", release_sequence_id.value()); + gpu::Scheduler::ScopedAddWaitingPriority waiting( + scheduler, release_sequence_id, gpu::SchedulingPriority::kHigh); completion.Wait(); } }
diff --git a/android_webview/browser/gfx/task_forwarding_sequence.h b/android_webview/browser/gfx/task_forwarding_sequence.h index 67515e9..e9033d0 100644 --- a/android_webview/browser/gfx/task_forwarding_sequence.h +++ b/android_webview/browser/gfx/task_forwarding_sequence.h
@@ -14,6 +14,7 @@ #include "gpu/command_buffer/service/single_task_sequence.h" namespace gpu { +class Scheduler; class SyncPointManager; } @@ -26,8 +27,9 @@ // TaskQueueWebView. class TaskForwardingSequence : public gpu::SingleTaskSequence { public: - explicit TaskForwardingSequence(TaskQueueWebView* task_queue, - gpu::SyncPointManager* sync_point_manager); + TaskForwardingSequence(TaskQueueWebView* task_queue, + gpu::SyncPointManager* sync_point_manager, + gpu::Scheduler* scheduler); TaskForwardingSequence(const TaskForwardingSequence&) = delete; TaskForwardingSequence& operator=(const TaskForwardingSequence&) = delete; @@ -61,11 +63,13 @@ std::vector<gpu::SyncToken> sync_token_fences, uint32_t order_num, gpu::SyncPointManager* sync_point_manager, + gpu::Scheduler* scheduler, scoped_refptr<gpu::SyncPointOrderData> sync_point_order_data); // Raw pointer refer to the global instance. const raw_ptr<TaskQueueWebView> task_queue_; const raw_ptr<gpu::SyncPointManager> sync_point_manager_; + const raw_ptr<gpu::Scheduler> scheduler_; scoped_refptr<gpu::SyncPointOrderData> sync_point_order_data_; };
diff --git a/android_webview/browser/gfx/task_queue_webview.h b/android_webview/browser/gfx/task_queue_webview.h index 9ceeb24e..2808b42 100644 --- a/android_webview/browser/gfx/task_queue_webview.h +++ b/android_webview/browser/gfx/task_queue_webview.h
@@ -35,15 +35,10 @@ // Called by TaskForwardingSequence. virtual void ScheduleOrRetainTask(base::OnceClosure task) = 0; - // Called by DeferredGpuCommandService to schedule delayed tasks. - // This should not be called when kVizForWebView is enabled. + // Called to schedule delayed tasks. virtual void ScheduleIdleTask(base::OnceClosure task) = 0; - // Called by both DeferredGpuCommandService and - // SkiaOutputSurfaceDisplayContext to post task to client thread. - void ScheduleClientTask(base::OnceClosure task) { - GetClientTaskRunner()->PostTask(FROM_HERE, std::move(task)); - } + // Used to post task to client thread. virtual scoped_refptr<base::TaskRunner> GetClientTaskRunner() = 0; protected:
diff --git a/android_webview/gpu/aw_content_gpu_client.cc b/android_webview/gpu/aw_content_gpu_client.cc index 75cc6a98..8bc7279 100644 --- a/android_webview/gpu/aw_content_gpu_client.cc +++ b/android_webview/gpu/aw_content_gpu_client.cc
@@ -4,17 +4,20 @@ #include "android_webview/gpu/aw_content_gpu_client.h" +#include <utility> + namespace android_webview { AwContentGpuClient::AwContentGpuClient( - const GetSyncPointManagerCallback& sync_point_manager_callback, - const GetSharedImageManagerCallback& shared_image_manager_callback, - const GetVizCompositorThreadRunnerCallback& - viz_compositor_thread_runner_callback) - : sync_point_manager_callback_(sync_point_manager_callback), - shared_image_manager_callback_(shared_image_manager_callback), + GetSyncPointManagerCallback sync_point_manager_callback, + GetSharedImageManagerCallback shared_image_manager_callback, + GetSchedulerCallback scheduler_callback, + GetVizCompositorThreadRunnerCallback viz_compositor_thread_runner_callback) + : sync_point_manager_callback_(std::move(sync_point_manager_callback)), + shared_image_manager_callback_(std::move(shared_image_manager_callback)), + scheduler_callback_(std::move(scheduler_callback)), viz_compositor_thread_runner_callback_( - viz_compositor_thread_runner_callback) {} + std::move(viz_compositor_thread_runner_callback)) {} AwContentGpuClient::~AwContentGpuClient() {} @@ -26,6 +29,10 @@ return shared_image_manager_callback_.Run(); } +gpu::Scheduler* AwContentGpuClient::GetScheduler() { + return scheduler_callback_.Run(); +} + viz::VizCompositorThreadRunner* AwContentGpuClient::GetVizCompositorThreadRunner() { return viz_compositor_thread_runner_callback_.Run();
diff --git a/android_webview/gpu/aw_content_gpu_client.h b/android_webview/gpu/aw_content_gpu_client.h index 6cded2ed..def05d6 100644 --- a/android_webview/gpu/aw_content_gpu_client.h +++ b/android_webview/gpu/aw_content_gpu_client.h
@@ -16,13 +16,15 @@ base::RepeatingCallback<gpu::SyncPointManager*()>; using GetSharedImageManagerCallback = base::RepeatingCallback<gpu::SharedImageManager*()>; + using GetSchedulerCallback = base::RepeatingCallback<gpu::Scheduler*()>; using GetVizCompositorThreadRunnerCallback = base::RepeatingCallback<viz::VizCompositorThreadRunner*()>; AwContentGpuClient( - const GetSyncPointManagerCallback& sync_point_manager_callback, - const GetSharedImageManagerCallback& shared_image_manager_callback, - const GetVizCompositorThreadRunnerCallback& + GetSyncPointManagerCallback sync_point_manager_callback, + GetSharedImageManagerCallback shared_image_manager_callback, + GetSchedulerCallback scheduler_callback, + GetVizCompositorThreadRunnerCallback viz_compositor_thread_runner_callback); AwContentGpuClient(const AwContentGpuClient&) = delete; @@ -33,11 +35,13 @@ // content::ContentGpuClient implementation. gpu::SyncPointManager* GetSyncPointManager() override; gpu::SharedImageManager* GetSharedImageManager() override; + gpu::Scheduler* GetScheduler() override; viz::VizCompositorThreadRunner* GetVizCompositorThreadRunner() override; private: GetSyncPointManagerCallback sync_point_manager_callback_; GetSharedImageManagerCallback shared_image_manager_callback_; + GetSchedulerCallback scheduler_callback_; GetVizCompositorThreadRunnerCallback viz_compositor_thread_runner_callback_; };
diff --git a/android_webview/lib/aw_main_delegate.cc b/android_webview/lib/aw_main_delegate.cc index 6e60608..3f74f50 100644 --- a/android_webview/lib/aw_main_delegate.cc +++ b/android_webview/lib/aw_main_delegate.cc
@@ -487,6 +487,11 @@ return GpuServiceWebView::GetInstance()->shared_image_manager(); } +gpu::Scheduler* GetScheduler() { + DCHECK(GpuServiceWebView::GetInstance()); + return GpuServiceWebView::GetInstance()->scheduler(); +} + viz::VizCompositorThreadRunner* GetVizCompositorThreadRunner() { return VizCompositorThreadRunnerWebView::GetInstance(); } @@ -497,6 +502,7 @@ content_gpu_client_ = std::make_unique<AwContentGpuClient>( base::BindRepeating(&GetSyncPointManager), base::BindRepeating(&GetSharedImageManager), + base::BindRepeating(&GetScheduler), base::BindRepeating(&GetVizCompositorThreadRunner)); return content_gpu_client_.get(); }
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 4325cd5a..dceb8538 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -2881,7 +2881,6 @@ "system/network/wifi_toggle_notification_controller_unittest.cc", "system/night_light/night_light_controller_unittest.cc", "system/night_light/night_light_feature_pod_controller_unittest.cc", - "system/notification_center/notification_center_tray_unittest.cc", "system/overview/overview_button_tray_unittest.cc", "system/palette/mock_palette_tool_delegate.cc", "system/palette/mock_palette_tool_delegate.h",
diff --git a/ash/controls/contextual_nudge.cc b/ash/controls/contextual_nudge.cc index 1635d80..30f4423 100644 --- a/ash/controls/contextual_nudge.cc +++ b/ash/controls/contextual_nudge.cc
@@ -7,6 +7,7 @@ #include "ash/public/cpp/shelf_types.h" #include "ash/public/cpp/shell_window_ids.h" #include "ash/shelf/shelf.h" +#include "ash/style/ash_color_provider.h" #include "ash/system/tray/tray_constants.h" #include "ash/wm/collision_detection/collision_detection_utils.h" #include "ui/aura/window.h" @@ -37,7 +38,6 @@ Position position, const gfx::Insets& margins, const std::u16string& text, - SkColor text_color, const base::RepeatingClosure& tap_callback) : views::BubbleDialogDelegateView(anchor, GetArrowForPosition(position), @@ -68,7 +68,6 @@ label_->SetPaintToLayer(); label_->layer()->SetFillsBoundsOpaquely(false); label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); - label_->SetEnabledColor(text_color); label_->SetBackgroundColor(SK_ColorTRANSPARENT); label_->SetBorder(views::CreateEmptyBorder(margins)); @@ -117,4 +116,10 @@ views::BubbleDialogDelegateView::OnGestureEvent(event); } +void ContextualNudge::OnThemeChanged() { + views::BubbleDialogDelegateView::OnThemeChanged(); + label_->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor( + AshColorProvider::ContentLayerType::kTextColorPrimary)); +} + } // namespace ash
diff --git a/ash/controls/contextual_nudge.h b/ash/controls/contextual_nudge.h index c0e5e31..e841cc5 100644 --- a/ash/controls/contextual_nudge.h +++ b/ash/controls/contextual_nudge.h
@@ -31,14 +31,12 @@ // |position| - The nudge position relative to the anchor rectangle. // |margins| - The margins added to the nudge bubble. // |text| - The nudge text. - // |text_color| - The nudge text label foreground color. - // |tap_callback| - If set, the callback called when the user taps the nuge. + // |tap_callback| - If set, the callback called when the user taps the nudge. ContextualNudge(views::View* anchor, aura::Window* parent_window, Position position, const gfx::Insets& margins, const std::u16string& text, - SkColor text_color, const base::RepeatingClosure& tap_callback); ~ContextualNudge() override; @@ -54,6 +52,7 @@ // BubbleDialogDelegateView: ui::LayerType GetLayerType() const override; void OnGestureEvent(ui::GestureEvent* event) override; + void OnThemeChanged() override; private: base::RepeatingClosure tap_callback_;
diff --git a/ash/glanceables/glanceables_up_next_view.cc b/ash/glanceables/glanceables_up_next_view.cc index 1369fbb..ca20a7d 100644 --- a/ash/glanceables/glanceables_up_next_view.cc +++ b/ash/glanceables/glanceables_up_next_view.cc
@@ -67,7 +67,7 @@ GlanceablesUpNextView::~GlanceablesUpNextView() { calendar_model_->RemoveObserver(this); -}; +} void GlanceablesUpNextView::OnEventsFetched( const CalendarModel::FetchingStatus status,
diff --git a/ash/quick_pair/fast_pair_handshake/fake_fast_pair_handshake.cc b/ash/quick_pair/fast_pair_handshake/fake_fast_pair_handshake.cc index 213068ae..1a3cd89 100644 --- a/ash/quick_pair/fast_pair_handshake/fake_fast_pair_handshake.cc +++ b/ash/quick_pair/fast_pair_handshake/fake_fast_pair_handshake.cc
@@ -34,9 +34,8 @@ void FakeFastPairHandshake::InvokeCallback( absl::optional<PairFailure> failure) { - bool has_failure = failure.has_value(); - std::move(on_complete_callback_).Run(device_, std::move(failure)); - completed_successfully_ = !has_failure; + completed_successfully_ = !failure.has_value(); + std::move(on_complete_callback_).Run(device_, failure); } } // namespace quick_pair
diff --git a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.cc b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.cc index a5e28b6..4f81c6d0 100644 --- a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.cc +++ b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.cc
@@ -161,25 +161,52 @@ fast_pair_handshake_ = FastPairHandshakeLookup::GetInstance()->Get(device_); - if (!fast_pair_handshake_) { - QP_LOG(INFO) << __func__ - << ": Failed to find handshake. This is only valid if we " - "lost the device before this class executed."; + if (fast_pair_handshake_) { + // Handle cases where we are retrying pair after a non-handshake related + // error occurs. + if (fast_pair_handshake_->completed_successfully()) { + QP_LOG(VERBOSE) << __func__ + << ": Reusing handshake for retried pair attempt."; + OnHandshakeComplete(device_, /*failure=*/absl::nullopt); + return; + } + + // Handles cases where we are retrying pair after an error occurred when + // creating the handshake. + QP_LOG(VERBOSE) << __func__ + << ": Clearing failed handshake for retried pair attempt."; + FastPairHandshakeLookup::GetInstance()->Erase(device_); + fast_pair_handshake_ = nullptr; + } + + QP_LOG(VERBOSE) << __func__ << ": Creating new handshake for pair attempt."; + FastPairHandshakeLookup::GetInstance()->Create( + adapter_, device_, + base::BindOnce(&FastPairPairerImpl::OnHandshakeComplete, + weak_ptr_factory_.GetWeakPtr())); +} + +void FastPairPairerImpl::OnHandshakeComplete( + scoped_refptr<Device> device, + absl::optional<PairFailure> failure) { + if (failure.has_value()) { + QP_LOG(WARNING) << __func__ << ": Handshake failed with " << device + << " because: " << failure.value(); + std::move(pair_failed_callback_).Run(device_, failure.value()); + return; + } + + // During handshake, the device address can be set to null. + if (!device_->classic_address()) { + QP_LOG(WARNING) << __func__ << ": Device lost during handshake."; std::move(pair_failed_callback_) .Run(device_, PairFailure::kPairingDeviceLost); return; } - device::BluetoothDevice* bt_device = - adapter_->GetDevice(device_->ble_address); + fast_pair_handshake_ = FastPairHandshakeLookup::GetInstance()->Get(device_); - if (!bt_device) { - QP_LOG(WARNING) << __func__ << ": Could not find Bluetooth device."; - std::move(pair_failed_callback_) - .Run(device_, PairFailure::kPairingDeviceLost); - return; - } - + DCHECK(fast_pair_handshake_); DCHECK(fast_pair_handshake_->completed_successfully()); fast_pair_gatt_service_client_ =
diff --git a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.h b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.h index 17ddaaa..d9beb57a 100644 --- a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.h +++ b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.h
@@ -113,6 +113,10 @@ void OnConnectDevice(device::BluetoothDevice* device); void OnConnectError(); + // FastPairHandshakeLookup::Create callback + void OnHandshakeComplete(scoped_refptr<Device> device, + absl::optional<PairFailure> failure); + // FastPairGattServiceClient::WritePasskey callback void OnPasskeyResponse(std::vector<uint8_t> response_bytes, absl::optional<PairFailure> failure);
diff --git a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl_unittest.cc b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl_unittest.cc index 1669d9f..3bc74e3 100644 --- a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl_unittest.cc +++ b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl_unittest.cc
@@ -109,19 +109,15 @@ FakeBluetoothAdapter& operator=(const FakeBluetoothAdapter&) = delete; device::BluetoothDevice* GetDevice(const std::string& address) override { - // To mock when we the device is lost before pairing begins. - if (get_device_initial_failure_) { - get_device_initial_failure_ = false; + // There are a few situations where we want GetDevice to return nullptr. For + // example, if we want the Pairer to "pair by address" then GetDevice should + // return nullptr when called on the mac address. + if (get_device_returns_nullptr_ && + address == kBluetoothCanonicalizedAddress) { + get_device_returns_nullptr_ = false; return nullptr; } - // To mock when we need to pair to address. We need an initial return of a - // device to get this point, but the following call should return a nullptr - // to demonstrate that we lost the device. - if (get_device_connect_failure_) { - get_device_initial_failure_ = true; - } - for (const auto& it : mock_devices_) { if (it->GetAddress() == address) return it.get(); @@ -151,12 +147,6 @@ observer.DevicePairedChanged(this, device, new_paired_status); } - void SetGetDeviceInitialFailure() { get_device_initial_failure_ = true; } - - void SetGetDeviceInitialSuccess() { get_device_initial_failure_ = false; } - - void SetGetDeviceConnectFailure() { get_device_connect_failure_ = true; } - void ConnectDevice( const std::string& address, const absl::optional<device::BluetoothDevice::AddressType>& address_type, @@ -172,11 +162,12 @@ void SetConnectFailure() { connect_device_failure_ = true; } + void SetGetDeviceNullptr() { get_device_returns_nullptr_ = true; } + protected: ~FakeBluetoothAdapter() override = default; - bool get_device_initial_failure_ = false; bool connect_device_failure_ = false; - bool get_device_connect_failure_ = false; + bool get_device_returns_nullptr_ = false; device::BluetoothDevice::PairingDelegate* pairing_delegate_ = nullptr; }; @@ -255,12 +246,30 @@ namespace ash { namespace quick_pair { +// For convenience. +using ::testing::Return; + class FastPairPairerImplTest : public AshTestBase { public: void SetUp() override { AshTestBase::SetUp(); FastPairGattServiceClientImpl::Factory::SetFactoryForTesting( &fast_pair_gatt_service_factory_); + FastPairHandshakeLookup::SetCreateFunctionForTesting(base::BindRepeating( + &FastPairPairerImplTest::CreateHandshake, base::Unretained(this))); + + adapter_ = base::MakeRefCounted<FakeBluetoothAdapter>(); + + gatt_service_client_ = FastPairGattServiceClientImpl::Factory::Create( + fake_bluetooth_device_ptr_, adapter_.get(), base::DoNothing()); + + // We have to pass in a unique_ptr when we create a Handshake, however + // we also want to be able to set fake responses on the encryptor. Thus + // we maintain 2 pointers. We won't touch data_encryptor_unique_ aside + // from CreateHandshake. + data_encryptor_unique_ = std::make_unique<FakeFastPairDataEncryptor>(); + data_encryptor_ = + static_cast<FakeFastPairDataEncryptor*>(data_encryptor_unique_.get()); } void TearDown() override { @@ -269,7 +278,7 @@ AshTestBase::TearDown(); } - void SuccessfulDataEncryptorSetUp(bool fast_pair_v1, Protocol protocol) { + void CreateMockDevice(bool fast_pair_v1, Protocol protocol) { device_ = base::MakeRefCounted<Device>( kMetadataId, kBluetoothCanonicalizedAddress, protocol); device_->set_classic_address(kBluetoothCanonicalizedAddress); @@ -279,33 +288,6 @@ {1}); } - adapter_ = base::MakeRefCounted<FakeBluetoothAdapter>(); - - // Need to add a matching mock device to the bluetooth adapter with the - // same address to mock the relationship between Device and - // device::BluetoothDevice. - fake_bluetooth_device_ = - std::make_unique<FakeBluetoothDevice>(adapter_.get()); - fake_bluetooth_device_ptr_ = fake_bluetooth_device_.get(); - adapter_->AddMockDevice(std::move(fake_bluetooth_device_)); - - data_encryptor_ = new FakeFastPairDataEncryptor(); - - gatt_service_client_ = FastPairGattServiceClientImpl::Factory::Create( - fake_bluetooth_device_ptr_, adapter_.get(), base::DoNothing()); - FastPairHandshakeLookup::SetCreateFunctionForTesting(base::BindRepeating( - &FastPairPairerImplTest::CreateHandshake, base::Unretained(this))); - FastPairHandshakeLookup::GetInstance()->Create(adapter_, device_, - base::DoNothing()); - } - - void FailedHandshakeSetUp(Protocol protocol) { - device_ = base::MakeRefCounted<Device>( - kMetadataId, kBluetoothCanonicalizedAddress, protocol); - device_->set_classic_address(kBluetoothCanonicalizedAddress); - - adapter_ = base::MakeRefCounted<FakeBluetoothAdapter>(); - // Need to add a matching mock device to the bluetooth adapter with the // same address to mock the relationship between Device and // device::BluetoothDevice. @@ -322,10 +304,14 @@ std::unique_ptr<FastPairHandshake> CreateHandshake( scoped_refptr<Device> device, FastPairHandshake::OnCompleteCallback callback) { + // This is the only place where data_encryptor_unique_ is used. We assume + // that CreateHandshake is only called once. auto fake = std::make_unique<FakeFastPairHandshake>( adapter_, device, std::move(callback), - base::WrapUnique(data_encryptor_), std::move(gatt_service_client_)); - fake->InvokeCallback(); + std::move(data_encryptor_unique_), std::move(gatt_service_client_)); + + fake_fast_pair_handshake_ = fake.get(); + return fake; } @@ -378,13 +364,9 @@ void SetPairFailure() { fake_bluetooth_device_ptr_->SetPairFailure(); } - void SetGetDeviceInitialFailure() { adapter_->SetGetDeviceInitialFailure(); } - void SetConnectFailure() { adapter_->SetConnectFailure(); } - void SetGetDeviceConnectFailure() { adapter_->SetGetDeviceConnectFailure(); } - - void SetGetDeviceInitialSuccess() { adapter_->SetGetDeviceInitialSuccess(); } + void SetGetDeviceNullptr() { adapter_->SetGetDeviceNullptr(); } bool IsDevicePaired() { return fake_bluetooth_device_ptr_->IsDevicePaired(); } @@ -441,37 +423,33 @@ base::HistogramTester histogram_tester_; std::unique_ptr<FastPairGattServiceClient> gatt_service_client_; FakeFastPairGattServiceClientImplFactory fast_pair_gatt_service_factory_; + std::unique_ptr<FakeFastPairDataEncryptor> data_encryptor_unique_; FakeFastPairDataEncryptor* data_encryptor_ = nullptr; + FakeFastPairHandshake* fake_fast_pair_handshake_ = nullptr; std::unique_ptr<FastPairPairer> pairer_; base::WeakPtrFactory<FastPairPairerImplTest> weak_ptr_factory_{this}; }; -TEST_F(FastPairPairerImplTest, NoPairingIfHandshakeLost) { +TEST_F(FastPairPairerImplTest, NoPairingIfHandshakeFailed) { Login(user_manager::UserType::USER_TYPE_REGULAR); base::RunLoop().RunUntilIdle(); - FailedHandshakeSetUp(Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); CreatePairer(); - EXPECT_EQ(GetPairFailure(), PairFailure::kPairingDeviceLost); -} - -TEST_F(FastPairPairerImplTest, FailedCallbackInvokedOnDeviceNotFound) { - Login(user_manager::UserType::USER_TYPE_REGULAR); + fake_fast_pair_handshake_->InvokeCallback(PairFailure::kCreateGattConnection); base::RunLoop().RunUntilIdle(); - - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceInitialFailure(); - CreatePairer(); - EXPECT_EQ(GetPairFailure(), PairFailure::kPairingDeviceLost); + EXPECT_EQ(GetPairFailure(), PairFailure::kCreateGattConnection); } TEST_F(FastPairPairerImplTest, NoCallbackIsInvokedOnGattSuccess_Initial) { Login(user_manager::UserType::USER_TYPE_REGULAR); base::RunLoop().RunUntilIdle(); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); + base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); } @@ -479,9 +457,11 @@ Login(user_manager::UserType::USER_TYPE_REGULAR); base::RunLoop().RunUntilIdle(); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairRetroactive); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairRetroactive); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); + base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); } @@ -489,103 +469,112 @@ Login(user_manager::UserType::USER_TYPE_REGULAR); base::RunLoop().RunUntilIdle(); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); + base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); } -TEST_F(FastPairPairerImplTest, SuccessfulDecryptedResponsePairFailure_Initial) { +// PairByDevice refers to the fact that we aren't pairing by address, unlike +// most other tests in this file. +TEST_F(FastPairPairerImplTest, PairByDeviceFailure_Initial) { Login(user_manager::UserType::USER_TYPE_REGULAR); base::RunLoop().RunUntilIdle(); histogram_tester().ExpectTotalCount(kPairDeviceResult, 0); histogram_tester().ExpectTotalCount(kPairDeviceErrorReason, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPairFailure(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), PairFailure::kPairingConnect); histogram_tester().ExpectTotalCount(kPairDeviceResult, 1); histogram_tester().ExpectTotalCount(kPairDeviceErrorReason, 1); } -TEST_F(FastPairPairerImplTest, - SuccessfulDecryptedResponsePairFailure_Subsequent) { +TEST_F(FastPairPairerImplTest, PairByDeviceFailure_Subsequent) { Login(user_manager::UserType::USER_TYPE_REGULAR); base::RunLoop().RunUntilIdle(); histogram_tester().ExpectTotalCount(kPairDeviceResult, 0); histogram_tester().ExpectTotalCount(kPairDeviceErrorReason, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); SetPairFailure(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), PairFailure::kPairingConnect); histogram_tester().ExpectTotalCount(kPairDeviceResult, 1); histogram_tester().ExpectTotalCount(kPairDeviceErrorReason, 1); } -TEST_F(FastPairPairerImplTest, SuccessfulDecryptedResponsePairSuccess_Initial) { +TEST_F(FastPairPairerImplTest, PairByDeviceSuccess_Initial) { Login(user_manager::UserType::USER_TYPE_REGULAR); base::RunLoop().RunUntilIdle(); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); } -TEST_F(FastPairPairerImplTest, - SuccessfulDecryptedResponsePairSuccess_Subsequent) { +TEST_F(FastPairPairerImplTest, PairByDeviceSuccess_Subsequent) { Login(user_manager::UserType::USER_TYPE_REGULAR); base::RunLoop().RunUntilIdle(); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); } -TEST_F(FastPairPairerImplTest, - SuccessfulDecryptedResponseConnectFailure_Initial) { +TEST_F(FastPairPairerImplTest, ConnectFailure_Initial) { Login(user_manager::UserType::USER_TYPE_REGULAR); base::RunLoop().RunUntilIdle(); histogram_tester().ExpectTotalCount(kConnectDeviceResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetConnectFailure(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), PairFailure::kAddressConnect); histogram_tester().ExpectTotalCount(kConnectDeviceResult, 1); } -TEST_F(FastPairPairerImplTest, - SuccessfulDecryptedResponseConnectFailure_Subsequent) { +TEST_F(FastPairPairerImplTest, ConnectFailure_Subsequent) { Login(user_manager::UserType::USER_TYPE_REGULAR); base::RunLoop().RunUntilIdle(); histogram_tester().ExpectTotalCount(kConnectDeviceResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); SetConnectFailure(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), PairFailure::kAddressConnect); histogram_tester().ExpectTotalCount(kConnectDeviceResult, 1); } -TEST_F(FastPairPairerImplTest, - SuccessfulDecryptedResponseConnectSuccess_Initial) { +TEST_F(FastPairPairerImplTest, ConnectSuccess_Initial) { Login(user_manager::UserType::USER_TYPE_REGULAR); base::RunLoop().RunUntilIdle(); @@ -593,10 +582,13 @@ 0); histogram_tester().ExpectTotalCount( kWritePasskeyCharacteristicPairFailureMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); histogram_tester().ExpectTotalCount(kWritePasskeyCharacteristicResultMetric, @@ -605,8 +597,7 @@ kWritePasskeyCharacteristicPairFailureMetric, 0); } -TEST_F(FastPairPairerImplTest, - SuccessfulDecryptedResponseConnectSuccess_Subsequent) { +TEST_F(FastPairPairerImplTest, ConnectSuccess_Subsequent) { Login(user_manager::UserType::USER_TYPE_REGULAR); base::RunLoop().RunUntilIdle(); @@ -614,10 +605,13 @@ 0); histogram_tester().ExpectTotalCount( kWritePasskeyCharacteristicPairFailureMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); histogram_tester().ExpectTotalCount(kWritePasskeyCharacteristicResultMetric, @@ -636,10 +630,13 @@ kWritePasskeyCharacteristicPairFailureMetric, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); NotifyConfirmPasskey(); @@ -665,10 +662,13 @@ kWritePasskeyCharacteristicPairFailureMetric, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); NotifyConfirmPasskey(); @@ -690,10 +690,13 @@ histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); SetDecryptPasskeyForIncorrectMessageType( @@ -714,10 +717,13 @@ histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); SetDecryptPasskeyForIncorrectMessageType( @@ -738,10 +744,13 @@ histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); SetDecryptPasskeyForIncorrectMessageType( @@ -760,10 +769,13 @@ histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); SetDecryptPasskeyForNoPasskey(); @@ -782,10 +794,13 @@ histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); SetDecryptPasskeyForIncorrectMessageType( @@ -804,10 +819,13 @@ histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); SetDecryptPasskeyForPasskeyMismatch(); @@ -825,10 +843,13 @@ histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); SetDecryptPasskeyForPasskeyMismatch(); @@ -846,13 +867,20 @@ histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); SetDecryptPasskeyForSuccess(); + + // This time, this helper function is used to make the device lost during + // Passkey exchange. + SetGetDeviceNullptr(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -867,13 +895,20 @@ histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); SetDecryptPasskeyForSuccess(); + + // This time, this helper function is used to make the device lost during + // Passkey exchange. + SetGetDeviceNullptr(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -889,15 +924,17 @@ histogram_tester().ExpectTotalCount(kConfirmPasskeyAskTime, 0); histogram_tester().ExpectTotalCount(kConfirmPasskeyConfirmTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -916,15 +953,17 @@ histogram_tester().ExpectTotalCount(kConfirmPasskeyAskTime, 0); histogram_tester().ExpectTotalCount(kConfirmPasskeyConfirmTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairerAsFactory(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -951,15 +990,17 @@ histogram_tester().ExpectTotalCount(kConfirmPasskeyConfirmTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); EXPECT_CALL(pairing_procedure_complete_, Run); @@ -987,15 +1028,17 @@ histogram_tester().ExpectTotalCount(kConfirmPasskeyConfirmTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); EXPECT_CALL(pairing_procedure_complete_, Run); @@ -1022,15 +1065,17 @@ histogram_tester().ExpectTotalCount(kConfirmPasskeyConfirmTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptTime, 0); histogram_tester().ExpectTotalCount(kPasskeyCharacteristicDecryptResult, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); EXPECT_CALL(pairing_procedure_complete_, Run); @@ -1056,16 +1101,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1091,16 +1138,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1125,16 +1174,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1153,16 +1204,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); EXPECT_CALL(pairing_procedure_complete_, Run); @@ -1179,16 +1232,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); EXPECT_CALL(pairing_procedure_complete_, Run); @@ -1202,16 +1257,18 @@ TEST_F(FastPairPairerImplTest, WriteAccountKey_Initial_NotLoggedIn) { histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1225,16 +1282,18 @@ GetSessionControllerClient()->LockScreen(); histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1255,15 +1314,17 @@ nearby::fastpair::OptInStatus::STATUS_OPTED_IN); base::RunLoop().RunUntilIdle(); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); EXPECT_CALL(pairing_procedure_complete_, Run); @@ -1289,15 +1350,17 @@ features::kFastPairSavedDevicesStrictOptIn}); base::RunLoop().RunUntilIdle(); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); EXPECT_CALL(pairing_procedure_complete_, Run); @@ -1322,15 +1385,17 @@ /*disabled_features=*/{features::kFastPairSavedDevicesStrictOptIn}); base::RunLoop().RunUntilIdle(); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); EXPECT_CALL(pairing_procedure_complete_, Run); @@ -1358,10 +1423,13 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairRetroactive); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairRetroactive); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_CALL(pairing_procedure_complete_, Run); RunWriteAccountKeyCallback(); @@ -1382,10 +1450,13 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairRetroactive); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairRetroactive); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_CALL(pairing_procedure_complete_, Run); RunWriteAccountKeyCallback(); @@ -1405,10 +1476,13 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairRetroactive); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairRetroactive); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_CALL(pairing_procedure_complete_, Run); RunWriteAccountKeyCallback(); @@ -1429,16 +1503,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); SetPublicKey(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1465,16 +1541,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); SetPublicKey(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1501,16 +1579,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); SetPublicKey(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1537,16 +1617,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); SetPublicKey(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1573,16 +1655,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); SetPublicKey(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1609,16 +1693,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); SetPublicKey(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1645,16 +1731,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); SetPublicKey(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1681,16 +1769,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); SetPublicKey(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1707,8 +1797,8 @@ Login(user_manager::UserType::USER_TYPE_REGULAR); base::RunLoop().RunUntilIdle(); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/true, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/true, + /*protocol=*/Protocol::kFastPairInitial); CreatePairer(); EXPECT_EQ(GetSystemTrayClient()->show_bluetooth_pairing_dialog_count(), 1); EXPECT_CALL(paired_callback_, Run); @@ -1720,8 +1810,8 @@ Login(user_manager::UserType::USER_TYPE_REGULAR); base::RunLoop().RunUntilIdle(); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/true, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/true, + /*protocol=*/Protocol::kFastPairInitial); CreatePairer(); EXPECT_EQ(GetSystemTrayClient()->show_bluetooth_pairing_dialog_count(), 1); EXPECT_CALL(paired_callback_, Run).Times(0); @@ -1742,16 +1832,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); @@ -1775,16 +1867,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1807,16 +1901,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1840,16 +1936,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1872,16 +1970,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1905,16 +2005,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); @@ -1938,16 +2040,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -1970,16 +2074,18 @@ histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -2011,16 +2117,18 @@ // Pair the device via Initial Pairing protocol. histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairInitial); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairInitial); SetPublicKey(); - SetGetDeviceConnectFailure(); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); RunWritePasskeyCallback(kResponseBytes); @@ -2062,10 +2170,13 @@ // Retroactive pair histogram_tester().ExpectTotalCount( kWriteAccountKeyCharacteristicResultMetric, 0); - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairRetroactive); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairRetroactive); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_CALL(pairing_procedure_complete_, Run); RunWriteAccountKeyCallback(); @@ -2099,15 +2210,17 @@ /*success=*/false, 0); // Subsequent pair - SuccessfulDataEncryptorSetUp(/*fast_pair_v1=*/false, - /*protocol=*/Protocol::kFastPairSubsequent); - SetGetDeviceConnectFailure(); + CreateMockDevice(/*fast_pair_v1=*/false, + /*protocol=*/Protocol::kFastPairSubsequent); + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. + SetGetDeviceNullptr(); CreatePairer(); + fake_fast_pair_handshake_->InvokeCallback(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(GetPairFailure(), absl::nullopt); EXPECT_CALL(paired_callback_, Run); SetDecryptPasskeyForSuccess(); - SetGetDeviceInitialSuccess(); NotifyConfirmPasskey(); base::RunLoop().RunUntilIdle(); EXPECT_CALL(pairing_procedure_complete_, Run);
diff --git a/ash/quick_pair/scanning/fast_pair/fast_pair_discoverable_scanner_impl.cc b/ash/quick_pair/scanning/fast_pair/fast_pair_discoverable_scanner_impl.cc index c7de8785..9077d9e 100644 --- a/ash/quick_pair/scanning/fast_pair/fast_pair_discoverable_scanner_impl.cc +++ b/ash/quick_pair/scanning/fast_pair/fast_pair_discoverable_scanner_impl.cc
@@ -14,8 +14,6 @@ #include "ash/quick_pair/common/logging.h" #include "ash/quick_pair/common/pair_failure.h" #include "ash/quick_pair/common/protocol.h" -#include "ash/quick_pair/fast_pair_handshake/fast_pair_handshake.h" -#include "ash/quick_pair/fast_pair_handshake/fast_pair_handshake_lookup.h" #include "ash/quick_pair/repository/fast_pair_repository.h" #include "ash/services/quick_pair/quick_pair_process.h" #include "ash/services/quick_pair/quick_pair_process_manager.h" @@ -193,52 +191,37 @@ QP_LOG(INFO) << __func__ << ": Id: " << model_id; - // Anti-spoofing keys were introduced in Fast Pair v2, so if this isn't - // available then the device is v1. - if (device_metadata->GetDetails() - .anti_spoofing_key_pair() - .public_key() - .empty()) { - NotifyDeviceFound(std::move(device)); - return; - } - - FastPairHandshakeLookup::GetInstance()->Create( - adapter_, device, - base::BindOnce(&FastPairDiscoverableScannerImpl::OnHandshakeComplete, - weak_pointer_factory_.GetWeakPtr())); -} - -void FastPairDiscoverableScannerImpl::OnHandshakeComplete( - scoped_refptr<Device> device, - absl::optional<PairFailure> failure) { - if (failure) { - QP_LOG(WARNING) << __func__ << ": Handshake failed with " << device - << " because: " << failure.value(); - return; - } - NotifyDeviceFound(std::move(device)); } void FastPairDiscoverableScannerImpl::NotifyDeviceFound( scoped_refptr<Device> device) { device::BluetoothDevice* classic_device = - device->classic_address() + device->classic_address().has_value() ? adapter_->GetDevice(device->classic_address().value()) : nullptr; + if (classic_device && classic_device->IsPaired()) { + QP_LOG(ERROR) << __func__ + << ": A discoverable advertisement " + "was notified for a paired classic device."; + return; + } + device::BluetoothDevice* ble_device = adapter_->GetDevice(device->ble_address); - bool is_already_paired = (classic_device && classic_device->IsPaired()) || - (ble_device && ble_device->IsPaired()); - - if (is_already_paired) { - QP_LOG(INFO) << __func__ << ": Already paired with " << device; + if (ble_device && ble_device->IsPaired()) { + QP_LOG(ERROR) << __func__ + << ": A discoverable advertisement " + "was notified for a paired BLE device."; return; } + // TODO(b/242100708): We currently have no way to tell if a device in pairing + // mode is already paired to the Chromebook; the BLE device has no information + // on the pairing state of the Classic device. + QP_LOG(INFO) << __func__ << ": Running found callback"; notified_devices_[device->ble_address] = device; found_callback_.Run(device);
diff --git a/ash/quick_pair/scanning/fast_pair/fast_pair_discoverable_scanner_impl.h b/ash/quick_pair/scanning/fast_pair/fast_pair_discoverable_scanner_impl.h index a2fad5b..5e728a0 100644 --- a/ash/quick_pair/scanning/fast_pair/fast_pair_discoverable_scanner_impl.h +++ b/ash/quick_pair/scanning/fast_pair/fast_pair_discoverable_scanner_impl.h
@@ -80,8 +80,6 @@ const std::string model_id, DeviceMetadata* device_metadata, bool has_retryable_error); - void OnHandshakeComplete(scoped_refptr<Device> device, - absl::optional<PairFailure> failure); void NotifyDeviceFound(scoped_refptr<Device> device); void OnUtilityProcessStopped( const std::string& address,
diff --git a/ash/quick_pair/scanning/fast_pair/fast_pair_discoverable_scanner_impl_unittest.cc b/ash/quick_pair/scanning/fast_pair/fast_pair_discoverable_scanner_impl_unittest.cc index b5ecbbbc..995cab9 100644 --- a/ash/quick_pair/scanning/fast_pair/fast_pair_discoverable_scanner_impl_unittest.cc +++ b/ash/quick_pair/scanning/fast_pair/fast_pair_discoverable_scanner_impl_unittest.cc
@@ -10,10 +10,6 @@ #include "ash/quick_pair/common/constants.h" #include "ash/quick_pair/common/device.h" #include "ash/quick_pair/common/pair_failure.h" -#include "ash/quick_pair/fast_pair_handshake/fake_fast_pair_handshake.h" -#include "ash/quick_pair/fast_pair_handshake/fast_pair_data_encryptor.h" -#include "ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client.h" -#include "ash/quick_pair/fast_pair_handshake/fast_pair_handshake_lookup.h" #include "ash/quick_pair/repository/fake_fast_pair_repository.h" #include "ash/quick_pair/scanning/fast_pair/fake_fast_pair_scanner.h" #include "ash/quick_pair/scanning/fast_pair/fast_pair_discoverable_scanner.h" @@ -118,10 +114,6 @@ fake_process_manager_ = static_cast<FakeQuickPairProcessManager*>(process_manager_.get()); - FastPairHandshakeLookup::SetCreateFunctionForTesting(base::BindRepeating( - &FastPairDiscoverableScannerImplTest::CreateHandshake, - base::Unretained(this))); - discoverable_scanner_ = std::make_unique<FastPairDiscoverableScannerImpl>( scanner_, adapter_, found_device_callback_.Get(), lost_device_callback_.Get()); @@ -160,17 +152,6 @@ return device_ptr; } - std::unique_ptr<FastPairHandshake> CreateHandshake( - scoped_refptr<Device> device, - FastPairHandshake::OnCompleteCallback callback) { - auto fake = std::make_unique<FakeFastPairHandshake>( - adapter_, std::move(device), std::move(callback)); - - fake_fast_pair_handshake_ = fake.get(); - - return fake; - } - FakeQuickPairProcessManager* fake_process_manager_; base::test::SingleThreadTaskEnvironment task_enviornment_; NetworkStateTestHelper helper_{/*use_default_devices_and_services=*/true}; @@ -182,7 +163,6 @@ std::unique_ptr<QuickPairProcessManager> process_manager_; base::MockCallback<DeviceCallback> found_device_callback_; base::MockCallback<DeviceCallback> lost_device_callback_; - FakeFastPairHandshake* fake_fast_pair_handshake_ = nullptr; }; TEST_F(FastPairDiscoverableScannerImplTest, @@ -372,16 +352,16 @@ base::RunLoop().RunUntilIdle(); - fake_fast_pair_handshake_->InvokeCallback(); - base::RunLoop().RunUntilIdle(); - EXPECT_CALL(lost_device_callback_, Run).Times(1); scanner_->NotifyDeviceLost(device); base::RunLoop().RunUntilIdle(); } -TEST_F(FastPairDiscoverableScannerImplTest, AlreadyPaired_v1) { +// TODO(b/242100708): This test is misleading since we don't actually +// catch the cases where a paired device is discovered by this scanner. +// Update/remove this test once this bug is fixed. +TEST_F(FastPairDiscoverableScannerImplTest, AlreadyPaired) { device::BluetoothDevice* device = GetDevice(kValidModelId, /*is_paired=*/true); @@ -395,59 +375,6 @@ base::RunLoop().RunUntilIdle(); } -TEST_F(FastPairDiscoverableScannerImplTest, AlreadyPaired_v2) { - nearby::fastpair::Device metadata; - metadata.set_trigger_distance(2); - metadata.set_device_type( - nearby::fastpair::DeviceType::TRUE_WIRELESS_HEADPHONES); - auto* key_pair = new ::nearby::fastpair::AntiSpoofingKeyPair(); - key_pair->set_public_key("test_public_key"); - metadata.set_allocated_anti_spoofing_key_pair(key_pair); - repository_->SetFakeMetadata(kValidModelId, metadata); - - device::BluetoothDevice* device = - GetDevice(kValidModelId, /*is_paired=*/true); - - EXPECT_CALL(found_device_callback_, Run).Times(0); - scanner_->NotifyDeviceFound(device); - - base::RunLoop().RunUntilIdle(); - - fake_fast_pair_handshake_->InvokeCallback(); - base::RunLoop().RunUntilIdle(); - - EXPECT_CALL(lost_device_callback_, Run).Times(0); - scanner_->NotifyDeviceLost(device); - - base::RunLoop().RunUntilIdle(); -} - -TEST_F(FastPairDiscoverableScannerImplTest, HandshakeFailed) { - nearby::fastpair::Device metadata; - metadata.set_device_type( - nearby::fastpair::DeviceType::TRUE_WIRELESS_HEADPHONES); - metadata.set_trigger_distance(2); - auto* key_pair = new ::nearby::fastpair::AntiSpoofingKeyPair(); - key_pair->set_public_key("test_public_key"); - metadata.set_allocated_anti_spoofing_key_pair(key_pair); - repository_->SetFakeMetadata(kValidModelId, metadata); - - device::BluetoothDevice* device = GetDevice(kValidModelId); - - EXPECT_CALL(found_device_callback_, Run).Times(0); - scanner_->NotifyDeviceFound(device); - - base::RunLoop().RunUntilIdle(); - - fake_fast_pair_handshake_->InvokeCallback(PairFailure::kCreateGattConnection); - base::RunLoop().RunUntilIdle(); - - EXPECT_CALL(lost_device_callback_, Run).Times(0); - scanner_->NotifyDeviceLost(device); - - base::RunLoop().RunUntilIdle(); -} - TEST_F(FastPairDiscoverableScannerImplTest, DoesntInvokeLostCallbackIfDidntInvokeFound) { EXPECT_CALL(found_device_callback_, Run).Times(0);
diff --git a/ash/quick_pair/scanning/fast_pair/fast_pair_not_discoverable_scanner_impl.cc b/ash/quick_pair/scanning/fast_pair/fast_pair_not_discoverable_scanner_impl.cc index 7cdd247..a4fbdcfe 100644 --- a/ash/quick_pair/scanning/fast_pair/fast_pair_not_discoverable_scanner_impl.cc +++ b/ash/quick_pair/scanning/fast_pair/fast_pair_not_discoverable_scanner_impl.cc
@@ -16,7 +16,6 @@ #include "ash/quick_pair/common/logging.h" #include "ash/quick_pair/common/pair_failure.h" #include "ash/quick_pair/common/protocol.h" -#include "ash/quick_pair/fast_pair_handshake/fast_pair_handshake_lookup.h" #include "ash/quick_pair/repository/fast_pair/device_metadata.h" #include "ash/quick_pair/repository/fast_pair/pairing_metadata.h" #include "ash/quick_pair/repository/fast_pair_repository.h" @@ -225,6 +224,8 @@ if (!metadata || !metadata->device_metadata) return; + // A paired device still emits not discoverable advertisements, so we check + // here to prevent showing an incorrect notification. if (FastPairRepository::Get()->IsAccountKeyPairedLocally( metadata->account_key)) { QP_LOG(INFO) << __func__ @@ -245,34 +246,25 @@ device->SetAdditionalData(Device::AdditionalDataType::kAccountKey, metadata->account_key); - FastPairHandshakeLookup::GetInstance()->Create( - adapter_, std::move(device), - base::BindOnce(&FastPairNotDiscoverableScannerImpl::OnHandshakeComplete, - weak_pointer_factory_.GetWeakPtr())); -} - -void FastPairNotDiscoverableScannerImpl::OnHandshakeComplete( - scoped_refptr<Device> device, - absl::optional<PairFailure> failure) { - if (failure) { - QP_LOG(WARNING) << __func__ << ": Handshake failed with " << device - << " because: " << failure.value(); - return; - } - device::BluetoothDevice* classic_device = device->classic_address() ? adapter_->GetDevice(device->classic_address().value()) : nullptr; + if (classic_device && classic_device->IsPaired()) { + QP_LOG(ERROR) << __func__ + << ": A discoverable advertisement " + "was notified for a paired classic device."; + return; + } + device::BluetoothDevice* ble_device = adapter_->GetDevice(device->ble_address); - bool is_already_paired = (classic_device && classic_device->IsPaired()) || - (ble_device && ble_device->IsPaired()); - - if (is_already_paired) { - QP_LOG(INFO) << __func__ << ": Already paired with " << device; + if (ble_device && ble_device->IsPaired()) { + QP_LOG(ERROR) << __func__ + << ": A discoverable advertisement " + "was notified for a paired BLE device."; return; }
diff --git a/ash/quick_pair/scanning/fast_pair/fast_pair_not_discoverable_scanner_impl.h b/ash/quick_pair/scanning/fast_pair/fast_pair_not_discoverable_scanner_impl.h index 88aa2a3..effdfcd 100644 --- a/ash/quick_pair/scanning/fast_pair/fast_pair_not_discoverable_scanner_impl.h +++ b/ash/quick_pair/scanning/fast_pair/fast_pair_not_discoverable_scanner_impl.h
@@ -83,8 +83,6 @@ const absl::optional<NotDiscoverableAdvertisement>& advertisement); void OnAccountKeyFilterCheckResult(const std::string& address, absl::optional<PairingMetadata> metadata); - void OnHandshakeComplete(scoped_refptr<Device> device, - absl::optional<PairFailure> failure); void NotifyDeviceFound(scoped_refptr<Device> device); void OnUtilityProcessStopped( const std::string& address,
diff --git a/ash/quick_pair/scanning/fast_pair/fast_pair_not_discoverable_scanner_impl_unittest.cc b/ash/quick_pair/scanning/fast_pair/fast_pair_not_discoverable_scanner_impl_unittest.cc index 3ed597a..d111b850 100644 --- a/ash/quick_pair/scanning/fast_pair/fast_pair_not_discoverable_scanner_impl_unittest.cc +++ b/ash/quick_pair/scanning/fast_pair/fast_pair_not_discoverable_scanner_impl_unittest.cc
@@ -14,10 +14,6 @@ #include "ash/quick_pair/common/device.h" #include "ash/quick_pair/common/fast_pair/fast_pair_service_data_creator.h" #include "ash/quick_pair/common/pair_failure.h" -#include "ash/quick_pair/fast_pair_handshake/fake_fast_pair_handshake.h" -#include "ash/quick_pair/fast_pair_handshake/fast_pair_data_encryptor.h" -#include "ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client.h" -#include "ash/quick_pair/fast_pair_handshake/fast_pair_handshake_lookup.h" #include "ash/quick_pair/proto/fastpair.pb.h" #include "ash/quick_pair/repository/fake_fast_pair_repository.h" #include "ash/quick_pair/repository/fast_pair/device_metadata.h" @@ -85,10 +81,6 @@ adapter_ = base::MakeRefCounted<testing::NiceMock<device::MockBluetoothAdapter>>(); - FastPairHandshakeLookup::SetCreateFunctionForTesting(base::BindRepeating( - &FastPairNotDiscoverableScannerImplTest::CreateHandshake, - base::Unretained(this))); - not_discoverable_scanner_ = std::make_unique<FastPairNotDiscoverableScannerImpl>( scanner_, adapter_, found_device_callback_.Get(), @@ -184,17 +176,6 @@ return device_ptr; } - std::unique_ptr<FastPairHandshake> CreateHandshake( - scoped_refptr<Device> device, - FastPairHandshake::OnCompleteCallback callback) { - auto fake = std::make_unique<FakeFastPairHandshake>( - adapter_, std::move(device), std::move(callback)); - - fake_fast_pair_handshake_ = fake.get(); - - return fake; - } - base::test::SingleThreadTaskEnvironment task_enviornment_; scoped_refptr<FakeFastPairScanner> scanner_; std::unique_ptr<FakeFastPairRepository> repository_; @@ -206,7 +187,6 @@ std::unique_ptr<FastPairDataParser> data_parser_; base::MockCallback<DeviceCallback> found_device_callback_; base::MockCallback<DeviceCallback> lost_device_callback_; - FakeFastPairHandshake* fake_fast_pair_handshake_ = nullptr; }; // TODO(crbug.com/1298377) flaky on ASan + LSan bots @@ -457,10 +437,6 @@ base::RunLoop().RunUntilIdle(); - fake_fast_pair_handshake_->InvokeCallback(); - - base::RunLoop().RunUntilIdle(); - EXPECT_CALL(lost_device_callback_, Run).Times(1); scanner_->NotifyDeviceLost(device); @@ -526,9 +502,6 @@ device::BluetoothDevice* device = GetDevice(GetAdvBatteryServicedata()); scanner_->NotifyDeviceFound(device); base::RunLoop().RunUntilIdle(); - - fake_fast_pair_handshake_->InvokeCallback(); - base::RunLoop().RunUntilIdle(); } TEST_F(FastPairNotDiscoverableScannerImplTest, @@ -572,9 +545,6 @@ scanner_->NotifyDeviceFound(device); base::RunLoop().RunUntilIdle(); - fake_fast_pair_handshake_->InvokeCallback(); - base::RunLoop().RunUntilIdle(); - EXPECT_EQ(absl::nullopt, device->GetBatteryInfo( device::BluetoothDevice::BatteryType::kDefault)); EXPECT_NE(absl::nullopt, @@ -614,9 +584,6 @@ scanner_->NotifyDeviceFound(device); base::RunLoop().RunUntilIdle(); - fake_fast_pair_handshake_->InvokeCallback(); - base::RunLoop().RunUntilIdle(); - EXPECT_EQ(absl::nullopt, device->GetBatteryInfo( device::BluetoothDevice::BatteryType::kDefault)); EXPECT_NE(absl::nullopt, @@ -656,9 +623,6 @@ scanner_->NotifyDeviceFound(device); base::RunLoop().RunUntilIdle(); - fake_fast_pair_handshake_->InvokeCallback(); - base::RunLoop().RunUntilIdle(); - EXPECT_EQ(absl::nullopt, device->GetBatteryInfo( device::BluetoothDevice::BatteryType::kDefault)); EXPECT_NE(absl::nullopt, @@ -672,41 +636,7 @@ device::BluetoothDevice::BatteryType::kCaseTrueWireless)); } -TEST_F(FastPairNotDiscoverableScannerImplTest, HandshakeFailed) { - device::BluetoothDevice* device = GetDevice(GetAdvServicedata()); - - nearby::fastpair::GetObservedDeviceResponse response; - response.mutable_device()->set_id(kModelIdLong); - response.mutable_device()->set_trigger_distance(2); - - auto device_metadata = - std::make_unique<DeviceMetadata>(std::move(response), gfx::Image()); - PairingMetadata pairing_metadata(device_metadata.get(), - std::vector<uint8_t>()); - repository_->SetCheckAccountKeysResult(pairing_metadata); - repository_->set_is_account_key_paired_locally(false); - EXPECT_CALL(*process_manager_, GetProcessReference) - .WillRepeatedly( - [&](QuickPairProcessManager::ProcessStoppedCallback callback) { - return std::make_unique< - QuickPairProcessManagerImpl::ProcessReferenceImpl>( - data_parser_remote_, base::DoNothing()); - }); - - EXPECT_CALL(found_device_callback_, Run).Times(0); - scanner_->NotifyDeviceFound(device); - base::RunLoop().RunUntilIdle(); - - fake_fast_pair_handshake_->InvokeCallback(PairFailure::kCreateGattConnection); - base::RunLoop().RunUntilIdle(); - - EXPECT_CALL(lost_device_callback_, Run).Times(0); - scanner_->NotifyDeviceLost(device); - - base::RunLoop().RunUntilIdle(); -} - -TEST_F(FastPairNotDiscoverableScannerImplTest, AlreadyPaired) { +TEST_F(FastPairNotDiscoverableScannerImplTest, AlreadyInitialPaired) { device::BluetoothDevice* device = GetDevice(GetAdvServicedata(), /*is_paired=*/true); @@ -719,7 +649,8 @@ PairingMetadata pairing_metadata(device_metadata.get(), std::vector<uint8_t>()); repository_->SetCheckAccountKeysResult(pairing_metadata); - repository_->set_is_account_key_paired_locally(false); + // After initial pairing, we'll save the account key locally. + repository_->set_is_account_key_paired_locally(true); EXPECT_CALL(*process_manager_, GetProcessReference) .WillRepeatedly( [&](QuickPairProcessManager::ProcessStoppedCallback callback) { @@ -732,7 +663,38 @@ scanner_->NotifyDeviceFound(device); base::RunLoop().RunUntilIdle(); - fake_fast_pair_handshake_->InvokeCallback(); + EXPECT_CALL(lost_device_callback_, Run).Times(0); + scanner_->NotifyDeviceLost(device); + + base::RunLoop().RunUntilIdle(); +} + +// TODO(b/242891006): Re-enable this test after the bug is fixed. +TEST_F(FastPairNotDiscoverableScannerImplTest, DISABLED_AlreadyClassicPaired) { + device::BluetoothDevice* device = + GetDevice(GetAdvServicedata(), /*is_paired=*/true); + + nearby::fastpair::GetObservedDeviceResponse response; + response.mutable_device()->set_id(kModelIdLong); + response.mutable_device()->set_trigger_distance(2); + + auto device_metadata = + std::make_unique<DeviceMetadata>(std::move(response), gfx::Image()); + PairingMetadata pairing_metadata(device_metadata.get(), + std::vector<uint8_t>()); + repository_->SetCheckAccountKeysResult(pairing_metadata); + // When classic pairing, the user elects to not save their account key. + repository_->set_is_account_key_paired_locally(false); + EXPECT_CALL(*process_manager_, GetProcessReference) + .WillRepeatedly( + [&](QuickPairProcessManager::ProcessStoppedCallback callback) { + return std::make_unique< + QuickPairProcessManagerImpl::ProcessReferenceImpl>( + data_parser_remote_, base::DoNothing()); + }); + + EXPECT_CALL(found_device_callback_, Run).Times(0); + scanner_->NotifyDeviceFound(device); base::RunLoop().RunUntilIdle(); EXPECT_CALL(lost_device_callback_, Run).Times(0);
diff --git a/ash/services/quick_pair/fast_pair_data_parser.cc b/ash/services/quick_pair/fast_pair_data_parser.cc index 52faa76..08a9101 100644 --- a/ash/services/quick_pair/fast_pair_data_parser.cc +++ b/ash/services/quick_pair/fast_pair_data_parser.cc
@@ -275,7 +275,7 @@ } if (salt_bytes.size() > 1) { - QP_LOG(WARNING) << "Parsed a salt field larger than one byte: " + QP_LOG(WARNING) << " Parsed a salt field larger than one byte: " << salt_bytes.size(); std::move(callback).Run(absl::nullopt); return;
diff --git a/ash/shelf/drag_handle.cc b/ash/shelf/drag_handle.cc index 6264f65..3522ea2 100644 --- a/ash/shelf/drag_handle.cc +++ b/ash/shelf/drag_handle.cc
@@ -350,8 +350,6 @@ drag_handle_nudge_ = new ContextualNudge( this, nullptr /*parent_window*/, ContextualNudge::Position::kTop, gfx::Insets(), l10n_util::GetStringUTF16(IDS_ASH_DRAG_HANDLE_NUDGE), - AshColorProvider::Get()->GetContentLayerColor( - AshColorProvider::ContentLayerType::kTextColorPrimary), base::BindRepeating(&DragHandle::HandleTapOnNudge, weak_factory_.GetWeakPtr())); drag_handle_nudge_->GetWidget()->Show();
diff --git a/ash/shelf/home_to_overview_nudge_controller.cc b/ash/shelf/home_to_overview_nudge_controller.cc index 8c809b41..bdf3808 100644 --- a/ash/shelf/home_to_overview_nudge_controller.cc +++ b/ash/shelf/home_to_overview_nudge_controller.cc
@@ -203,8 +203,6 @@ nullptr, hotseat_widget_->GetNativeWindow()->parent(), ContextualNudge::Position::kBottom, gfx::Insets(kNudgeMargins), l10n_util::GetStringUTF16(IDS_ASH_HOME_TO_OVERVIEW_CONTEXTUAL_NUDGE), - AshColorProvider::Get()->GetContentLayerColor( - AshColorProvider::ContentLayerType::kTextColorPrimary), base::BindRepeating(&HomeToOverviewNudgeController::HandleNudgeTap, weak_factory_.GetWeakPtr()));
diff --git a/ash/system/holding_space/holding_space_tray_unittest.cc b/ash/system/holding_space/holding_space_tray_unittest.cc index 99c5d0b..f190197 100644 --- a/ash/system/holding_space/holding_space_tray_unittest.cc +++ b/ash/system/holding_space/holding_space_tray_unittest.cc
@@ -528,7 +528,7 @@ scoped_feature_list_.InitWithFeatureState( features::kHoldingSpacePredictability, IsHoldingSpacePredictabilityEnabled()); - }; + } bool IsHoldingSpacePredictabilityEnabled() const { return GetParam(); }
diff --git a/ash/system/keyboard_brightness/keyboard_backlight_color_nudge_controller.cc b/ash/system/keyboard_brightness/keyboard_backlight_color_nudge_controller.cc index 46fe76e..8d2a398 100644 --- a/ash/system/keyboard_brightness/keyboard_backlight_color_nudge_controller.cc +++ b/ash/system/keyboard_brightness/keyboard_backlight_color_nudge_controller.cc
@@ -78,8 +78,6 @@ IDS_ASH_KEYBOARD_BACKLIGHT_COLOR_EDUCATION_NUDGE_TEXT, l10n_util::GetStringUTF16( IDS_PERSONALIZATION_APP_PERSONALIZATION_HUB_TITLE)), - AshColorProvider::Get()->GetContentLayerColor( - AshColorProvider::ContentLayerType::kTextColorPrimary), base::BindRepeating( &KeyboardBacklightColorNudgeController::CloseEducationNudge, weak_factory_.GetWeakPtr()));
diff --git a/ash/system/network/fake_network_detailed_network_view.cc b/ash/system/network/fake_network_detailed_network_view.cc index 24f373b6..b00d34c 100644 --- a/ash/system/network/fake_network_detailed_network_view.cc +++ b/ash/system/network/fake_network_detailed_network_view.cc
@@ -28,7 +28,7 @@ views::View* FakeNetworkDetailedNetworkView::network_list() { return network_list_.get(); -}; +} views::View* FakeNetworkDetailedNetworkView::GetAsView() { return this; @@ -42,7 +42,7 @@ FakeNetworkDetailedNetworkView::AddNetworkListItem() { return network_list_->AddChildView( new NetworkListNetworkItemView(/*listener=*/nullptr)); -}; +} NetworkListWifiHeaderView* FakeNetworkDetailedNetworkView::AddWifiSectionHeader() { @@ -53,7 +53,7 @@ kWifiSectionHeader)); return network_list_->AddChildView(std::move(wifi_header_view)); -}; +} NetworkListMobileHeaderView* FakeNetworkDetailedNetworkView::AddMobileSectionHeader() { @@ -68,6 +68,6 @@ void FakeNetworkDetailedNetworkView::UpdateScanningBarVisibility(bool visible) { last_scan_bar_visibility_ = visible; -}; +} -} // namespace ash \ No newline at end of file +} // namespace ash
diff --git a/ash/system/notification_center/notification_center_tray.cc b/ash/system/notification_center/notification_center_tray.cc index 4b8027b..7a61cdc 100644 --- a/ash/system/notification_center/notification_center_tray.cc +++ b/ash/system/notification_center/notification_center_tray.cc
@@ -11,8 +11,6 @@ #include "ash/system/tray/tray_bubble_view.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/metadata/metadata_impl_macros.h" -#include "ui/message_center/message_center.h" -#include "ui/message_center/message_center_types.h" #include "ui/views/layout/flex_layout.h" namespace ash { @@ -20,18 +18,10 @@ NotificationCenterTray::NotificationCenterTray(Shelf* shelf) : TrayBackgroundView(shelf, RoundedCornerBehavior::kStartRounded) { SetLayoutManager(std::make_unique<views::FlexLayout>()); - message_center_observation_.Observe(message_center::MessageCenter::Get()); - set_use_bounce_in_animation(false); } NotificationCenterTray::~NotificationCenterTray() = default; -void NotificationCenterTray::UpdateAfterSystemTrayVisibilityChanged( - bool system_tray_visible) { - system_tray_visibile_ = system_tray_visible; - UpdateVisibility(); -} - std::u16string NotificationCenterTray::GetAccessibleNameForTray() { return std::u16string(); } @@ -49,9 +39,7 @@ void NotificationCenterTray::ShowBubble() {} -void NotificationCenterTray::UpdateAfterLoginStatusChange() { - UpdateVisibility(); -} +void NotificationCenterTray::UpdateAfterLoginStatusChange() {} TrayBubbleView* NotificationCenterTray::GetBubbleView() { return nullptr; @@ -61,38 +49,6 @@ return nullptr; } -void NotificationCenterTray::OnNotificationAdded( - const std::string& notification_id) { - UpdateVisibility(); -} - -void NotificationCenterTray::OnNotificationDisplayed( - const std::string& notification_id, - const message_center::DisplaySource source) { - UpdateVisibility(); -} - -void NotificationCenterTray::OnNotificationRemoved( - const std::string& notification_id, - bool by_user) { - UpdateVisibility(); -} - -void NotificationCenterTray::OnNotificationUpdated( - const std::string& notification_id) { - UpdateVisibility(); -} - -void NotificationCenterTray::UpdateVisibility() { - const bool new_visibility = - message_center::MessageCenter::Get()->NotificationCount() > 0 && - system_tray_visibile_; - if (new_visibility == visible_preferred()) - return; - - SetVisiblePreferred(new_visibility); -} - BEGIN_METADATA(NotificationCenterTray, TrayBackgroundView) END_METADATA
diff --git a/ash/system/notification_center/notification_center_tray.h b/ash/system/notification_center/notification_center_tray.h index 777d9f4..336cf6a69 100644 --- a/ash/system/notification_center/notification_center_tray.h +++ b/ash/system/notification_center/notification_center_tray.h
@@ -5,16 +5,10 @@ #ifndef ASH_SYSTEM_NOTIFICATION_CENTER_NOTIFICATION_CENTER_TRAY_H_ #define ASH_SYSTEM_NOTIFICATION_CENTER_NOTIFICATION_CENTER_TRAY_H_ -#include <string> - #include "ash/ash_export.h" #include "ash/system/tray/tray_background_view.h" #include "ash/system/unified/notification_icons_controller.h" -#include "base/scoped_observation.h" #include "ui/base/metadata/metadata_header_macros.h" -#include "ui/message_center/message_center.h" -#include "ui/message_center/message_center_observer.h" -#include "ui/message_center/message_center_types.h" namespace views { class Widget; @@ -28,9 +22,7 @@ // A button in the tray which displays the number of currently available // notifications along with icons for pinned notifications. Clicking this button // opens a bubble with a scrollable list of all current notifications. -class ASH_EXPORT NotificationCenterTray - : public TrayBackgroundView, - public message_center::MessageCenterObserver { +class ASH_EXPORT NotificationCenterTray : public TrayBackgroundView { public: METADATA_HEADER(NotificationCenterTray); @@ -39,8 +31,6 @@ NotificationCenterTray& operator=(const NotificationCenterTray&) = delete; ~NotificationCenterTray() override; - void UpdateAfterSystemTrayVisibilityChanged(bool system_tray_visible); - // TrayBackgroundView: std::u16string GetAccessibleNameForTray() override; void HandleLocaleChange() override; @@ -53,34 +43,11 @@ views::Widget* GetBubbleWidget() const override; private: - // message_center::MessageCenterObserver: - void OnNotificationAdded(const std::string& notification_id) override; - void OnNotificationDisplayed( - const std::string& notification_id, - const message_center::DisplaySource source) override; - void OnNotificationRemoved(const std::string& notification_id, - bool by_user) override; - void OnNotificationUpdated(const std::string& notification_id) override; - - // Update the visibility of the tray button based on available notifications. - // If there are no notifications the tray button should be hidden and shown - // otherwise. - void UpdateVisibility(); - // Manages showing notification icons in the tray. const std::unique_ptr<NotificationIconsController> notification_icons_controller_; // TODO(1311738): Add NotificationCenterBubble. - - // The notification center tray can only be shown along side the system and - // date tray. This flag keeps track of the system tray's visibility being set - // by the status area widget. - bool system_tray_visibile_ = true; - - base::ScopedObservation<message_center::MessageCenter, - class message_center::MessageCenterObserver> - message_center_observation_{this}; }; } // namespace ash
diff --git a/ash/system/notification_center/notification_center_tray_unittest.cc b/ash/system/notification_center/notification_center_tray_unittest.cc deleted file mode 100644 index 7d38bf92..0000000 --- a/ash/system/notification_center/notification_center_tray_unittest.cc +++ /dev/null
@@ -1,83 +0,0 @@ -// Copyright 2022 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 "ash/system/notification_center/notification_center_tray.h" - -#include "ash/constants/ash_features.h" -#include "ash/system/status_area_widget.h" -#include "ash/system/status_area_widget_test_helper.h" -#include "ash/test/ash_test_base.h" -#include "base/test/scoped_feature_list.h" -#include "ui/message_center/message_center.h" -#include "ui/message_center/public/cpp/notification.h" - -namespace ash { - -class NotificationCenterTrayTest : public AshTestBase { - public: - NotificationCenterTrayTest() = default; - NotificationCenterTrayTest(const NotificationCenterTrayTest&) = delete; - NotificationCenterTrayTest& operator=(const NotificationCenterTrayTest&) = - delete; - ~NotificationCenterTrayTest() override = default; - - void SetUp() override { - // Enable quick settings revamp feature. - scoped_feature_list_.InitWithFeatures({ash::features::kQsRevamp}, {}); - - AshTestBase::SetUp(); - - notification_tray_ = StatusAreaWidgetTestHelper::GetStatusAreaWidget() - ->notification_center_tray(); - } - - void TearDown() override { - notification_tray_ = nullptr; - AshTestBase::TearDown(); - } - - std::unique_ptr<message_center::Notification> CreateNotification( - const std::string& id, - const std::string& title = "test_title") { - return std::make_unique<message_center::Notification>( - message_center::NOTIFICATION_TYPE_SIMPLE, id, base::UTF8ToUTF16(title), - u"test message", ui::ImageModel(), - std::u16string() /* display_source */, GURL(), - message_center::NotifierId(), message_center::RichNotificationData(), - new message_center::NotificationDelegate()); - } - - std::string AddNotification() { - std::string id = base::NumberToString(id_++); - message_center::MessageCenter::Get()->AddNotification( - CreateNotification(id)); - return id; - } - - NotificationCenterTray* GetNotificationCenterTray() { - return notification_tray_; - } - - private: - int id_ = 0; - - base::test::ScopedFeatureList scoped_feature_list_; - - // Owned by `StatusAreaWidget`. - NotificationCenterTray* notification_tray_ = nullptr; -}; - -// Test the initial state. -TEST_F(NotificationCenterTrayTest, VisibilityBasedOnAvailableNotifications) { - EXPECT_FALSE(GetNotificationCenterTray()->GetVisible()); - - std::string id = AddNotification(); - EXPECT_TRUE(GetNotificationCenterTray()->GetVisible()); - - message_center::MessageCenter::Get()->RemoveNotification(id, true); - - EXPECT_FALSE(GetNotificationCenterTray()->GetVisible()); -} - -} // namespace ash
diff --git a/ash/system/status_area_widget.cc b/ash/system/status_area_widget.cc index 755777b..45b9625 100644 --- a/ash/system/status_area_widget.cc +++ b/ash/system/status_area_widget.cc
@@ -4,9 +4,6 @@ #include "ash/system/status_area_widget.h" -#include <memory> -#include <string> - #include "ash/capture_mode/stop_recording_button_tray.h" #include "ash/constants/ash_features.h" #include "ash/constants/ash_switches.h" @@ -26,7 +23,6 @@ #include "ash/system/media/media_tray.h" #include "ash/system/model/clock_model.h" #include "ash/system/model/system_tray_model.h" -#include "ash/system/notification_center/notification_center_tray.h" #include "ash/system/overview/overview_button_tray.h" #include "ash/system/palette/palette_tray.h" #include "ash/system/phonehub/phone_hub_tray.h" @@ -49,8 +45,6 @@ #include "ui/compositor/layer.h" #include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/display/display.h" -#include "ui/message_center/message_center.h" -#include "ui/message_center/message_center_types.h" namespace ash { @@ -142,12 +136,6 @@ phone_hub_tray_ = AddTrayButton(std::make_unique<PhoneHubTray>(shelf_)); } - if (chromeos::features::IsQsRevampEnabled()) { - notification_center_tray_ = - AddTrayButton(std::make_unique<NotificationCenterTray>(shelf_)); - notification_tray_view_observer_.Observe(notification_center_tray_); - } - auto unified_system_tray = std::make_unique<UnifiedSystemTray>(shelf_); unified_system_tray_ = unified_system_tray.get(); if (features::IsCalendarViewEnabled()) { @@ -209,9 +197,6 @@ tray->SetVisiblePreferred(visible); if (features::IsCalendarViewEnabled()) date_tray_->SetVisiblePreferred(visible); - - if (features::IsQsRevampEnabled() && notification_center_tray_) - notification_center_tray_->UpdateAfterSystemTrayVisibilityChanged(visible); if (visible) { Show(); } else { @@ -253,7 +238,6 @@ if (tray_button == overflow_button_tray_ || tray_button == overview_button_tray_ || tray_button == unified_system_tray_ || tray_button == date_tray_ || - tray_button == notification_center_tray_ || !tray_button->GetVisible()) { continue; } @@ -589,14 +573,6 @@ return true; } -void StatusAreaWidget::OnViewVisibilityChanged(views::View* observed_view, - views::View* starting_view) { - if (observed_view != notification_center_tray_) - return; - - UpdateDateTrayRoundedCorners(); -} - void StatusAreaWidget::OnMouseEvent(ui::MouseEvent* event) { if (event->IsMouseWheelEvent()) { ui::MouseWheelEvent* mouse_wheel_event = event->AsMouseWheelEvent(); @@ -672,16 +648,6 @@ child_visibility_bitmask, should_animate}; } -void StatusAreaWidget::UpdateDateTrayRoundedCorners() { - if (!features::IsQsRevampEnabled() || !date_tray_) - return; - - date_tray_->SetRoundedCornerBehavior( - notification_center_tray_->GetVisible() - ? TrayBackgroundView::RoundedCornerBehavior::kNotRounded - : TrayBackgroundView::RoundedCornerBehavior::kStartRounded); -} - int StatusAreaWidget::GetCollapseAvailableWidth(bool force_collapsible) const { const int shelf_width = shelf_->shelf_widget()->GetClientAreaBoundsInScreen().width();
diff --git a/ash/system/status_area_widget.h b/ash/system/status_area_widget.h index 6fadb73..966c36e8 100644 --- a/ash/system/status_area_widget.h +++ b/ash/system/status_area_widget.h
@@ -11,10 +11,6 @@ #include "ash/public/cpp/shelf_types.h" #include "ash/shelf/shelf_component.h" #include "base/memory/weak_ptr.h" -#include "base/scoped_observation.h" -#include "ui/message_center/message_center.h" -#include "ui/message_center/message_center_observer.h" -#include "ui/views/view_observer.h" #include "ui/views/widget/widget.h" namespace aura { @@ -28,7 +24,6 @@ class ImeMenuTray; class LogoutButtonTray; class MediaTray; -class NotificationCenterTray; class OverviewButtonTray; class PaletteTray; class PhoneHubTray; @@ -49,7 +44,6 @@ // on secondary monitors at the login screen). class ASH_EXPORT StatusAreaWidget : public SessionObserver, public ShelfComponent, - public views::ViewObserver, public views::Widget { public: // Whether the status area is collapsed or expanded. Currently, this is only @@ -129,9 +123,6 @@ return status_area_widget_delegate_; } UnifiedSystemTray* unified_system_tray() { return unified_system_tray_; } - NotificationCenterTray* notification_center_tray() { - return notification_center_tray_; - } DateTray* date_tray() { return date_tray_; } DictationButtonTray* dictation_button_tray() { return dictation_button_tray_; @@ -223,10 +214,6 @@ // changed. absl::optional<LayoutInputs> layout_inputs_; - // views::ViewObserver: - void OnViewVisibilityChanged(views::View* observed_view, - views::View* starting_view) override; - // views::Widget: void OnMouseEvent(ui::MouseEvent* event) override; void OnGestureEvent(ui::GestureEvent* event) override; @@ -253,10 +240,6 @@ // current conditions. CollapseState CalculateCollapseState() const; - // Update rounded corners for the date tray. The corner behavior for date - // tray depends on the visibility of the notification center tray. - void UpdateDateTrayRoundedCorners(); - // Gets the collapse available width based on if the date tray is shown. // If `force_collapsible`, returns a fixed width which is not based on the // shelf width. @@ -268,7 +251,6 @@ OverviewButtonTray* overview_button_tray_ = nullptr; DictationButtonTray* dictation_button_tray_ = nullptr; MediaTray* media_tray_ = nullptr; - NotificationCenterTray* notification_center_tray_ = nullptr; DateTray* date_tray_ = nullptr; UnifiedSystemTray* unified_system_tray_ = nullptr; LogoutButtonTray* logout_button_tray_ = nullptr; @@ -300,9 +282,6 @@ // lives. int tray_bubble_count_ = 0; - base::ScopedObservation<views::View, views::ViewObserver> - notification_tray_view_observer_{this}; - base::WeakPtrFactory<StatusAreaWidget> weak_ptr_factory_{this}; };
diff --git a/ash/system/status_area_widget_delegate.cc b/ash/system/status_area_widget_delegate.cc index e9636db3..d0fd9e04 100644 --- a/ash/system/status_area_widget_delegate.cc +++ b/ash/system/status_area_widget_delegate.cc
@@ -13,7 +13,6 @@ #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" -#include "ash/system/notification_center/notification_center_tray.h" #include "ash/system/status_area_widget.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/unified/date_tray.h" @@ -34,7 +33,7 @@ namespace { constexpr int kPaddingBetweenItems = 8; -constexpr int kSystemTraysRightPaddingOffset = -4; +constexpr int kPaddingOffsetBetweenDateAndSystemTray = -4; class StatusAreaWidgetDelegateAnimationSettings : public ui::ScopedLayerAnimationSettings { @@ -261,14 +260,11 @@ // is enabled). int right_edge = kPaddingBetweenItems; - // TODO(crbug/1354354): Refactor this hack to make it more efficient and less - // of a hack. - // If this view is `DateTray` or `NotificationCenterTray`, apply - // the offset `kSystemTraysRightPaddingOffset` between it and the tray on it's - // right. - if (child->GetClassName() == DateTray::kViewClassName || - child->GetClassName() == NotificationCenterTray::kViewClassName) { - right_edge += kSystemTraysRightPaddingOffset; + // If this view is `DateTray`, apply the offset + // `kPaddingOffsetBetweenDateAndSystemTray` between it and + // `UnifiedSystemTray`. + if (child->GetClassName() == DateTray::kViewClassName) { + right_edge += kPaddingOffsetBetweenDateAndSystemTray; } if (is_child_on_edge) {
diff --git a/ash/system/status_area_widget_unittest.cc b/ash/system/status_area_widget_unittest.cc index 53c9f8e..cc46cac 100644 --- a/ash/system/status_area_widget_unittest.cc +++ b/ash/system/status_area_widget_unittest.cc
@@ -6,7 +6,6 @@ #include <memory> -#include "ash/constants/ash_features.h" #include "ash/constants/ash_switches.h" #include "ash/focus_cycler.h" #include "ash/ime/ime_controller_impl.h" @@ -24,20 +23,17 @@ #include "ash/system/ime_menu/ime_menu_tray.h" #include "ash/system/model/system_tray_model.h" #include "ash/system/model/virtual_keyboard_model.h" -#include "ash/system/notification_center/notification_center_tray.h" #include "ash/system/overview/overview_button_tray.h" #include "ash/system/palette/palette_tray.h" #include "ash/system/session/logout_button_tray.h" #include "ash/system/status_area_widget_test_helper.h" #include "ash/system/tray/status_area_overflow_button_tray.h" #include "ash/system/tray/system_tray_notifier.h" -#include "ash/system/unified/date_tray.h" #include "ash/system/unified/unified_system_tray.h" #include "ash/system/virtual_keyboard/virtual_keyboard_tray.h" #include "ash/test/ash_test_base.h" #include "base/callback_helpers.h" #include "base/command_line.h" -#include "base/test/scoped_feature_list.h" #include "chromeos/ash/components/network/cellular_metrics_logger.h" #include "chromeos/ash/components/network/network_handler.h" #include "chromeos/ash/components/network/network_handler_test_helper.h" @@ -631,45 +627,4 @@ EXPECT_FALSE(overflow_button_->GetVisible()); } -class StatusAreaWidgetQSRevampTest : public AshTestBase { - protected: - void SetUp() override { - scoped_feature_list_.InitWithFeatures({ash::features::kQsRevamp}, {}); - AshTestBase::SetUp(); - } - - TrayBackgroundView::RoundedCornerBehavior GetTrayCornerBehavior( - TrayBackgroundView* tray) { - return tray->corner_behavior_; - } - - private: - base::test::ScopedFeatureList scoped_feature_list_; -}; - -// The corner radius of the date tray changes based on the visibility of the -// `NotificationCenterTray`. The date tray should have rounded corners on the -// left if the `NotificationCenterTray` is not visible and no rounded corners -// otherwise. -TEST_F(StatusAreaWidgetQSRevampTest, DateTrayRoundedCornerBehavior) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature(features::kQsRevamp); - - StatusAreaWidget* status_area = - StatusAreaWidgetTestHelper::GetStatusAreaWidget(); - EXPECT_FALSE(status_area->notification_center_tray()->GetVisible()); - EXPECT_EQ(GetTrayCornerBehavior(status_area->date_tray()), - TrayBackgroundView::RoundedCornerBehavior::kStartRounded); - - status_area->notification_center_tray()->SetVisiblePreferred(true); - - EXPECT_EQ(GetTrayCornerBehavior(status_area->date_tray()), - TrayBackgroundView::RoundedCornerBehavior::kNotRounded); - - status_area->notification_center_tray()->SetVisiblePreferred(false); - - EXPECT_EQ(GetTrayCornerBehavior(status_area->date_tray()), - TrayBackgroundView::RoundedCornerBehavior::kStartRounded); -} - } // namespace ash
diff --git a/ash/system/tray/tray_background_view.h b/ash/system/tray/tray_background_view.h index 38f54fa8..4d0894f 100644 --- a/ash/system/tray/tray_background_view.h +++ b/ash/system/tray/tray_background_view.h
@@ -219,7 +219,6 @@ private: class TrayWidgetObserver; class TrayBackgroundViewSessionChangeHandler; - friend class StatusAreaWidgetQSRevampTest; void StartVisibilityAnimation(bool visible);
diff --git a/ash/webui/BUILD.gn b/ash/webui/BUILD.gn index 14e6b98..594e7412 100644 --- a/ash/webui/BUILD.gn +++ b/ash/webui/BUILD.gn
@@ -77,7 +77,6 @@ "//ash/webui/media_app_ui:closure_compile", "//ash/webui/multidevice_debug/resources:closure_compile", "//ash/webui/os_feedback_ui:closure_compile", - "//ash/webui/print_management:closure_compile", "//ash/webui/projector_app/resources:closure_compile", "//ash/webui/scanning:closure_compile", "//ash/webui/shimless_rma:closure_compile",
diff --git a/ash/webui/common/resources/BUILD.gn b/ash/webui/common/resources/BUILD.gn index ceaf9c3..48676d1 100644 --- a/ash/webui/common/resources/BUILD.gn +++ b/ash/webui/common/resources/BUILD.gn
@@ -113,11 +113,9 @@ generate_definitions_js_files = [ "cr_picture/cr_camera.html.js", - "cr_picture/cr_camera.js", "cr_picture/cr_picture_list.html.js", "cr_picture/cr_picture_list.js", "cr_picture/cr_picture_pane.html.js", - "cr_picture/cr_picture_pane.js", "cr_picture/cr_picture_types.js", "cr_picture/icons.html.js", "cr_picture/png.js", @@ -129,6 +127,7 @@ out_dir = "$target_gen_dir/$preprocessed_dir" js_files = generate_definitions_js_files extra_deps = [ + ":copy_checked_in_dts_files", ":css_wrapper_files", ":html_wrapper_files", ":preprocess", @@ -137,6 +136,8 @@ } checked_in_dts_files = [ + "cr_picture/cr_camera.d.ts", + "cr_picture/cr_picture_pane.d.ts", "fake_method_resolver.d.ts", "page_toolbar.d.ts", "navigation_view_panel.d.ts",
diff --git a/ash/webui/common/resources/cr_picture/cr_camera.d.ts b/ash/webui/common/resources/cr_picture/cr_camera.d.ts new file mode 100644 index 0000000..a44adb22 --- /dev/null +++ b/ash/webui/common/resources/cr_picture/cr_camera.d.ts
@@ -0,0 +1,13 @@ +// Copyright 2021 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. + +interface CrCameraElement extends HTMLElement {} + +export {CrCameraElement}; + +declare global { + interface HTMLElementTagNameMap { + 'cr-camera': CrCameraElement; + } +}
diff --git a/ash/webui/common/resources/cr_picture/cr_picture_pane.d.ts b/ash/webui/common/resources/cr_picture/cr_picture_pane.d.ts new file mode 100644 index 0000000..a8a14bc --- /dev/null +++ b/ash/webui/common/resources/cr_picture/cr_picture_pane.d.ts
@@ -0,0 +1,13 @@ +// Copyright 2021 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. + +interface CrPicturePaneElement extends HTMLElement {} + +export {CrPicturePaneElement}; + +declare global { + interface HTMLElementTagNameMap { + 'cr-picture-pane': CrPicturePaneElement; + } +}
diff --git a/ash/webui/personalization_app/resources/js/user/avatar_list_element.ts b/ash/webui/personalization_app/resources/js/user/avatar_list_element.ts index d99d275f..64bdc33 100644 --- a/ash/webui/personalization_app/resources/js/user/avatar_list_element.ts +++ b/ash/webui/personalization_app/resources/js/user/avatar_list_element.ts
@@ -56,6 +56,10 @@ typeof (option as DefaultOption).defaultImageIndex === 'number'; } +function camelToKebab(className: string): string { + return className.replace(/[A-Z]/g, m => '-' + m.toLowerCase()); +} + export class AvatarList extends WithPersonalizationStore { static get is() { return 'avatar-list'; @@ -348,15 +352,11 @@ } } - private camelToKebab_(className: string): string { - return className.replace(/[A-Z]/g, m => '-' + m.toLowerCase()); - } - private getOptionInnerContainerClass_(option: Option, image: UserImage|null): string { const defaultClass = option ? option.class : 'image-container'; return this.getAriaSelected_(option, image) === 'true' ? - `${defaultClass} tast-selected-${this.camelToKebab_(option.id)}` : + `${defaultClass} tast-selected-${camelToKebab(option.id)}` : defaultClass; } }
diff --git a/ash/webui/personalization_app/resources/js/user/user_selectors.ts b/ash/webui/personalization_app/resources/js/user/user_selectors.ts index 39dafc2a..8155b7a0 100644 --- a/ash/webui/personalization_app/resources/js/user/user_selectors.ts +++ b/ash/webui/personalization_app/resources/js/user/user_selectors.ts
@@ -63,9 +63,12 @@ */ export function selectUserImageUrl(state: PersonalizationState): Url|null { const userImage = state.user.image; + const placeHolderUrl = { + url: 'chrome://theme/IDR_PROFILE_AVATAR_PLACEHOLDER_LARGE', + }; if (!userImage) { - return null; + return placeHolderUrl; } // Generated types for |userImage| are incorrect for mojom unions. Only one @@ -73,10 +76,9 @@ // to do exhaustiveness checking in the switch/case. assert(Object.keys(userImage).length === 1, 'only one key is set'); const key = Object.keys(userImage)[0] as keyof UserImage; - switch (key) { case 'invalidImage': - return null; + return placeHolderUrl; case 'defaultImage': return userImage.defaultImage!.url; case 'profileImage': @@ -85,7 +87,7 @@ return bufferToPngObjectUrl(userImage.externalImage!); default: console.error('Unknown image type received', key); - return null; + return placeHolderUrl; } }
diff --git a/ash/webui/print_management/.gitignore b/ash/webui/print_management/.gitignore new file mode 100644 index 0000000..79f93fdd --- /dev/null +++ b/ash/webui/print_management/.gitignore
@@ -0,0 +1,2 @@ +# Generated from ash/webui/personalization_app/tools/gen_tsconfig.py +tsconfig.json \ No newline at end of file
diff --git a/ash/webui/print_management/BUILD.gn b/ash/webui/print_management/BUILD.gn index d5a07112..131eabd 100644 --- a/ash/webui/print_management/BUILD.gn +++ b/ash/webui/print_management/BUILD.gn
@@ -25,7 +25,3 @@ "//ui/webui", ] } - -group("closure_compile") { - deps = [ "resources:closure_compile_module" ] -}
diff --git a/ash/webui/print_management/print_management_ui.cc b/ash/webui/print_management/print_management_ui.cc index 997d0e3..4b98b5d5 100644 --- a/ash/webui/print_management/print_management_ui.cc +++ b/ash/webui/print_management/print_management_ui.cc
@@ -121,10 +121,12 @@ const auto resources = base::make_span(kAshPrintManagementResources, kAshPrintManagementResourcesSize); - SetUpWebUIDataSource(html_source, resources, IDR_PRINT_MANAGEMENT_INDEX_HTML); + SetUpWebUIDataSource(html_source, resources, + IDR_ASH_PRINT_MANAGEMENT_INDEX_HTML); - html_source->AddResourcePath("printing_manager.mojom-webui.js", - IDR_PRINTING_MANAGER_MOJO_WEBUI_JS); + html_source->AddResourcePath( + "printing_manager.mojom-webui.js", + IDR_ASH_PRINT_MANAGEMENT_PRINTING_MANAGER_MOJOM_WEBUI_JS); AddPrintManagementStrings(html_source); }
diff --git a/ash/webui/print_management/resources/BUILD.gn b/ash/webui/print_management/resources/BUILD.gn index c2683902..ab16c582 100644 --- a/ash/webui/print_management/resources/BUILD.gn +++ b/ash/webui/print_management/resources/BUILD.gn
@@ -3,91 +3,141 @@ # found in the LICENSE file. import("//build/config/chromeos/ui_mode.gni") -import("//third_party/closure_compiler/compile_js.gni") import("//tools/grit/grit_rule.gni") -import("//tools/grit/repack.gni") -import("//tools/polymer/html_to_js.gni") +import("//tools/grit/preprocess_if_expr.gni") +import("//tools/polymer/css_to_wrapper.gni") +import("//tools/polymer/html_to_wrapper.gni") +import("//tools/typescript/ts_library.gni") +import("//ui/webui/resources/tools/generate_grd.gni") assert(is_chromeos_ash) -js_type_check("closure_compile_module") { - is_polymer3 = true - closure_flags = - default_closure_args + mojom_js_args + [ - "js_module_root=" + rebase_path(".", root_build_dir), - "js_module_root=" + rebase_path( - "$root_gen_dir/mojom-webui/ash/webui/print_management/mojom/", - root_build_dir), - ] +# The directory where most files will be processed into, +# and where ts_library inputs from. +preprocess_folder = "preprocessed" + +# The directory where HTML and CSS files will be processed into. +# Ultimately, files in this directory will be processed into $preprocess_folder. +html_css_preprocess_folder = "preprocessed_html_css_wrapper_files" + +# When adding a new file to this app, add it to one of the lists below. +# `non_web_component_files` are plain TS and JS files. +# `web_component_files` are Polymer based TS and JS files. +# `css_files` are CSS files that are Polymer shared style modules. +# `static_resource_files` are static files that don't need +# to be processed, e.g. images + +non_web_component_files = [ "mojo_interface_provider.ts" ] + +web_component_files = [ + "print_job_clear_history_dialog.ts", + "print_job_entry.ts", + "print_management.ts", +] + +static_resource_files = [ + "index.html", + "print_management_192.png", +] + +# Files that are passed as input to css_to_wrapper(). +css_files = [ + "print_management_fonts.css", + "print_management_shared.css", +] + +# Files that are generated by css_to_wrapper(). +css_to_wrapper_output_files = [] +foreach(f, css_files) { + # e.g. colors.css -> colors.css.ts + css_to_wrapper_output_files += [ f + ".ts" ] +} + +# Process raw CSS files into wrapped files suitable for importing into TS. +css_to_wrapper("css_to_wrapper_files") { + in_files = css_files + in_folder = "." + out_folder = "$target_gen_dir/$html_css_preprocess_folder" +} + +# Files that are passed as input to html_to_wrapper(). +html_files = [] +foreach(f, web_component_files) { + # e.g. my_element.ts -> my_element.html + html_files += [ string_replace(f, ".ts", ".html") ] +} + +all_html_files = html_files + [ "icons.html" ] + +# Files that are generated by html_to_wrapper(). +html_to_wrapper_output_files = [] +foreach(f, all_html_files) { + # e.g. my_element.html -> my_element.html.ts + html_to_wrapper_output_files += [ f + ".ts" ] +} + +# Process raw HTML files into wrapped files suitable for importing into TS. +html_to_wrapper("html_to_wrapper_files") { + in_files = all_html_files + in_folder = "." + out_folder = "$target_gen_dir/$html_css_preprocess_folder" +} + +ts_files = non_web_component_files + web_component_files + +# This target is meant to process "if expressions" (e.g. <if expr="cond">...</if>). +# In practice, the following two targets just copy files into the $preprocess_folder. +preprocess_if_expr("preprocess") { + in_files = ts_files + in_folder = "." + out_folder = "$target_gen_dir/$preprocess_folder" +} + +preprocess_if_expr("preprocess_html_css") { deps = [ - ":mojo_interface_provider", - ":print_job_clear_history_dialog", - ":print_job_entry", - ":print_management", + ":css_to_wrapper_files", + ":html_to_wrapper_files", ] + in_files = html_to_wrapper_output_files + css_to_wrapper_output_files + in_folder = "$target_gen_dir/$html_css_preprocess_folder" + out_folder = "$target_gen_dir/$preprocess_folder" } -js_library("icons") { - deps = [ - "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - ] -} - -js_library("print_job_entry") { - deps = [ - ":icons", - "//ash/webui/print_management/mojom:mojom_webui_js", - "//third_party/polymer/v3_0/components-chromium/iron-a11y-announcer:iron-a11y-announcer", - "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/js:i18n_behavior.m", - "//ui/webui/resources/js:load_time_data.m", - "//ui/webui/resources/js/cr/ui:focus_row_behavior.m", - ] -} - -js_library("print_management") { - deps = [ - ":mojo_interface_provider", - ":print_job_clear_history_dialog", - ":print_job_entry", - "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_button:cr_button", - "//ui/webui/resources/cr_elements/policy:cr_policy_indicator", - "//ui/webui/resources/js:i18n_behavior.m", - "//ui/webui/resources/js:load_time_data.m", - ] -} - -js_library("print_job_clear_history_dialog") { - deps = [ - ":mojo_interface_provider", - "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_button:cr_button", - "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", - "//ui/webui/resources/js:i18n_behavior.m", - ] -} - -js_library("mojo_interface_provider") { - deps = [ - "//ash/webui/print_management/mojom:mojom_webui_js", - "//ui/webui/resources/js:cr.m", - ] -} - -html_to_js("web_components") { - js_files = [ - "icons.js", - "print_job_clear_history_dialog.js", - "print_job_entry.js", - "print_management_fonts_css.js", - "print_management.js", - "print_management_shared_css.js", - ] -} - +# The WebUI mojo files are generated by mojom:mojom_webui_js into an +# external directory, so they need to be copied into this project's directory. copy("copy_webui_mojo") { deps = [ "../mojom:mojom_webui_js" ] sources = [ "$root_gen_dir/mojom-webui/ash/webui/print_management/mojom/printing_manager.mojom-webui.js" ] - outputs = [ "$target_gen_dir/{{source_file_part}}" ] + outputs = [ "$target_gen_dir/$preprocess_folder/{{source_file_part}}" ] +} + +ts_library("build_ts") { + root_dir = "$target_gen_dir/$preprocess_folder" + out_dir = "$target_gen_dir/tsc" + tsconfig_base = "tsconfig_base.json" + in_files = ts_files + html_to_wrapper_output_files + + css_to_wrapper_output_files + [ "printing_manager.mojom-webui.js" ] + definitions = [] + deps = [ + "//third_party/polymer/v3_0:library", + "//ui/webui/resources:library", + ] + extra_deps = [ + ":copy_webui_mojo", + ":preprocess", + ":preprocess_html_css", + ] +} + +generate_grd("build_grd") { + input_files_base_dir = rebase_path(".", "//") + input_files = static_resource_files + + deps = [ ":build_ts" ] + + manifest_files = + filter_include(get_target_outputs(":build_ts"), [ "*.manifest" ]) + + grd_prefix = "ash_print_management" + out_grd = "$target_gen_dir/${grd_prefix}_resources.grd" }
diff --git a/ash/webui/print_management/resources/icons.js b/ash/webui/print_management/resources/icons.js deleted file mode 100644 index 48b4382..0000000 --- a/ash/webui/print_management/resources/icons.js +++ /dev/null
@@ -1,10 +0,0 @@ -// Copyright 2020 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. - -import 'chrome://resources/polymer/v3_0/iron-iconset-svg/iron-iconset-svg.js'; - -import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; - -const template = html`{__html_template__}`; -document.head.appendChild(template.content); \ No newline at end of file
diff --git a/ash/webui/print_management/resources/mojo_interface_provider.js b/ash/webui/print_management/resources/mojo_interface_provider.js deleted file mode 100644 index ab8e5dc..0000000 --- a/ash/webui/print_management/resources/mojo_interface_provider.js +++ /dev/null
@@ -1,28 +0,0 @@ -// Copyright 2020 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. - -import {PrintingMetadataProvider, PrintingMetadataProviderInterface} from './printing_manager.mojom-webui.js'; - -/** - * @type {?PrintingMetadataProviderInterface} - */ -let metadataProvider = null; - -/** - * @param {!PrintingMetadataProviderInterface} testProvider - */ -export function setMetadataProviderForTesting(testProvider) { - metadataProvider = testProvider; -} - -/** - * @return {!PrintingMetadataProviderInterface} - */ -export function getMetadataProvider() { - if (metadataProvider) { - return metadataProvider; - } - metadataProvider = PrintingMetadataProvider.getRemote(); - return metadataProvider; -}
diff --git a/ash/webui/print_management/resources/mojo_interface_provider.ts b/ash/webui/print_management/resources/mojo_interface_provider.ts new file mode 100644 index 0000000..32636337 --- /dev/null +++ b/ash/webui/print_management/resources/mojo_interface_provider.ts
@@ -0,0 +1,20 @@ +// Copyright 2020 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. + +import {PrintingMetadataProvider, PrintingMetadataProviderInterface} from './printing_manager.mojom-webui.js'; + +let metadataProvider: PrintingMetadataProviderInterface|null = null; + +export function setMetadataProviderForTesting( + testProvider: PrintingMetadataProviderInterface) { + metadataProvider = testProvider; +} + +export function getMetadataProvider(): PrintingMetadataProviderInterface { + if (metadataProvider) { + return metadataProvider; + } + metadataProvider = PrintingMetadataProvider.getRemote(); + return metadataProvider; +}
diff --git a/ash/webui/print_management/resources/print_job_clear_history_dialog.js b/ash/webui/print_management/resources/print_job_clear_history_dialog.ts similarity index 62% rename from ash/webui/print_management/resources/print_job_clear_history_dialog.js rename to ash/webui/print_management/resources/print_job_clear_history_dialog.ts index dcc34ef..3770078 100644 --- a/ash/webui/print_management/resources/print_job_clear_history_dialog.js +++ b/ash/webui/print_management/resources/print_job_clear_history_dialog.ts
@@ -4,13 +4,14 @@ import 'chrome://resources/cr_elements/cr_button/cr_button.js'; import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; -import './print_management_shared_css.js'; +import './print_management_shared.css.js'; -import {assert} from 'chrome://resources/js/assert.m.js'; -import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; +import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getMetadataProvider} from './mojo_interface_provider.js'; +import {getTemplate} from './print_job_clear_history_dialog.html.js'; /** * @fileoverview @@ -18,63 +19,51 @@ * print job history */ -/** - * @constructor - * @extends {PolymerElement} - * @implements {I18nBehaviorInterface} - */ -const PrintJobClearHistoryDialogElementBase = - mixinBehaviors([I18nBehavior], PolymerElement); +const PrintJobClearHistoryDialogElementBase = I18nMixin(PolymerElement); -/** @polymer */ +interface PrintJobClearHistoryDialogElement { + $: {clearDialog: CrDialogElement}; +} + class PrintJobClearHistoryDialogElement extends PrintJobClearHistoryDialogElementBase { static get is() { return 'print-job-clear-history-dialog'; } + static get template() { + return getTemplate(); + } + static get properties() { return { - /** @private */ shouldDisableClearButton_: { type: Boolean, value: false, }, - }; } - /** @override */ - constructor() { - super(); + private shouldDisableClearButton_: boolean; + private mojoInterfaceProvider_ = getMetadataProvider(); - this.mojoInterfaceProvider_ = getMetadataProvider(); - } - - /** @override */ - connectedCallback() { + override connectedCallback() { super.connectedCallback(); this.$.clearDialog.showModal(); } - /** @private */ - onCancelButtonClick_() { + private onCancelButtonClick_() { this.$.clearDialog.close(); } - /** @private */ - onClearButtonClick_() { + private onClearButtonClick_() { this.shouldDisableClearButton_ = true; this.mojoInterfaceProvider_.deleteAllPrintJobs().then( this.onClearedHistory_.bind(this)); } - /** - * @param {!{success: boolean}} clearedHistoryResult - * @private - */ - onClearedHistory_(clearedHistoryResult) { + private onClearedHistory_(clearedHistoryResult: {success: boolean}) { if (clearedHistoryResult.success) { this.dispatchEvent(new CustomEvent( 'all-history-cleared', {bubbles: true, composed: true})); @@ -84,10 +73,6 @@ // to control print job history deletions is implemented. this.$.clearDialog.close(); } - - static get template() { - return html`{__html_template__}`; - } } customElements.define(
diff --git a/ash/webui/print_management/resources/print_job_entry.js b/ash/webui/print_management/resources/print_job_entry.ts similarity index 78% rename from ash/webui/print_management/resources/print_job_entry.js rename to ash/webui/print_management/resources/print_job_entry.ts index 4696bfc..0d04c66 100644 --- a/ash/webui/print_management/resources/print_job_entry.js +++ b/ash/webui/print_management/resources/print_job_entry.ts
@@ -8,29 +8,27 @@ import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import 'chrome://resources/polymer/v3_0/iron-media-query/iron-media-query.js'; import 'chrome://resources/polymer/v3_0/paper-progress/paper-progress.js'; -import './icons.js'; -import './print_management_fonts_css.js'; -import './print_management_shared_css.js'; +import './icons.html.js'; +import './print_management_fonts.css.js'; +import './print_management_shared.css.js'; import './strings.m.js'; import {assert, assertNotReached} from 'chrome://resources/js/assert.m.js'; import {FocusRowBehavior} from 'chrome://resources/js/cr/ui/focus_row_behavior.m.js'; -import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js'; +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/js/i18n_mixin.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {String16} from 'chrome://resources/mojo/mojo/public/mojom/base/string16.mojom-webui.js'; import {Time} from 'chrome://resources/mojo/mojo/public/mojom/base/time.mojom-webui.js'; import {IronA11yAnnouncer} from 'chrome://resources/polymer/v3_0/iron-a11y-announcer/iron-a11y-announcer.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getMetadataProvider} from './mojo_interface_provider.js'; -import {PrinterErrorCode, PrintJobCompletionStatus, PrintJobInfo} from './printing_manager.mojom-webui.js'; +import {getTemplate} from './print_job_entry.html.js'; +import {PrinterErrorCode, PrintingMetadataProviderInterface, PrintJobCompletionStatus, PrintJobInfo} from './printing_manager.mojom-webui.js'; const GENERIC_FILE_EXTENSION_ICON = 'print-management:file-generic'; -/** - * Lookup table maps icons to the correct display class. - * @private {Map<string, string>} - */ +// Lookup table maps icons to the correct display class. const ICON_CLASS_MAP = new Map([ ['print-management:file-gdoc', 'file-icon-blue'], ['print-management:file-word', 'file-icon-blue'], @@ -45,12 +43,8 @@ ['print-management:file-ppt', 'file-icon-red'], ]); -/** - * Converts a mojo time to a JS time. - * @param {!Time} mojoTime - * @return {!Date} - */ -function convertMojoTimeToJS(mojoTime) { +// Converts a mojo time to a JS time. +function convertMojoTimeToJS(mojoTime: Time): Date { // The JS Date() is based off of the number of milliseconds since the // UNIX epoch (1970-01-01 00::00:00 UTC), while |internalValue| of the // base::Time (represented in mojom.Time) represents the number of @@ -66,12 +60,8 @@ return new Date(timeInMs - epochDeltaInMs); } -/** - * Returns true if |date| is today, false otherwise. - * @param {!Date} date - * @return {boolean} - */ -function isToday(date) { +// Returns true if |date| is today, false otherwise. +function isToday(date: Date): boolean { const todayDate = new Date(); return date.getDate() === todayDate.getDate() && date.getMonth() === todayDate.getMonth() && @@ -83,10 +73,8 @@ * name extension. If extension is not available, return an empty string. If * file name does have an extension but we don't have an icon for it, return a * generic icon name. - * @param {string} fileName - * @return {string} */ -function getFileExtensionIconName(fileName) { +function getFileExtensionIconName(fileName: string): string { // Get file extension delimited by '.'. const ext = fileName.split('.').pop(); @@ -127,10 +115,8 @@ * Best effort to get the file icon name for a Google-file * (e.g. Google docs, Google sheets, Google forms). Returns an empty * string if |fileName| is not a Google-file. - * @param {string} fileName - * @return {string} */ -function getGFileIconName(fileName) { +function getGFileIconName(fileName: string): string { // Google-files are delimited by '-'. const ext = fileName.split('-').pop(); @@ -163,59 +149,46 @@ * item. */ -/** - * @constructor - * @extends {PolymerElement} - * @implements {I18nBehaviorInterface} - */ -const PrintJobEntryElementBase = mixinBehaviors( - [ - FocusRowBehavior, - I18nBehavior, - ], - PolymerElement); +const PrintJobEntryElementBase = + mixinBehaviors([FocusRowBehavior], I18nMixin(PolymerElement)) as + {new (): PolymerElement & I18nMixinInterface}; -/** @polymer */ class PrintJobEntryElement extends PrintJobEntryElementBase { static get is() { return 'print-job-entry'; } + static get template() { + return getTemplate(); + } + static get properties() { return { - /** @type {!PrintJobInfo} */ jobEntry: { type: Object, }, - /** @private */ jobTitle_: { type: String, computed: 'decodeString16_(jobEntry.title)', }, - /** @private */ printerName_: { type: String, computed: 'decodeString16_(jobEntry.printerName)', }, - /** @private */ creationTime_: { type: String, computed: 'computeDate_(jobEntry.creationTime)', }, - /** @private */ completionStatus_: { type: String, computed: 'computeCompletionStatus_(jobEntry.completedInfo)', }, - /** - * Empty if there is no ongoing error. - * @private - */ + // Empty if there is no ongoing error. ongoingErrorStatus_: { type: String, computed: 'getOngoingErrorStatus_(jobEntry.printerErrorCode)', @@ -225,14 +198,12 @@ * A representation in fraction form of pages printed versus total number * of pages to be printed. E.g. 5/7 (5 pages printed / 7 total pages to * print). - * @private */ readableProgress_: { type: String, computed: 'computeReadableProgress_(jobEntry.activePrintJobInfo)', }, - /** @private */ jobEntryAriaLabel_: { type: String, computed: 'getJobEntryAriaLabel_(jobEntry, jobTitle_, printerName_, ' + @@ -240,19 +211,14 @@ 'jobEntry.activePrintJobinfo.printedPages, jobEntry.numberOfPages)', }, - /** - * This is only updated by media queries from window width changes. - * @private - */ + // This is only updated by media queries from window width changes. showFullOngoingStatus_: Boolean, - /** @private {string} */ fileIcon_: { type: String, computed: 'computeFileIcon_(jobTitle_)', }, - /** @private {string} */ fileIconClass_: { type: String, computed: 'computeFileIconClass_(fileIcon_)', @@ -261,6 +227,19 @@ }; } + jobEntry: PrintJobInfo; + private mojoInterfaceProvider_: PrintingMetadataProviderInterface; + private jobTitle_: string; + private printerName_: string; + private creationTime_: string; + private completionStatus_: string; + private ongoingErrorStatus_: string; + private readableProgress_: string; + private jobEntryAriaLabel_: string; + private showFullOngoingStatus_: boolean; + private fileIcon_: string; + private fileIconClass_: string; + static get observers() { return [ 'printJobEntryDataChanged_(jobTitle_, printerName_, creationTime_, ' + @@ -268,44 +247,6 @@ ]; } - /** - * Check if any elements with the class "overflow-ellipsis" needs to - * add/remove the title attribute. - * @private - */ - printJobEntryDataChanged_() { - Array.from(this.shadowRoot.querySelectorAll('.overflow-ellipsis')) - .forEach((/** @type {HTMLElement} */ e) => { - // Checks if text is truncated - if (e.offsetWidth < e.scrollWidth) { - e.setAttribute('title', e.textContent); - } else { - e.removeAttribute('title'); - } - }); - } - - /** @private */ - onClick_() { - // Since the status or cancel button has the focus-row-control attribute, - // this will trigger the iron-list focus behavior and highlight the entire - // entry. - if (this.isCompletedPrintJob_()) { - this.shadowRoot.querySelector('#completionStatus').focus(); - return; - } - // Focus on the cancel button when clicking on the entry. - this.shadowRoot.querySelector('#cancelPrintJobButton').focus(); - } - - /** @override */ - connectedCallback() { - super.connectedCallback(); - - IronA11yAnnouncer.requestAvailability(); - } - - /** @override */ constructor() { super(); @@ -315,10 +256,55 @@ } /** - * @return {string} - * @private + * Check if any elements with the class "overflow-ellipsis" needs to + * add/remove the title attribute. */ - computeCompletionStatus_() { + private printJobEntryDataChanged_() { + if (!this.shadowRoot) { + return; + } + + Array + .from( + this.shadowRoot.querySelectorAll<HTMLElement>('.overflow-ellipsis'), + ) + .forEach((e) => { + // Checks if text is truncated + if (e.offsetWidth < e.scrollWidth) { + e.setAttribute('title', e.textContent || ''); + } else { + e.removeAttribute('title'); + } + }); + } + + private onClick_() { + if (!this.shadowRoot) { + return; + } + + // Since the status or cancel button has the focus-row-control attribute, + // this will trigger the iron-list focus behavior and highlight the entire + // entry. + if (this.isCompletedPrintJob_()) { + this.shadowRoot.querySelector<HTMLElement>('#completionStatus')?.focus(); + return; + } + // Focus on the cancel button when clicking on the entry. + this.shadowRoot + .querySelector<HTMLElement>( + '#cancelPrintJobButton', + ) + ?.focus(); + } + + override connectedCallback() { + super.connectedCallback(); + + IronA11yAnnouncer.requestAvailability(); + } + + private computeCompletionStatus_(): string { if (!this.jobEntry.completedInfo) { return ''; } @@ -327,11 +313,7 @@ this.jobEntry.completedInfo.completionStatus); } - /** - * @return {string} - * @private - */ - computeReadableProgress_() { + private computeReadableProgress_(): string { if (!this.jobEntry.activePrintJobInfo) { return ''; } @@ -342,19 +324,12 @@ this.jobEntry.numberOfPages.toString()); } - /** @private */ - onCancelPrintJobClicked_() { + private onCancelPrintJobClicked_() { this.mojoInterfaceProvider_.cancelPrintJob(this.jobEntry.id) - .then( - (/** @param {{attemptedCancel: boolean}} response */ (response) => - this.onPrintJobCanceled_(response.attemptedCancel))); + .then((() => this.onPrintJobCanceled_())); } - /** - * @param {boolean} attemptedCancel - * @private - */ - onPrintJobCanceled_(attemptedCancel) { + private onPrintJobCanceled_() { // TODO(crbug/1093527): Handle error case in which attempted cancellation // failed. Need to discuss with UX on error states. this.dispatchEvent(new CustomEvent('iron-announce', { @@ -368,24 +343,15 @@ {bubbles: true, composed: true, detail: this.jobEntry.id})); } - /** - * Converts utf16 to a readable string. - * @param {!String16} arr - * @return {string} - * @private - */ - decodeString16_(arr) { + private decodeString16_(arr: String16): string { return arr.data.map(ch => String.fromCodePoint(ch)).join(''); } /** * Converts mojo time to JS time. Returns "Today" if |mojoTime| is at the * current day. - * @param {!Time} mojoTime - * @return {string} - * @private */ - computeDate_(mojoTime) { + private computeDate_(mojoTime: Time): string { const jsDate = convertMojoTimeToJS(mojoTime); // Date() is constructed with the current time in UTC. If the Date() matches // |jsDate|'s date, display the 12hour time of the current date. @@ -399,14 +365,8 @@ {month: 'short', day: 'numeric', year: 'numeric'}); } - /** - * Returns the corresponding completion status from |mojoCompletionStatus|. - * @param {!PrintJobCompletionStatus} - * mojoCompletionStatus - * @return {string} - * @private - */ - convertStatusToString_(mojoCompletionStatus) { + private convertStatusToString_(mojoCompletionStatus: + PrintJobCompletionStatus): string { switch (mojoCompletionStatus) { case PrintJobCompletionStatus.kFailed: return this.getFailedStatusString_(this.jobEntry.printerErrorCode); @@ -421,19 +381,14 @@ } /** - * @return {boolean} Returns true if the job entry is a completed print job. - * Returns false otherwise. - * @private + * Returns true if the job entry is a completed print job. + * Returns false otherwise. */ - isCompletedPrintJob_() { + private isCompletedPrintJob_(): boolean { return !!this.jobEntry.completedInfo && !this.jobEntry.activePrintJobInfo; } - /** - * @return {string} - * @private - */ - getJobEntryAriaLabel_() { + private getJobEntryAriaLabel_(): string { if (!this.jobEntry || this.jobEntry.numberOfPages === undefined || this.printerName_ === undefined || this.jobTitle_ === undefined || !this.creationTime_) { @@ -461,19 +416,20 @@ return loadTimeData.getStringF( 'ongoingPrintJobLabel', this.jobTitle_, this.printerName_, this.creationTime_, - this.jobEntry.activePrintJobInfo.printedPages.toString(), + this.jobEntry.activePrintJobInfo ? + this.jobEntry.activePrintJobInfo.printedPages.toString() : + '', this.jobEntry.numberOfPages.toString()); } /** * Returns the percentage, out of 100, of the pages printed versus total * number of pages. - * @param {number} printedPages - * @param {number} totalPages - * @return {number} - * @private */ - computePrintPagesProgress_(printedPages, totalPages) { + private computePrintPagesProgress_( + printedPages: number, + totalPages: number, + ): number { assert(printedPages >= 0); assert(totalPages > 0); assert(printedPages <= totalPages); @@ -485,10 +441,8 @@ * (i.e. [iron-iconset-svg name]:[SVG <g> tag id]) for a given file. * This is a best effort approach, as we are only given the file name and * not necessarily its extension. - * @return {string} - * @private */ - computeFileIcon_() { + private computeFileIcon_(): string { const fileExtension = getFileExtensionIconName(this.jobTitle_); // It's valid for a file to have '.' in its name and not be its extension. // If this is the case and we don't have a non-generic file icon, attempt to @@ -506,21 +460,15 @@ /** * Uses file-icon SVG id to determine correct class to apply for file icon. - * @return {string} - * @private */ - computeFileIconClass_() { + private computeFileIconClass_(): string { const iconClass = ICON_CLASS_MAP.get(this.fileIcon_); return `flex-center ${iconClass}`; } - /** - * @param {!PrinterErrorCode} - * mojoPrinterErrorCode - * @return {string} - * @private - */ - getFailedStatusString_(mojoPrinterErrorCode) { + private getFailedStatusString_( + mojoPrinterErrorCode: PrinterErrorCode, + ): string { switch (mojoPrinterErrorCode) { case PrinterErrorCode.kNoError: return loadTimeData.getString('completionStatusPrinted'); @@ -552,13 +500,9 @@ } } - /** - * @param {!PrinterErrorCode} - * mojoPrinterErrorCode - * @return {string} - * @private - */ - getOngoingErrorStatus_(mojoPrinterErrorCode) { + private getOngoingErrorStatus_( + mojoPrinterErrorCode: PrinterErrorCode, + ): string { if (this.isCompletedPrintJob_()) { return ''; } @@ -594,10 +538,6 @@ return loadTimeData.getString('unknownPrinterErrorStopped'); } } - - static get template() { - return html`{__html_template__}`; - } } customElements.define(PrintJobEntryElement.is, PrintJobEntryElement); \ No newline at end of file
diff --git a/ash/webui/print_management/resources/print_management.js b/ash/webui/print_management/resources/print_management.ts similarity index 61% rename from ash/webui/print_management/resources/print_management.js rename to ash/webui/print_management/resources/print_management.ts index 1bf8ee3..b651795 100644 --- a/ash/webui/print_management/resources/print_management.js +++ b/ash/webui/print_management/resources/print_management.ts
@@ -11,42 +11,43 @@ import 'chrome://resources/polymer/v3_0/paper-tooltip/paper-tooltip.js'; import './print_job_clear_history_dialog.js'; import './print_job_entry.js'; -import './print_management_fonts_css.js'; -import './print_management_shared_css.js'; +import './print_management_fonts.css.js'; +import './print_management_shared.css.js'; import './strings.m.js'; +import {IronIconElement} from '//resources/polymer/v3_0/iron-icon/iron-icon.js'; import {assert} from 'chrome://resources/js/assert.m.js'; -import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js'; +import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getMetadataProvider} from './mojo_interface_provider.js'; -import {ActivePrintJobState, PrintJobInfo, PrintJobsObserverInterface, PrintJobsObserverReceiver} from './printing_manager.mojom-webui.js'; +import {getTemplate} from './print_management.html.js'; +import {ActivePrintJobState, PrintingMetadataProviderInterface, PrintJobInfo, PrintJobsObserverInterface, PrintJobsObserverReceiver} from './printing_manager.mojom-webui.js'; const METADATA_STORED_INDEFINITELY = -1; const METADATA_STORED_FOR_ONE_DAY = 1; const METADATA_NOT_STORED = 0; -/** - * @typedef {Array<!PrintJobInfo>} - */ -let PrintJobInfoArr; +type RemovePrintJobEvent = CustomEvent<string>; -/** - * @param {!PrintJobInfo} first - * @param {!PrintJobInfo} second - * @return {number} - */ -function comparePrintJobsReverseChronologically(first, second) { +declare global { + interface HTMLElementEventMap { + 'remove-print-job': RemovePrintJobEvent; + 'all-history-cleared': CustomEvent<void>; + } + interface Window { + CrPolicyStrings: {[key: string]: string}; + } +} + +function comparePrintJobsReverseChronologically( + first: PrintJobInfo, second: PrintJobInfo): number { return -comparePrintJobsChronologically(first, second); } -/** - * @param {!PrintJobInfo} first - * @param {!PrintJobInfo} second - * @return {number} - */ -function comparePrintJobsChronologically(first, second) { +function comparePrintJobsChronologically( + first: PrintJobInfo, second: PrintJobInfo): number { return Number(first.creationTime.internalValue) - Number(second.creationTime.internalValue); } @@ -56,90 +57,71 @@ * 'print-management' is used as the main app to display print jobs. */ -/** - * @constructor - * @extends {PolymerElement} - * @implements {I18nBehaviorInterface} - */ -const PrintManagementElementBase = - mixinBehaviors([I18nBehavior], PolymerElement); +const PrintManagementElementBase = I18nMixin(PolymerElement); -/** @polymer */ -class PrintManagementElement extends PrintManagementElementBase { +interface PrintManagementElement { + $: {deleteIcon: IronIconElement}; +} + +class PrintManagementElement extends PrintManagementElementBase implements + PrintJobsObserverInterface { static get is() { return 'print-management'; } + static get template() { + return getTemplate(); + } + static get properties() { return { - /** - * @type {!PrintJobInfoArr} - * @private - */ printJobs_: { type: Array, value: () => [], }, - /** @private */ printJobHistoryExpirationPeriod_: { type: String, value: '', }, - /** @private */ activeHistoryInfoIcon_: { type: String, value: '', }, - /** @private */ isPolicyControlled_: { type: Boolean, value: false, }, - /** - * @type {!PrintJobInfoArr} - * @private - */ ongoingPrintJobs_: { type: Array, value: () => [], }, - /** - * Used by FocusRowBehavior to track the last focused element on a row. - * @private - */ + // Used by FocusRowBehavior to track the last focused element on a row. lastFocused_: Object, - /** - * Used by FocusRowBehavior to track if the list has been blurred. - * @private - */ + // Used by FocusRowBehavior to track if the list has been blurred. listBlurred_: Boolean, - /** @private */ showClearAllButton_: { type: Boolean, value: false, reflectToAttribute: true, }, - /** @private */ showClearAllDialog_: { type: Boolean, value: false, }, - /** @private */ deletePrintJobHistoryAllowedByPolicy_: { type: Boolean, value: true, }, - /** @private */ shouldDisableClearAllButton_: { type: Boolean, computed: 'computeShouldDisableClearAllButton_(printJobs_,' + @@ -149,7 +131,6 @@ /** * Receiver responsible for observing print job updates notification * events. - * @private {?PrintJobsObserverReceiver} */ printJobsObserverReceiver_: {type: Object}, }; @@ -159,7 +140,6 @@ return ['onClearAllButtonUpdated_(shouldDisableClearAllButton_)']; } - /** @override */ constructor() { super(); @@ -170,12 +150,25 @@ loadTimeData.getString('clearAllPrintJobPolicyIndicatorToolTip'), }; - window.addEventListener('all-history-cleared', () => this.getPrintJobs_()); - window.addEventListener('remove-print-job', (e) => this.removePrintJob_(e)); + this.addEventListener('all-history-cleared', () => this.getPrintJobs_()); + this.addEventListener('remove-print-job', (e) => this.removePrintJob_(e)); } - /** @override */ - connectedCallback() { + private mojoInterfaceProvider_: PrintingMetadataProviderInterface; + private isPolicyControlled_: boolean; + private printJobs_: PrintJobInfo[]; + private printJobHistoryExpirationPeriod_: string; + private activeHistoryInfoIcon_: string; + private ongoingPrintJobs_: PrintJobInfo[]; + private lastFocused_: Element; + private listBlurred_: boolean; + private showClearAllButton_: boolean; + private showClearAllDialog_: boolean; + private deletePrintJobHistoryAllowedByPolicy_: boolean; + private shouldDisableClearAllButton_: boolean; + private printJobsObserverReceiver_: PrintJobsObserverReceiver; + + override connectedCallback() { super.connectedCallback(); this.getPrintJobHistoryExpirationPeriod_(); @@ -183,57 +176,41 @@ this.fetchDeletePrintJobHistoryPolicy_(); } - /** @override */ - disconnectedCallback() { + override disconnectedCallback() { super.disconnectedCallback(); this.printJobsObserverReceiver_.$.close(); } - /** @private */ - startObservingPrintJobs_() { - this.printJobsObserverReceiver_ = new PrintJobsObserverReceiver( - /** - * @type {!PrintJobsObserverInterface} - */ - (this)); - this.mojoInterfaceProvider_.observePrintJobs( - this.printJobsObserverReceiver_.$.bindNewPipeAndPassRemote()) + private startObservingPrintJobs_() { + this.printJobsObserverReceiver_ = new PrintJobsObserverReceiver((this)); + this.mojoInterfaceProvider_ + .observePrintJobs( + this.printJobsObserverReceiver_.$.bindNewPipeAndPassRemote()) .then(() => { this.getPrintJobs_(); }); } - /** @private */ - fetchDeletePrintJobHistoryPolicy_() { + private fetchDeletePrintJobHistoryPolicy_() { this.mojoInterfaceProvider_.getDeletePrintJobHistoryAllowedByPolicy().then( - /*@type {!{isAllowedByPolicy: boolean}}*/ (param) => { + (param) => { this.onGetDeletePrintHistoryPolicy_(param); }); } - /** - * @param {!{isAllowedByPolicy: boolean}} responseParam - * @private - */ - onGetDeletePrintHistoryPolicy_(responseParam) { + private onGetDeletePrintHistoryPolicy_(responseParam: + {isAllowedByPolicy: boolean}) { this.showClearAllButton_ = true; this.deletePrintJobHistoryAllowedByPolicy_ = responseParam.isAllowedByPolicy; } - /** - * Overrides PrintJobsObserverInterface - */ onAllPrintJobsDeleted() { this.getPrintJobs_(); } - /** - * Overrides PrintJobsObserverInterface - * @param {!PrintJobInfo} job - */ - onPrintJobUpdate(job) { + onPrintJobUpdate(job: PrintJobInfo) { // Only update ongoing print jobs. assert(job.activePrintJobInfo); @@ -249,7 +226,7 @@ this.push('ongoingPrintJobs_', job); } - if (job.activePrintJobInfo.activeState === + if (job.activePrintJobInfo?.activeState === ActivePrintJobState.kDocumentDone) { // This print job is now completed, next step is to update the history // list with the recently stored print job. @@ -257,11 +234,7 @@ } } - /** - * @param {!{printJobs: !PrintJobInfoArr}} jobs - * @private - */ - onPrintJobsReceived_(jobs) { + private onPrintJobsReceived_(jobs: {printJobs: PrintJobInfo[]}) { // TODO(crbug/1073690): Update this when BigInt is supported for // updateList(). const ongoingList = []; @@ -276,25 +249,19 @@ } // Sort the print jobs in chronological order. - this.ongoingPrintJobs_ = - ongoingList.sort(comparePrintJobsChronologically); + this.ongoingPrintJobs_ = ongoingList.sort(comparePrintJobsChronologically); this.printJobs_ = historyList.sort(comparePrintJobsReverseChronologically); } - /** @private */ - getPrintJobs_() { - this.mojoInterfaceProvider_.getPrintJobs() - .then(this.onPrintJobsReceived_.bind(this)); + private getPrintJobs_() { + this.mojoInterfaceProvider_.getPrintJobs().then( + this.onPrintJobsReceived_.bind(this)); } - /** - * @param {!{ - * expirationPeriodInDays: number, - * isFromPolicy: boolean - * }} printJobPolicyInfo - * @private - */ - onPrintJobHistoryExpirationPeriodReceived_(printJobPolicyInfo) { + private onPrintJobHistoryExpirationPeriodReceived_(printJobPolicyInfo: { + expirationPeriodInDays: number, + isFromPolicy: boolean, + }) { const expirationPeriod = printJobPolicyInfo.expirationPeriodInDays; // If print jobs are not persisted, we can return early since the tooltip // section won't be shown. @@ -303,18 +270,17 @@ } this.isPolicyControlled_ = printJobPolicyInfo.isFromPolicy; - this.activeHistoryInfoIcon_ = this.isPolicyControlled_ - ? 'enterpriseIcon' - : 'infoIcon'; + this.activeHistoryInfoIcon_ = + this.isPolicyControlled_ ? 'enterpriseIcon' : 'infoIcon'; switch (expirationPeriod) { case METADATA_STORED_INDEFINITELY: this.printJobHistoryExpirationPeriod_ = - loadTimeData.getString('printJobHistoryIndefinitePeriod'); + loadTimeData.getString('printJobHistoryIndefinitePeriod'); break; case METADATA_STORED_FOR_ONE_DAY: this.printJobHistoryExpirationPeriod_ = - loadTimeData.getString('printJobHistorySingleDay'); + loadTimeData.getString('printJobHistorySingleDay'); break; default: this.printJobHistoryExpirationPeriod_ = loadTimeData.getStringF( @@ -324,64 +290,43 @@ } } - /** @private */ - getPrintJobHistoryExpirationPeriod_() { - this.mojoInterfaceProvider_.getPrintJobHistoryExpirationPeriod() - .then(this.onPrintJobHistoryExpirationPeriodReceived_.bind(this)); + private getPrintJobHistoryExpirationPeriod_() { + this.mojoInterfaceProvider_.getPrintJobHistoryExpirationPeriod().then( + this.onPrintJobHistoryExpirationPeriodReceived_.bind(this)); } - /** - * @param {!Event} e - * @private - */ - removePrintJob_(e) { - const idx = this.getIndexOfOngoingPrintJob_(e.detail) ; + private removePrintJob_(e: RemovePrintJobEvent) { + const idx = this.getIndexOfOngoingPrintJob_(e.detail); if (idx !== -1) { this.splice('ongoingPrintJobs_', idx, 1); } } - /** @private */ - onClearHistoryClicked_() { + private onClearHistoryClicked_() { this.showClearAllDialog_ = true; } - /** @private */ - onClearHistoryDialogClosed_() { + private onClearHistoryDialogClosed_() { this.showClearAllDialog_ = false; } - /** - * @param {string} expectedId - * @return {number} - * @private - */ - getIndexOfOngoingPrintJob_(expectedId) { + private getIndexOfOngoingPrintJob_(expectedId: string): number { return this.ongoingPrintJobs_.findIndex( - arr_job => arr_job.id === expectedId, + arrJob => arrJob.id === expectedId, ); } - /** - * @return {boolean} - * @private - */ - computeShouldDisableClearAllButton_() { + private computeShouldDisableClearAllButton_(): boolean { return !this.deletePrintJobHistoryAllowedByPolicy_ || !this.printJobs_.length; } - /** @private */ - onClearAllButtonUpdated_() { + private onClearAllButtonUpdated_() { this.$.deleteIcon.classList.toggle( 'delete-enabled', !this.shouldDisableClearAllButton_); this.$.deleteIcon.classList.toggle( 'delete-disabled', this.shouldDisableClearAllButton_); } - - static get template() { - return html`{__html_template__}`; - } } customElements.define(PrintManagementElement.is, PrintManagementElement);
diff --git a/ash/webui/print_management/resources/print_management_fonts.css b/ash/webui/print_management/resources/print_management_fonts.css new file mode 100644 index 0000000..610679b --- /dev/null +++ b/ash/webui/print_management/resources/print_management_fonts.css
@@ -0,0 +1,53 @@ +/* Copyright 2022 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. */ + +/* #css_wrapper_metadata_start + * #type=style + * #css_wrapper_metadata_end */ + +:host { + --print-management-title-font-family: "Google Sans", Roboto, sans-serif; + --print-management-default-font-family: Roboto, sans-serif; + --print-management-header-font-family: Roboto, sans-serif; + --print-management-button-font-family: Roboto, sans-serif; + + --print-management-title-font-size: 22px; + --print-management-default-font-size: 13px; + --print-management-header-font-size: 13px; + --print-management-button-font-size: 13px; + + --print-management-title-font-weight: 500; /* medium */ + --print-management-default-font-weight: 400; /* regular */ + --print-management-header-font-weight: 500; /* medium */ + --print-management-button-font-weight: 500; /* medium */ + + --print-management-title-text-color: var(--cros-text-color-primary); + --print-management-default-text-color: var(--cros-text-color-primary); + --print-management-header-text-color: var(--cros-text-color-secondary); + --print-management-button-text-color: var(--cros-text-color-prominent); + + --print-management-title-font: { + font-family: var(--print-management-title-font-family); + font-size: var(--print-management-title-font-size); + font-weight: var(--print-management-title-font-weight); + }; + + --print-management-default-font: { + font-family: var(--print-management-default-font-family); + font-size: var(--print-management-default-font-size); + font-weight: var(--print-management-default-font-weight); + }; + + --print-management-header-font: { + font-family: var(--print-management-header-font-family); + font-size: var(--print-management-header-font-size); + font-weight: var(--print-management-header-font-weight); + }; + + --print-management-button-font: { + font-family: var(--print-management-button-font-family); + font-size: var(--print-management-button-font-size); + font-weight: var(--print-management-button-font-weight); + }; +} \ No newline at end of file
diff --git a/ash/webui/print_management/resources/print_management_fonts_css.html b/ash/webui/print_management/resources/print_management_fonts_css.html deleted file mode 100644 index eddcc37..0000000 --- a/ash/webui/print_management/resources/print_management_fonts_css.html +++ /dev/null
@@ -1,49 +0,0 @@ -<template> - <style> - :host { - --print-management-title-font-family: "Google Sans", Roboto, sans-serif; - --print-management-default-font-family: Roboto, sans-serif; - --print-management-header-font-family: Roboto, sans-serif; - --print-management-button-font-family: Roboto, sans-serif; - - --print-management-title-font-size: 22px; - --print-management-default-font-size: 13px; - --print-management-header-font-size: 13px; - --print-management-button-font-size: 13px; - - --print-management-title-font-weight: 500; /* medium */ - --print-management-default-font-weight: 400; /* regular */ - --print-management-header-font-weight: 500; /* medium */ - --print-management-button-font-weight: 500; /* medium */ - - --print-management-title-text-color: var(--cros-text-color-primary); - --print-management-header-text-color: var(--cros-text-color-secondary); - --print-management-default-text-color: var(--cros-text-color-primary); - --print-management-button-text-color: var(--cros-text-color-prominent); - - --print-management-title-font: { - font-family: var(--print-management-title-font-family); - font-size: var(--print-management-title-font-size); - font-weight: var(--print-management-title-font-weight); - }; - - --print-management-default-font: { - font-family: var(--print-management-default-font-family); - font-size: var(--print-management-default-font-size); - font-weight: var(--print-management-default-font-weight); - }; - - --print-management-header-font: { - font-family: var(--print-management-header-font-family); - font-size: var(--print-management-header-font-size); - font-weight: var(--print-management-header-font-weight); - }; - - --print-management-button-font: { - font-family: var(--print-management-button-font-family); - font-size: var(--print-management-button-font-size); - font-weight: var(--print-management-button-font-weight); - }; - } - </style> -</template> \ No newline at end of file
diff --git a/ash/webui/print_management/resources/print_management_fonts_css.js b/ash/webui/print_management/resources/print_management_fonts_css.js deleted file mode 100644 index 22c8bf8..0000000 --- a/ash/webui/print_management/resources/print_management_fonts_css.js +++ /dev/null
@@ -1,9 +0,0 @@ -// Copyright 2020 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. - -import 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; - -const styleMod = document.createElement('dom-module'); -styleMod.innerHTML = `{__html_template__}`; -styleMod.register('print-management-fonts');
diff --git a/ash/webui/print_management/resources/print_management_resources.grd b/ash/webui/print_management/resources/print_management_resources.grd deleted file mode 100644 index 639e273..0000000 --- a/ash/webui/print_management/resources/print_management_resources.grd +++ /dev/null
@@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<grit latest_public_release="0" current_release="1" output_all_resource_defines="false"> - <outputs> - <output filename="grit/ash_print_management_resources.h" type="rc_header"> - <emit emit_type='prepend'></emit> - </output> - <output filename="grit/ash_print_management_resources_map.cc" - type="resource_file_map_source" /> - <output filename="grit/ash_print_management_resources_map.h" - type="resource_map_header" /> - <output filename="ash_print_management_resources.pak" type="data_package" /> - </outputs> - <release seq="1"> - <includes> - <!-- Privileged app host contents. --> - <include name="IDR_PRINT_MANAGEMENT_ICONS_JS" file="${root_gen_dir}/ash/webui/print_management/resources/icons.js" resource_path="icons.js" use_base_dir="false" type="BINDATA"/> - <include name="IDR_PRINT_MANAGEMENT_INDEX_HTML" file="index.html" type="BINDATA"/> - <include name="IDR_PRINT_MANAGEMENT_JS" file="${root_gen_dir}/ash/webui/print_management/resources/print_management.js" resource_path="print_management.js" use_base_dir="false" type="BINDATA"/> - <include name="IDR_PRINT_MANAGEMENT_PRINT_JOB_ENTRY_JS" file="${root_gen_dir}/ash/webui/print_management/resources/print_job_entry.js" resource_path="print_job_entry.js" use_base_dir="false" type="BINDATA"/> - <include name="IDR_PRINT_MANAGEMENT_FONTS_CSS_JS" file="${root_gen_dir}/ash/webui/print_management/resources/print_management_fonts_css.js" resource_path="print_management_fonts_css.js" use_base_dir="false" type="BINDATA"/> - <include name="IDR_PRINT_MANAGEMENT_SHARED_CSS_JS" file="${root_gen_dir}/ash/webui/print_management/resources/print_management_shared_css.js" resource_path="print_management_shared_css.js" use_base_dir="false" type="BINDATA"/> - <include name="IDR_PRINT_MANAGEMENT_PRINT_JOB_CLEAR_HISTORY_DIALOG_JS" file="${root_gen_dir}/ash/webui/print_management/resources/print_job_clear_history_dialog.js" resource_path="print_job_clear_history_dialog.js" use_base_dir="false" type="BINDATA"/> - <include name="IDR_PRINT_MANAGEMENT_ICON" file="print_management_192.png" type="BINDATA"/> - <include name="IDR_PRINTING_MANAGER_MOJO_WEBUI_JS" file="${root_gen_dir}/ash/webui/print_management/resources/printing_manager.mojom-webui.js" resource_path="printing_manager.mojom-webui.js" use_base_dir="false" type="BINDATA" /> - </includes> - - <structures> - <structure name="IDR_PRINT_MANAGEMENT_MOJO_INTERFACE_PROVIDER_JS" - file="mojo_interface_provider.js" type="chrome_html"/> - </structures> - </release> -</grit>
diff --git a/ash/webui/print_management/resources/print_management_shared.css b/ash/webui/print_management/resources/print_management_shared.css new file mode 100644 index 0000000..4a7b28a --- /dev/null +++ b/ash/webui/print_management/resources/print_management_shared.css
@@ -0,0 +1,215 @@ +/* Copyright 2022 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. */ + + /* #css_wrapper_metadata_start + * #type=style + * #import=chrome://resources/cr_elements/shared_style_css.m.js + * #import=chrome://resources/cr_elements/shared_vars_css.m.js + * #include=cr-shared-style + * #css_wrapper_metadata_end */ + +html { + background-color: var(--cros-bg-color); +} + +.flex-center { + align-items: center; + display: flex; +} + +.file-icon-blue { + --iron-icon-fill-color: var(--google-blue-600); +} + +.file-icon-gray { + --iron-icon-fill-color: var(--google-grey-700); +} + +.file-icon-green { + --iron-icon-fill-color: var(--google-green-600); +} + +.file-icon-red { + --iron-icon-fill-color: var(--google-red-600); +} + +.file-icon-yellow { + --iron-icon-fill-color: var(--google-yellow-600); +} + +@media (prefers-color-scheme: dark) { + .file-icon-blue { + --iron-icon-fill-color: var(--google-blue-300); + } + + .file-icon-gray { + --iron-icon-fill-color: var(--google-grey-300); + } + + .file-icon-green { + --iron-icon-fill-color: var(--google-green-300); + } + + .file-icon-red { + --iron-icon-fill-color: var(--google-red-300); + } + + .file-icon-yellow { + --iron-icon-fill-color: var(--google-yellow-300); + } +} + +.overflow-ellipsis { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +@media (min-width: 600px) and (max-width: 767px) { + .date-column { + width: 56px; + } + + .file-name-column { + width: 184px; + } + + .file-name-header-column { + width: 224px; + } + + .margin-border { + margin: 0px 40px 0px 40px; + } + + .padded-left { + margin-inline-start: 32px; + } + + .printer-name-column { + width: 68px; + } + + .status-column { + width: 124px; + } + + #activeStatusContainer:hover { + background-color: rgba(var(--google-blue-600-rgb), 0.06); + border-radius: 16px; + margin-inline-start: 16px; + padding-left: 16px; + } +} + +@media (min-width: 768px) and (max-width: 959px) { + .date-column { + width: 82px; + } + + .file-name-column { + width: 224px; + } + + .file-name-header-column { + width: 264px; + } + + .margin-border { + margin: 0px 40px 0px 40px; + } + + .padded-left { + margin-inline-start: 40px; + } + + .printer-name-column { + width: 88px; + } + + .status-column { + width: 182px; + } + + #activeStatusContainer:hover { + background-color: rgba(var(--google-blue-600-rgb), 0.06); + border-radius: 16px; + margin-inline-start: 16px; + padding-left: 16px; + } +} + +@media (min-width: 960px) and (max-width: 1279px) { + .date-column { + width: 82px; + } + + .file-name-column { + width: 280px; + } + + .file-name-header-column { + width: 320px; + } + + .margin-border { + margin: 0px 64px 0px 64px; + } + + .padded-left { + margin-inline-start: 48px; + } + + .printer-name-column { + width: 152px; + } + + .status-column { + width: 182px; + } + + #activeStatusContainer:hover { + background-color: rgba(var(--google-blue-600-rgb), 0.06); + border-radius: 16px; + margin-inline-start: 16px; + padding-left: 16px; + } +} + +@media (min-width: 1280px) { + .date-column { + width: 144px; + } + + .file-name-column { + width: 316px; + } + + .file-name-header-column { + width: 356px; + } + + .margin-border { + margin: 0px 144px 0px 144px; + } + + .padded-left { + margin-inline-start: 56px; + } + + .printer-name-column { + width: 190px; + } + + .status-column { + width: 182px; + } + + #activeStatusContainer:hover { + background-color: rgba(var(--google-blue-600-rgb), 0.06); + border-radius: 16px; + margin-inline-start: 16px; + padding-left: 16px; + } +} \ No newline at end of file
diff --git a/ash/webui/print_management/resources/print_management_shared_css.html b/ash/webui/print_management/resources/print_management_shared_css.html deleted file mode 100644 index fd3e6e07..0000000 --- a/ash/webui/print_management/resources/print_management_shared_css.html +++ /dev/null
@@ -1,208 +0,0 @@ -<template> - <style include="cr-shared-style"> - html { - background-color: var(--cros-bg-color); - } - - .flex-center { - align-items: center; - display: flex; - } - - .file-icon-blue { - --iron-icon-fill-color: var(--google-blue-600); - } - - .file-icon-gray { - --iron-icon-fill-color: var(--google-grey-700); - } - - .file-icon-green { - --iron-icon-fill-color: var(--google-green-600); - } - - .file-icon-red { - --iron-icon-fill-color: var(--google-red-600); - } - - .file-icon-yellow { - --iron-icon-fill-color: var(--google-yellow-600); - } - - @media (prefers-color-scheme: dark) { - .file-icon-blue { - --iron-icon-fill-color: var(--google-blue-300); - } - - .file-icon-gray { - --iron-icon-fill-color: var(--google-grey-300); - } - - .file-icon-green { - --iron-icon-fill-color: var(--google-green-300); - } - - .file-icon-red { - --iron-icon-fill-color: var(--google-red-300); - } - - .file-icon-yellow { - --iron-icon-fill-color: var(--google-yellow-300); - } - } - - .overflow-ellipsis { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - - @media (min-width:600px) and (max-width: 767px) { - .date-column { - width: 56px; - } - - .file-name-column { - width: 184px; - } - - .file-name-header-column { - width: 224px; - } - - .margin-border { - margin: 0px 40px 0px 40px; - } - - .padded-left { - margin-inline-start: 32px; - } - - .printer-name-column { - width: 68px; - } - - .status-column { - width: 124px; - } - - #activeStatusContainer:hover { - background-color: rgba(var(--google-blue-600-rgb), 0.06); - border-radius: 16px; - margin-inline-start: 16px; - padding-left: 16px; - } - } - - @media (min-width:768px) and (max-width: 959px) { - .date-column { - width: 82px; - } - - .file-name-column { - width: 224px; - } - - .file-name-header-column { - width: 264px; - } - - .margin-border { - margin: 0px 40px 0px 40px; - } - - .padded-left { - margin-inline-start: 40px; - } - - .printer-name-column { - width: 88px; - } - - .status-column { - width: 182px; - } - - #activeStatusContainer:hover { - background-color: rgba(var(--google-blue-600-rgb), 0.06); - border-radius: 16px; - margin-inline-start: 16px; - padding-left: 16px; - } - } - - @media (min-width:960px) and (max-width: 1279px) { - .date-column { - width: 82px; - } - - .file-name-column { - width: 280px; - } - - .file-name-header-column { - width: 320px; - } - - .margin-border { - margin: 0px 64px 0px 64px; - } - - .padded-left { - margin-inline-start: 48px; - } - - .printer-name-column { - width: 152px; - } - - .status-column { - width: 182px; - } - - #activeStatusContainer:hover { - background-color: rgba(var(--google-blue-600-rgb), 0.06); - border-radius: 16px; - margin-inline-start: 16px; - padding-left: 16px; - } - } - - @media (min-width:1280px) { - .date-column { - width: 144px; - } - - .file-name-column { - width: 316px; - } - - .file-name-header-column { - width: 356px; - } - - .margin-border { - margin: 0px 144px 0px 144px; - } - - .padded-left { - margin-inline-start: 56px; - } - - .printer-name-column { - width: 190px; - } - - .status-column { - width: 182px; - } - - #activeStatusContainer:hover { - background-color: rgba(var(--google-blue-600-rgb), 0.06); - border-radius: 16px; - margin-inline-start: 16px; - padding-left: 16px; - } - } - </style> -</template>
diff --git a/ash/webui/print_management/resources/print_management_shared_css.js b/ash/webui/print_management/resources/print_management_shared_css.js deleted file mode 100644 index 5314198..0000000 --- a/ash/webui/print_management/resources/print_management_shared_css.js +++ /dev/null
@@ -1,11 +0,0 @@ -// Copyright 2020 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. - -import 'chrome://resources/cr_elements/shared_style_css.m.js'; -import 'chrome://resources/cr_elements/shared_vars_css.m.js'; -import 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; - -const styleMod = document.createElement('dom-module'); -styleMod.innerHTML = `{__html_template__}`; -styleMod.register('print-management-shared');
diff --git a/ash/webui/print_management/resources/tsconfig_base.json b/ash/webui/print_management/resources/tsconfig_base.json new file mode 100644 index 0000000..8f1617740 --- /dev/null +++ b/ash/webui/print_management/resources/tsconfig_base.json
@@ -0,0 +1,9 @@ +{ + "extends": "../../../../tools/typescript/tsconfig_base.json", + "compilerOptions": { + "allowJs": true, + "noUncheckedIndexedAccess": false, + "noUnusedLocals": false, + "strictPropertyInitialization": false + } +} \ No newline at end of file
diff --git a/ash/webui/resources/BUILD.gn b/ash/webui/resources/BUILD.gn index 11ee40f..c5f1a2f 100644 --- a/ash/webui/resources/BUILD.gn +++ b/ash/webui/resources/BUILD.gn
@@ -267,23 +267,9 @@ output_dir = "$root_gen_dir/chromeos" } -grit("print_management_resources") { - source = - "//ash/webui/print_management/resources/print_management_resources.grd" - - deps = [ - "//ash/webui/print_management/resources:copy_webui_mojo", - "//ash/webui/print_management/resources:web_components", - ] - - outputs = [ - "grit/ash_print_management_resources.h", - "grit/ash_print_management_resources_map.cc", - "grit/ash_print_management_resources_map.h", - "ash_print_management_resources.pak", - ] - - output_dir = "$ash_webui_grit_output_dir" +ash_generated_grit("print_management_resources") { + source = "$root_gen_dir/ash/webui/print_management/resources/ash_print_management_resources.grd" + deps = [ "//ash/webui/print_management/resources:build_grd" ] } # Resources used by chrome-untrusted://projector SWA.
diff --git a/ash/wm/desks/templates/saved_desk_item_view.cc b/ash/wm/desks/templates/saved_desk_item_view.cc index 295b557..996cf07 100644 --- a/ash/wm/desks/templates/saved_desk_item_view.cc +++ b/ash/wm/desks/templates/saved_desk_item_view.cc
@@ -328,12 +328,6 @@ void SavedDeskItemView::MaybeShowReplaceDialog(DeskTemplateType type, const base::GUID& uuid) { - // If the user has somehow exited the overview session don't attempt to - // show the dialogue in order to avoid the DCHECK crash. - // TODO(avynn): Find a more permanent fix for this. - if (!Shell::Get()->overview_controller()->InOverviewSession()) - return; - // Show replace template dialog. If accepted, replace old template and commit // name change. aura::Window* root_window = GetWidget()->GetNativeWindow()->GetRootWindow();
diff --git a/ash/wm/desks/templates/saved_desk_unittest.cc b/ash/wm/desks/templates/saved_desk_unittest.cc index 1b6d065..a5869b8e 100644 --- a/ash/wm/desks/templates/saved_desk_unittest.cc +++ b/ash/wm/desks/templates/saved_desk_unittest.cc
@@ -4354,31 +4354,4 @@ ASSERT_FALSE(InOverviewSession()); } -// Tests that if the user somehow exits the overview session that the function -// call to `MaybeShowReplaceDialog` exits gracefully before calling -// `saved_desk_util::GetSavedDeskDialogController` which will cause a crash -// due to a DCHECK for the overview session. Regression test for -// https://crbug.com/1351521. -TEST_F(SavedDeskTest, MaybeShowReplaceDialogDoesNotCrashOutsideOverview) { - UpdateDisplay("800x600,800x600"); - - const base::GUID uuid = base::GUID::GenerateRandomV4(); - AddEntry(uuid, /*name=*/"template_1", base::Time::Now(), - DeskTemplateType::kTemplate); - - OpenOverviewAndShowTemplatesGrid(); - - // Get overview grid and added entry. - const auto& overview_grid = GetOverviewGridList()[0]; - SavedDeskItemView* grid_item = - GetItemViewsFromDeskLibrary(overview_grid.get())[0]; - - // Exit Overview and ensure there is not an overview session - ToggleOverview(); - EXPECT_FALSE(GetOverviewSession()); - - // Call `MaybeShowReplaceDialog` to ensure there isn't a crash. - grid_item->MaybeShowReplaceDialog(DeskTemplateType::kTemplate, uuid); -} - } // namespace ash
diff --git a/ash/wm/float/tablet_mode_float_window_resizer.cc b/ash/wm/float/tablet_mode_float_window_resizer.cc index ac6d2965..e5489a2 100644 --- a/ash/wm/float/tablet_mode_float_window_resizer.cc +++ b/ash/wm/float/tablet_mode_float_window_resizer.cc
@@ -34,17 +34,22 @@ constexpr int kMinDragDistance = 96; constexpr int kScreenEdgeInsetForSnap = 48; +// The minimum distance that will be considered as a drag event. +constexpr float kMinimumDragDistance = 5.f; + } // namespace TabletModeFloatWindowResizer::TabletModeFloatWindowResizer( WindowState* window_state) : WindowResizer(window_state), split_view_drag_indicators_(std::make_unique<SplitViewDragIndicators>( - window_state->window()->GetRootWindow())) { + window_state->window()->GetRootWindow())), + last_location_in_parent_(details().initial_location_in_parent) { DCHECK(chromeos::wm::features::IsFloatWindowEnabled()); // TODO(sophiewen): Remove this once the untuck window widget is implemented. Shell::Get()->float_controller()->MaybeUntuckFloatedWindowForTablet( - window_state->window()); + GetTarget()); + split_view_drag_indicators_->SetDraggedWindow(GetTarget()); } TabletModeFloatWindowResizer::~TabletModeFloatWindowResizer() { @@ -82,6 +87,15 @@ } void TabletModeFloatWindowResizer::CompleteDrag() { + // Revert the drag if the window hasn't moved enough. This will prevent + // accidental magnetisms. + const gfx::Vector2dF distance = + last_location_in_parent_ - details().initial_location_in_parent; + if (distance.Length() < kMinimumDragDistance) { + RevertDrag(); + return; + } + aura::Window* float_window = GetTarget(); if (snap_position_ != SplitViewController::NONE) { // Let `SplitViewController` handle windows that should be snapped.
diff --git a/ash/wm/tablet_mode/tablet_mode_multitask_menu.cc b/ash/wm/tablet_mode/tablet_mode_multitask_menu.cc index 296680d3..c9878cf 100644 --- a/ash/wm/tablet_mode/tablet_mode_multitask_menu.cc +++ b/ash/wm/tablet_mode/tablet_mode_multitask_menu.cc
@@ -19,7 +19,7 @@ constexpr int kMultitaskMenuVerticalPadding = 4; constexpr int kMultitaskMenuWidth = 540; -constexpr int kMultitaskMenuHeight = 124; +constexpr int kMultitaskMenuLandscapeHeight = 124; constexpr int kBetweenButtonSpacing = 16; } // namespace @@ -68,9 +68,10 @@ views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); params.opacity = views::Widget::InitParams::WindowOpacity::kTranslucent; params.parent = window->parent(); - params.bounds = gfx::Rect( - window->bounds().CenterPoint().x() - kMultitaskMenuWidth / 2, - kMultitaskMenuVerticalPadding, kMultitaskMenuWidth, kMultitaskMenuHeight); + params.bounds = + gfx::Rect(window->bounds().CenterPoint().x() - kMultitaskMenuWidth / 2, + kMultitaskMenuVerticalPadding, kMultitaskMenuWidth, + kMultitaskMenuLandscapeHeight); params.name = "TabletModeMultitaskMenuWidget"; // TODO(crbug.com/1355572): Set widget as activatable and hide in overview.
diff --git a/base/task/task_features.cc b/base/task/task_features.cc index f43abdf..c192613 100644 --- a/base/task/task_features.cc +++ b/base/task/task_features.cc
@@ -9,34 +9,6 @@ namespace base { -const Feature kMayBlockWithoutDelay = {"MayBlockWithoutDelay", - base::FEATURE_DISABLED_BY_DEFAULT}; - -const Feature kDisableJobYield = {"DisableJobYield", - base::FEATURE_DISABLED_BY_DEFAULT}; - -const Feature kDisableFairJobScheduling = {"DisableFairJobScheduling", - base::FEATURE_DISABLED_BY_DEFAULT}; - -const Feature kDisableJobUpdatePriority = {"DisableJobUpdatePriority", - base::FEATURE_DISABLED_BY_DEFAULT}; - -const Feature kWakeUpStrategyFeature = {"WakeUpStrategyFeature", - base::FEATURE_DISABLED_BY_DEFAULT}; - -constexpr FeatureParam<WakeUpStrategy>::Option kWakeUpStrategyOptions[] = { - {WakeUpStrategy::kCentralizedWakeUps, "centralized-wakeups"}, - {WakeUpStrategy::kSerializedWakeUps, "serialized-wakeups"}, - {WakeUpStrategy::kExponentialWakeUps, "exponential-wakeups"}, - {WakeUpStrategy::kGreedyWakeUps, "greedy-wakeups"}}; - -const base::FeatureParam<WakeUpStrategy> kWakeUpStrategyParam{ - &kWakeUpStrategyFeature, "strategy", WakeUpStrategy::kExponentialWakeUps, - &kWakeUpStrategyOptions}; - -const Feature kWakeUpAfterGetWork = {"WakeUpAfterGetWork", - base::FEATURE_DISABLED_BY_DEFAULT}; - #if HAS_NATIVE_THREAD_POOL() const Feature kUseNativeThreadPool = {"UseNativeThreadPool", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/base/task/task_features.h b/base/task/task_features.h index 1895aa2..14a41e4 100644 --- a/base/task/task_features.h +++ b/base/task/task_features.h
@@ -13,41 +13,6 @@ struct Feature; -// Under this feature, workers blocked with MayBlock are replaced immediately -// instead of waiting for a threshold in the foreground thread group. -extern const BASE_EXPORT Feature kMayBlockWithoutDelay; - -// Under this feature, ThreadPool::ShouldYield() always returns false -extern const BASE_EXPORT Feature kDisableJobYield; -// Under this feature, JobTaskSource doesn't use worker count in its sort key -// such that worker threads are not distributed among running jobs equally. -extern const BASE_EXPORT Feature kDisableFairJobScheduling; -// Under this feature, priority update on Jobs is disabled. -extern const BASE_EXPORT Feature kDisableJobUpdatePriority; -// Under this feature, another WorkerThread is signaled only after the current -// thread was assigned work. -extern const BASE_EXPORT Feature kWakeUpAfterGetWork; - -// Strategy affecting how WorkerThreads are signaled to pick up pending work. -enum class WakeUpStrategy { - // A single thread scheduling new work signals all required WorkerThreads. - kCentralizedWakeUps, - // Each thread signals at most a single thread, either when scheduling new - // work or picking up pending work. - kSerializedWakeUps, - // Each thread signals at most 2 threads, either when scheduling new - // work or picking up pending work. - kExponentialWakeUps, - // Each thread signals as many threads as necessary, either when scheduling - // new work or picking up pending work. - kGreedyWakeUps, -}; - -// Under this feature, a given WakeUpStrategy param is used. -extern const BASE_EXPORT Feature kWakeUpStrategyFeature; -extern const BASE_EXPORT base::FeatureParam<WakeUpStrategy> - kWakeUpStrategyParam; - #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) #define HAS_NATIVE_THREAD_POOL() 1 #else
diff --git a/base/task/thread_pool/job_task_source.cc b/base/task/thread_pool/job_task_source.cc index ccb6225..28d7679 100644 --- a/base/task/thread_pool/job_task_source.cc +++ b/base/task/thread_pool/job_task_source.cc
@@ -367,11 +367,7 @@ // This is a no-op. void JobTaskSource::OnBecomeReady() {} -TaskSourceSortKey JobTaskSource::GetSortKey( - bool disable_fair_scheduling) const { - if (disable_fair_scheduling) { - return TaskSourceSortKey(priority_racy(), ready_time_); - } +TaskSourceSortKey JobTaskSource::GetSortKey() const { return TaskSourceSortKey(priority_racy(), ready_time_, TS_UNCHECKED_READ(state_).Load().worker_count()); }
diff --git a/base/task/thread_pool/job_task_source.h b/base/task/thread_pool/job_task_source.h index 69caa4d..a971e419 100644 --- a/base/task/thread_pool/job_task_source.h +++ b/base/task/thread_pool/job_task_source.h
@@ -71,8 +71,7 @@ // TaskSource: ExecutionEnvironment GetExecutionEnvironment() override; size_t GetRemainingConcurrency() const override; - TaskSourceSortKey GetSortKey( - bool disable_fair_scheduling = false) const override; + TaskSourceSortKey GetSortKey() const override; TimeTicks GetDelayedSortKey() const override; bool IsActive() const;
diff --git a/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc b/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc index ed562938..0f81901 100644 --- a/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc +++ b/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc
@@ -216,8 +216,7 @@ bool EnqueueTaskSource( TransactionWithRegisteredTaskSource transaction_with_task_source) { CheckedAutoLock auto_lock(lock_); - auto sort_key = transaction_with_task_source.task_source->GetSortKey( - /* disable_fair_scheduling */ false); + auto sort_key = transaction_with_task_source.task_source->GetSortKey(); priority_queue_.Push(std::move(transaction_with_task_source.task_source), sort_key); if (!worker_awake_ && CanRunNextTaskSource()) {
diff --git a/base/task/thread_pool/priority_queue_unittest.cc b/base/task/thread_pool/priority_queue_unittest.cc index a976d37..557c876 100644 --- a/base/task/thread_pool/priority_queue_unittest.cc +++ b/base/task/thread_pool/priority_queue_unittest.cc
@@ -49,7 +49,7 @@ } void Push(scoped_refptr<TaskSource> task_source) { - auto sort_key = task_source->GetSortKey(false); + auto sort_key = task_source->GetSortKey(); pq.Push(RegisteredTaskSource::CreateForTesting(std::move(task_source)), sort_key); } @@ -59,19 +59,19 @@ scoped_refptr<TaskSource> sequence_a = MakeSequenceWithTraitsAndTask(TaskTraits(TaskPriority::USER_VISIBLE)); - TaskSourceSortKey sort_key_a = sequence_a->GetSortKey(false); + TaskSourceSortKey sort_key_a = sequence_a->GetSortKey(); scoped_refptr<TaskSource> sequence_b = MakeSequenceWithTraitsAndTask(TaskTraits(TaskPriority::USER_BLOCKING)); - TaskSourceSortKey sort_key_b = sequence_b->GetSortKey(false); + TaskSourceSortKey sort_key_b = sequence_b->GetSortKey(); scoped_refptr<TaskSource> sequence_c = MakeSequenceWithTraitsAndTask(TaskTraits(TaskPriority::USER_BLOCKING)); - TaskSourceSortKey sort_key_c = sequence_c->GetSortKey(false); + TaskSourceSortKey sort_key_c = sequence_c->GetSortKey(); scoped_refptr<TaskSource> sequence_d = MakeSequenceWithTraitsAndTask(TaskTraits(TaskPriority::BEST_EFFORT)); - TaskSourceSortKey sort_key_d = sequence_d->GetSortKey(false); + TaskSourceSortKey sort_key_d = sequence_d->GetSortKey(); PriorityQueue pq; }; @@ -193,7 +193,7 @@ auto sequence_b_transaction = sequence_b->BeginTransaction(); sequence_b_transaction.UpdatePriority(TaskPriority::BEST_EFFORT); - pq.UpdateSortKey(*sequence_b, sequence_b->GetSortKey(false)); + pq.UpdateSortKey(*sequence_b, sequence_b->GetSortKey()); EXPECT_EQ(sort_key_c, pq.PeekSortKey()); ExpectNumSequences(2U, 1U, 1U); } @@ -205,7 +205,7 @@ auto sequence_c_transaction = sequence_c->BeginTransaction(); sequence_c_transaction.UpdatePriority(TaskPriority::USER_BLOCKING); - pq.UpdateSortKey(*sequence_c, sequence_c->GetSortKey(false)); + pq.UpdateSortKey(*sequence_c, sequence_c->GetSortKey()); ExpectNumSequences(2U, 1U, 1U); // Note: |sequence_c| is popped for comparison as |sort_key_c| becomes @@ -222,7 +222,7 @@ auto sequence_d_and_transaction = sequence_d->BeginTransaction(); sequence_d_and_transaction.UpdatePriority(TaskPriority::USER_BLOCKING); - pq.UpdateSortKey(*sequence_d, sequence_d->GetSortKey(false)); + pq.UpdateSortKey(*sequence_d, sequence_d->GetSortKey()); ExpectNumSequences(1U, 1U, 1U); // Note: |sequence_d| is popped for comparison as |sort_key_d| becomes @@ -235,7 +235,7 @@ } { - pq.UpdateSortKey(*sequence_d, sequence_d->GetSortKey(false)); + pq.UpdateSortKey(*sequence_d, sequence_d->GetSortKey()); ExpectNumSequences(1U, 1U, 0U); EXPECT_EQ(sequence_a, pq.PopTaskSource().Unregister()); ExpectNumSequences(1U, 0U, 0U); @@ -245,7 +245,7 @@ { // No-op if UpdateSortKey() is called on an empty PriorityQueue. - pq.UpdateSortKey(*sequence_b, sequence_b->GetSortKey(false)); + pq.UpdateSortKey(*sequence_b, sequence_b->GetSortKey()); EXPECT_TRUE(pq.IsEmpty()); ExpectNumSequences(0U, 0U, 0U); }
diff --git a/base/task/thread_pool/sequence.cc b/base/task/thread_pool/sequence.cc index b875f53..995a6eb 100644 --- a/base/task/thread_pool/sequence.cc +++ b/base/task/thread_pool/sequence.cc
@@ -287,8 +287,7 @@ return !queue_.empty(); } -TaskSourceSortKey Sequence::GetSortKey( - bool /* disable_fair_scheduling */) const { +TaskSourceSortKey Sequence::GetSortKey() const { return TaskSourceSortKey(priority_racy(), ready_time_.load(std::memory_order_relaxed)); }
diff --git a/base/task/thread_pool/sequence.h b/base/task/thread_pool/sequence.h index 044e3679..a09f41e 100644 --- a/base/task/thread_pool/sequence.h +++ b/base/task/thread_pool/sequence.h
@@ -118,8 +118,7 @@ // TaskSource: ExecutionEnvironment GetExecutionEnvironment() override; size_t GetRemainingConcurrency() const override; - TaskSourceSortKey GetSortKey( - bool disable_fair_scheduling = false) const override; + TaskSourceSortKey GetSortKey() const override; TimeTicks GetDelayedSortKey() const override; // Returns a token that uniquely identifies this Sequence.
diff --git a/base/task/thread_pool/task_source.h b/base/task/thread_pool/task_source.h index 5d1517f..ca2f4929 100644 --- a/base/task/thread_pool/task_source.h +++ b/base/task/thread_pool/task_source.h
@@ -148,7 +148,7 @@ virtual size_t GetRemainingConcurrency() const = 0; // Returns a TaskSourceSortKey representing the priority of the TaskSource. - virtual TaskSourceSortKey GetSortKey(bool disable_fair_scheduling) const = 0; + virtual TaskSourceSortKey GetSortKey() const = 0; // Returns a Timeticks object representing the next delayed runtime of the // TaskSource. virtual TimeTicks GetDelayedSortKey() const = 0;
diff --git a/base/task/thread_pool/test_utils.cc b/base/task/thread_pool/test_utils.cc index ea75cec..78210eb 100644 --- a/base/task/thread_pool/test_utils.cc +++ b/base/task/thread_pool/test_utils.cc
@@ -206,7 +206,7 @@ } bool MockPooledTaskRunnerDelegate::ShouldYield(const TaskSource* task_source) { - return thread_group_->ShouldYield(task_source->GetSortKey(false)); + return thread_group_->ShouldYield(task_source->GetSortKey()); } bool MockPooledTaskRunnerDelegate::EnqueueJobTaskSource(
diff --git a/base/task/thread_pool/thread_group.cc b/base/task/thread_pool/thread_group.cc index f731e1d..cb8ee40 100644 --- a/base/task/thread_pool/thread_group.cc +++ b/base/task/thread_pool/thread_group.cc
@@ -99,7 +99,6 @@ void ThreadGroup::Start() { CheckedAutoLock auto_lock(lock_); - disable_fair_scheduling_ = FeatureList::IsEnabled(kDisableFairJobScheduling); } size_t @@ -177,8 +176,7 @@ } else { // If the TaskSource should be reenqueued in the current thread group, // reenqueue it inside the scope of the lock. - auto sort_key = transaction_with_task_source.task_source->GetSortKey( - disable_fair_scheduling_); + auto sort_key = transaction_with_task_source.task_source->GetSortKey(); if (push_to_immediate_queue) { priority_queue_.Push( std::move(transaction_with_task_source.task_source), sort_key); @@ -225,19 +223,15 @@ return priority_queue_.PopTaskSource(); // Replace the top task_source and then update the queue. std::swap(priority_queue_.PeekTaskSource(), task_source); - if (!disable_fair_scheduling_) { - priority_queue_.UpdateSortKey(*task_source.get(), - task_source->GetSortKey(false)); - } + priority_queue_.UpdateSortKey(*task_source.get(), task_source->GetSortKey()); return task_source; } void ThreadGroup::UpdateSortKeyImpl(BaseScopedCommandsExecutor* executor, TaskSource::Transaction transaction) { CheckedAutoLock auto_lock(lock_); - priority_queue_.UpdateSortKey( - *transaction.task_source(), - transaction.task_source()->GetSortKey(disable_fair_scheduling_)); + priority_queue_.UpdateSortKey(*transaction.task_source(), + transaction.task_source()->GetSortKey()); EnsureEnoughWorkersLockRequired(executor); } @@ -257,8 +251,7 @@ std::move(transaction_with_task_source.task_source)); return; } - auto sort_key = transaction_with_task_source.task_source->GetSortKey( - disable_fair_scheduling_); + auto sort_key = transaction_with_task_source.task_source->GetSortKey(); priority_queue_.Push(std::move(transaction_with_task_source.task_source), sort_key); EnsureEnoughWorkersLockRequired(executor);
diff --git a/base/task/thread_pool/thread_group_impl.cc b/base/task/thread_pool/thread_group_impl.cc index 507f442..25f257e2 100644 --- a/base/task/thread_pool/thread_group_impl.cc +++ b/base/task/thread_pool/thread_group_impl.cc
@@ -399,10 +399,6 @@ DCHECK(!replacement_thread_group_); - in_start().wakeup_after_getwork = FeatureList::IsEnabled(kWakeUpAfterGetWork); - in_start().wakeup_strategy = kWakeUpStrategyParam.Get(); - in_start().may_block_without_delay = - FeatureList::IsEnabled(kMayBlockWithoutDelay); in_start().may_block_threshold = may_block_threshold ? may_block_threshold.value() : (thread_type_hint_ == ThreadType::kDefault @@ -612,12 +608,8 @@ // Note: FlushWorkerCreation() below releases |outer_->lock_|. It is thus // important that all other operations come after it to keep this method // transactional. - if (!outer_->after_start().wakeup_after_getwork && - outer_->after_start().wakeup_strategy != - WakeUpStrategy::kCentralizedWakeUps) { - outer_->EnsureEnoughWorkersLockRequired(&executor); - executor.FlushWorkerCreation(&outer_->lock_); - } + outer_->EnsureEnoughWorkersLockRequired(&executor); + executor.FlushWorkerCreation(&outer_->lock_); if (!CanGetWorkLockRequired(&executor, worker)) return nullptr; @@ -648,12 +640,6 @@ write_worker().current_task_priority = priority; write_worker().current_shutdown_behavior = task_source->shutdown_behavior(); - if (outer_->after_start().wakeup_after_getwork && - outer_->after_start().wakeup_strategy != - WakeUpStrategy::kCentralizedWakeUps) { - outer_->EnsureEnoughWorkersLockRequired(&executor); - } - return task_source; } @@ -832,10 +818,8 @@ worker_only().worker_thread_->MaybeUpdateThreadType(); - // MayBlock with no delay reuses WillBlock implementation. // WillBlock is always used when time overrides is active. crbug.com/1038867 - if (outer_->after_start().may_block_without_delay || - base::subtle::ScopedTimeClockOverrides::overrides_active()) { + if (base::subtle::ScopedTimeClockOverrides::overrides_active()) { blocking_type = BlockingType::WILL_BLOCK; } @@ -870,10 +854,8 @@ // The blocking type always being WILL_BLOCK in this experiment and with time // overrides, it should never be considered "upgraded". - if (outer_->after_start().may_block_without_delay || - base::subtle::ScopedTimeClockOverrides::overrides_active()) { + if (base::subtle::ScopedTimeClockOverrides::overrides_active()) return; - } ScopedCommandsExecutor executor(outer_.get()); CheckedAutoLock auto_lock(outer_->lock_); @@ -1117,12 +1099,7 @@ size_t num_workers_to_wake_up = ClampSub(desired_num_awake_workers, num_awake_workers); - if (after_start().wakeup_strategy == WakeUpStrategy::kExponentialWakeUps) { - num_workers_to_wake_up = std::min(num_workers_to_wake_up, size_t(2U)); - } else if (after_start().wakeup_strategy == - WakeUpStrategy::kSerializedWakeUps) { - num_workers_to_wake_up = std::min(num_workers_to_wake_up, size_t(1U)); - } + num_workers_to_wake_up = std::min(num_workers_to_wake_up, size_t(2U)); // Wake up the appropriate number of workers. for (size_t i = 0; i < num_workers_to_wake_up; ++i) {
diff --git a/base/task/thread_pool/thread_group_impl.h b/base/task/thread_pool/thread_group_impl.h index c00a5eb..fb3a8c8d 100644 --- a/base/task/thread_pool/thread_group_impl.h +++ b/base/task/thread_pool/thread_group_impl.h
@@ -253,10 +253,6 @@ // Optional observer notified when a worker enters and exits its main. raw_ptr<WorkerThreadObserver> worker_thread_observer = nullptr; - WakeUpStrategy wakeup_strategy; - bool wakeup_after_getwork; - bool may_block_without_delay; - // Threshold after which the max tasks is increased to compensate for a // worker that is within a MAY_BLOCK ScopedBlockingCall. TimeDelta may_block_threshold;
diff --git a/base/task/thread_pool/thread_pool_impl.cc b/base/task/thread_pool/thread_pool_impl.cc index 205ed148..df36007 100644 --- a/base/task/thread_pool/thread_pool_impl.cc +++ b/base/task/thread_pool/thread_pool_impl.cc
@@ -125,11 +125,6 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!started_); - disable_job_yield_ = FeatureList::IsEnabled(kDisableJobYield); - disable_fair_scheduling_ = FeatureList::IsEnabled(kDisableFairJobScheduling); - disable_job_update_priority_ = - FeatureList::IsEnabled(kDisableJobUpdatePriority); - // The max number of concurrent BEST_EFFORT tasks is |kMaxBestEffortTasks|, // unless the max number of foreground threads is lower. const size_t max_best_effort_tasks = @@ -470,8 +465,6 @@ } bool ThreadPoolImpl::ShouldYield(const TaskSource* task_source) { - if (disable_job_yield_) - return false; const TaskPriority priority = task_source->priority_racy(); auto* const thread_group = GetThreadGroupForTraits({priority, task_source->thread_policy()}); @@ -480,7 +473,7 @@ if (!thread_group->IsBoundToCurrentThread()) return true; return GetThreadGroupForTraits({priority, task_source->thread_policy()}) - ->ShouldYield(task_source->GetSortKey(disable_fair_scheduling_)); + ->ShouldYield(task_source->GetSortKey()); } bool ThreadPoolImpl::EnqueueJobTaskSource( @@ -543,8 +536,6 @@ void ThreadPoolImpl::UpdateJobPriority(scoped_refptr<TaskSource> task_source, TaskPriority priority) { - if (disable_job_update_priority_) - return; UpdatePriority(std::move(task_source), priority); }
diff --git a/base/task/thread_pool/thread_pool_impl.h b/base/task/thread_pool/thread_pool_impl.h index b6eb4c6..822b134 100644 --- a/base/task/thread_pool/thread_pool_impl.h +++ b/base/task/thread_pool/thread_pool_impl.h
@@ -149,10 +149,6 @@ std::unique_ptr<ThreadGroup> foreground_thread_group_; std::unique_ptr<ThreadGroup> background_thread_group_; - bool disable_job_yield_ = false; - bool disable_fair_scheduling_ = false; - std::atomic<bool> disable_job_update_priority_{false}; - // Whether this TaskScheduler was started. bool started_ GUARDED_BY_CONTEXT(sequence_checker_) = false;
diff --git a/buildtools/deps_revisions.gni b/buildtools/deps_revisions.gni index 8c41409..5703ce3a 100644 --- a/buildtools/deps_revisions.gni +++ b/buildtools/deps_revisions.gni
@@ -5,5 +5,5 @@ declare_args() { # Used to cause full rebuilds on libc++ rolls. This should be kept in sync # with the libcxx_revision vars in //DEPS. - libcxx_revision = "60c266d87cfd8cd7c9a541ea7095ee44a235a3ec" + libcxx_revision = "aa3a6cd0f158bdc037268cbe06e2bfd8067fa951" }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediatorTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediatorTest.java index ccec667..89815cf 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediatorTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediatorTest.java
@@ -296,11 +296,7 @@ Promise<HistoryClustersResult> promise = new Promise<>(); doReturn(promise).when(mBridge).queryClusters("query"); - // In production code, calling setQueryState() will end up calling startQuery via - // onSearchTextChanged. In mediator tests we don't have view binders set up so we need to - // call both. mMediator.setQueryState(QueryState.forQuery("query", "")); - mMediator.startQuery("query"); assertEquals(1, mModelList.size()); ListItem spinnerItem = mModelList.get(0); assertEquals(spinnerItem.type, ItemType.MORE_PROGRESS); @@ -352,7 +348,6 @@ doReturn(secondPromise).when(mBridge).loadMoreClusters("query"); mMediator.setQueryState(QueryState.forQuery("query", "")); - mMediator.startQuery("query"); assertEquals(1, mModelList.size()); ListItem spinnerItem = mModelList.get(0); @@ -394,7 +389,6 @@ doReturn(promise).when(mBridge).queryClusters(""); mMediator.setQueryState(QueryState.forQueryless()); - mMediator.startQuery(""); fulfillPromise(promise, mHistoryClustersResultEmptyQuery); // Two clusters + the header views (privacy disclaimer, clear browsing data, toggle). @@ -408,6 +402,23 @@ assertTrue(model.getAllSetProperties().containsAll( Arrays.asList(HistoryClustersItemProperties.CLICK_HANDLER, HistoryClustersItemProperties.TITLE, HistoryClustersItemProperties.LABEL))); + assertFalse(mToolbarModel.get(HistoryClustersToolbarProperties.QUERY_STATE).isSearching()); + + promise = new Promise<>(); + doReturn(promise).when(mBridge).queryClusters(""); + + mMediator.setQueryState(QueryState.forQuery("", "")); + fulfillPromise(promise, mHistoryClustersResultEmptyQuery); + + // The contents of the model list should be the same for an empty query in queryfull state + // vs the queryless state, except that the queryfull state shouldn't have headers. + assertEquals(mModelList.size(), mHistoryClustersResultEmptyQuery.getClusters().size()); + assertThat(mModelList, hasItemTypes(ItemType.CLUSTER, ItemType.CLUSTER)); + + assertTrue(mModelList.get(0).model.getAllSetProperties().containsAll( + Arrays.asList(HistoryClustersItemProperties.CLICK_HANDLER, + HistoryClustersItemProperties.TITLE, HistoryClustersItemProperties.LABEL))); + assertTrue(mToolbarModel.get(HistoryClustersToolbarProperties.QUERY_STATE).isSearching()); } @Test @@ -416,7 +427,6 @@ doReturn(promise).when(mBridge).queryClusters(""); mMediator.setQueryState(QueryState.forQueryless()); - mMediator.startQuery(""); fulfillPromise(promise, HistoryClustersResult.emptyResult()); assertThat(mModelList, @@ -463,7 +473,6 @@ doReturn(new Promise<>()).when(mBridge).queryClusters("pan"); // Add a dummy entry to mModelList so we can check it was cleared. mModelList.add(new ListItem(42, new PropertyModel())); - mMediator.setQueryState(QueryState.forQuery("pan", "")); mMediator.onSearchTextChanged("pan"); assertEquals(mModelList.size(), 1); @@ -482,6 +491,7 @@ @Test public void testSetQueryState() { + doReturn(new Promise<>()).when(mBridge).queryClusters("pandas"); mMediator.setQueryState(QueryState.forQuery("pandas", "empty string")); assertEquals(mToolbarModel.get(HistoryClustersToolbarProperties.QUERY_STATE).getQuery(), "pandas"); @@ -615,7 +625,6 @@ doReturn(3).when(mLayoutManager).findLastVisibleItemPosition(); mMediator.setQueryState(QueryState.forQuery("query", "")); - mMediator.startQuery("query"); fulfillPromise(promise, mHistoryClustersResultWithQuery); mMediator.onScrolled(mRecyclerView, 1, 1); @@ -652,7 +661,6 @@ Promise<HistoryClustersResult> promise = new Promise(); doReturn(promise).when(mBridge).queryClusters("query"); mMediator.setQueryState(QueryState.forQuery("query", "")); - mMediator.startQuery("query"); fulfillPromise(promise, mHistoryClustersResultWithQuery); int initialSize = mModelList.size(); doReturn("multiple") @@ -757,7 +765,6 @@ doReturn(promise).when(mBridge).queryClusters("query"); mMediator.setQueryState(QueryState.forQuery("query", "")); - mMediator.startQuery("query"); fulfillPromise(promise, mHistoryClustersResultWithQuery); mMediator.deleteVisits(Arrays.asList(mVisit1)); @@ -783,7 +790,6 @@ promise = new Promise<>(); doReturn(promise).when(mBridge).queryClusters("query"); - mMediator.setQueryState(QueryState.forQuery("query", "")); mMediator.onSearchTextChanged("query"); fulfillPromise(promise, mHistoryClustersResultWithQuery); @@ -799,7 +805,6 @@ doReturn(promise).when(mBridge).queryClusters("query"); mMediator.setQueryState(QueryState.forQuery("query", "")); - mMediator.startQuery("query"); fulfillPromise(promise, mHistoryClustersResultWithQuery); assertEquals(mModelList.get(1).type, ItemType.VISIT); @@ -814,13 +819,13 @@ assertFalse(mModelList.get(1).model.get(HistoryClustersItemProperties.END_BUTTON_VISIBLE)); assertFalse(mModelList.get(2).model.get(HistoryClustersItemProperties.END_BUTTON_VISIBLE)); } + @Test public void testHideDeleteButtonWhenSelectionToggled() { Promise<HistoryClustersResult> promise = new Promise<>(); doReturn(promise).when(mBridge).queryClusters("query"); mMediator.setQueryState(QueryState.forQuery("query", "")); - mMediator.startQuery("query"); fulfillPromise(promise, mHistoryClustersResultWithQuery); assertEquals(ItemType.CLUSTER, mModelList.get(0).type);
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 09c50e7..bf35213 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -5633,6 +5633,12 @@ </message> </if> + <if expr="not is_android"> + <message name="IDS_WEB_APP_DETAILED_INSTALL_DIALOG_DESCRIPTION_TITLE" desc="Title above app description to explain the content below is from this app"> + From the app + </message> + </if> + <message name="IDS_WEB_APP_MENU_BUTTON_TOOLTIP"> Customize and control <ph name="APP_NAME">$1<ex>GMail</ex></ph> </message> @@ -10303,6 +10309,9 @@ <message name="IDS_TRANSLATE_BUBBLE_TRANSLATED_TITLE" desc="Title text for the translate bubble label when the page has been translated from one language to another"> Translated </message> + <message name="IDS_PARTIAL_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE_TITLE" desc="Title text for the partial translate bubble label when the text selection could not be translated. This is also announced to the screenreader."> + The selection could not be translated at this time + </message> <message name="IDS_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE_TITLE" desc="Title text for the translate bubble label when the page could not be translated. This is also announced to the screenreader."> This page could not be translated </message>
diff --git a/chrome/app/generated_resources_grd/IDS_PARTIAL_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE_TITLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_PARTIAL_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE_TITLE.png.sha1 new file mode 100644 index 0000000..994f1d8f --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_PARTIAL_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE_TITLE.png.sha1
@@ -0,0 +1 @@ +8754e437086cac98d95de5a3a443cb4ef7de0134 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_WEB_APP_DETAILED_INSTALL_DIALOG_DESCRIPTION_TITLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_WEB_APP_DETAILED_INSTALL_DIALOG_DESCRIPTION_TITLE.png.sha1 new file mode 100644 index 0000000..66fe1fb9 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_WEB_APP_DETAILED_INSTALL_DIALOG_DESCRIPTION_TITLE.png.sha1
@@ -0,0 +1 @@ +ca6cc3331492543fc0f4d89fec9155f9dd8a92e2 \ No newline at end of file
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 13c6173..40ae19bc 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -5611,6 +5611,10 @@ kTabScrollingVariations, "TabScrolling")}, + {"split-tabstrip", flag_descriptions::kSplitTabStripName, + flag_descriptions::kSplitTabStripDescription, kOsDesktop, + FEATURE_VALUE_TYPE(features::kSplitTabStrip)}, + {"side-panel-improved-clobbering", flag_descriptions::kSidePanelImprovedClobberingName, flag_descriptions::kSidePanelImprovedClobberingDescription, kOsDesktop,
diff --git a/chrome/browser/accessibility/accessibility_labels_service.cc b/chrome/browser/accessibility/accessibility_labels_service.cc index bab03a4..f509f6c 100644 --- a/chrome/browser/accessibility/accessibility_labels_service.cc +++ b/chrome/browser/accessibility/accessibility_labels_service.cc
@@ -234,14 +234,11 @@ ui::AXActionData action_data; action_data.action = ax::mojom::Action::kAnnotatePageImages; web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating( - [](const ui::AXActionData& action_data, - content::RenderFrameHost* render_frame_host) { - if (render_frame_host->IsRenderFrameLive()) { - render_frame_host->AccessibilityPerformAction(action_data); - } - }, - action_data)); + [&action_data](content::RenderFrameHost* render_frame_host) { + if (render_frame_host->IsRenderFrameLive()) { + render_frame_host->AccessibilityPerformAction(action_data); + } + }); #endif } @@ -358,13 +355,10 @@ ui::AXActionData action_data; action_data.action = ax::mojom::Action::kAnnotatePageImages; web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating( - [](const ui::AXActionData& action_data, - content::RenderFrameHost* render_frame_host) { - if (render_frame_host->IsRenderFrameLive()) { - render_frame_host->AccessibilityPerformAction(action_data); - } - }, - action_data)); + [&action_data](content::RenderFrameHost* render_frame_host) { + if (render_frame_host->IsRenderFrameLive()) { + render_frame_host->AccessibilityPerformAction(action_data); + } + }); } #endif
diff --git a/chrome/browser/android/customtabs/client_data_header_web_contents_observer.cc b/chrome/browser/android/customtabs/client_data_header_web_contents_observer.cc index bec1099..272f1ab 100644 --- a/chrome/browser/android/customtabs/client_data_header_web_contents_observer.cc +++ b/chrome/browser/android/customtabs/client_data_header_web_contents_observer.cc
@@ -21,9 +21,10 @@ void ClientDataHeaderWebContentsObserver::SetHeader(const std::string& header) { header_ = header; - web_contents()->ForEachRenderFrameHost(base::BindRepeating( - &ClientDataHeaderWebContentsObserver::UpdateFrameCCTHeader, - base::Unretained(this))); + web_contents()->ForEachRenderFrameHost( + [this](content::RenderFrameHost* render_frame_host) { + UpdateFrameCCTHeader(render_frame_host); + }); } void ClientDataHeaderWebContentsObserver::RenderFrameCreated(
diff --git a/chrome/browser/android/document/document_web_contents_delegate.cc b/chrome/browser/android/document/document_web_contents_delegate.cc index 0e904879..eb480c84 100644 --- a/chrome/browser/android/document/document_web_contents_delegate.cc +++ b/chrome/browser/android/document/document_web_contents_delegate.cc
@@ -32,7 +32,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_pos, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) { NOTREACHED();
diff --git a/chrome/browser/android/document/document_web_contents_delegate.h b/chrome/browser/android/document/document_web_contents_delegate.h index 5b4d709..6f4a0f1 100644 --- a/chrome/browser/android/document/document_web_contents_delegate.h +++ b/chrome/browser/android/document/document_web_contents_delegate.h
@@ -33,7 +33,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_pos, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; void CloseContents(content::WebContents* source) override;
diff --git a/chrome/browser/android/tab_web_contents_delegate_android.cc b/chrome/browser/android/tab_web_contents_delegate_android.cc index 634f21382..307cf99 100644 --- a/chrome/browser/android/tab_web_contents_delegate_android.cc +++ b/chrome/browser/android/tab_web_contents_delegate_android.cc
@@ -363,7 +363,7 @@ std::unique_ptr<WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) { // No code for this yet.
diff --git a/chrome/browser/android/tab_web_contents_delegate_android.h b/chrome/browser/android/tab_web_contents_delegate_android.h index b578e50..8ca8868 100644 --- a/chrome/browser/android/tab_web_contents_delegate_android.h +++ b/chrome/browser/android/tab_web_contents_delegate_android.h
@@ -84,7 +84,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; void OnDidBlockNavigation(
diff --git a/chrome/browser/ash/accessibility/dictation_browsertest.cc b/chrome/browser/ash/accessibility/dictation_browsertest.cc index 25c3501..1b3ed70f 100644 --- a/chrome/browser/ash/accessibility/dictation_browsertest.cc +++ b/chrome/browser/ash/accessibility/dictation_browsertest.cc
@@ -851,7 +851,7 @@ IN_PROC_BROWSER_TEST_P(DictationJaTest, DeleteCharacter) { ToggleDictationWithKeystroke(); WaitForRecognitionStarted(); - // Dictate something. + // Dictate "tennis". SendFinalResultAndWaitForTextAreaValue("テニス", "テニス"); // Perform the 'delete' command. SendFinalResultAndWaitForTextAreaValue("削除", "テニ"); @@ -859,6 +859,32 @@ WaitForRecognitionStopped(); } +IN_PROC_BROWSER_TEST_P(DictationJaTest, SmartDeletePhrase) { + ToggleDictationWithKeystroke(); + WaitForRecognitionStarted(); + // Dictate "I like basketball". + SendFinalResultAndWaitForTextAreaValue("私はバスケットボールが好きです。", + "私はバスケットボールが好きです。"); + // Delete "I" e.g. the first two characters in the sentence. + SendFinalResultAndWaitForTextAreaValue("私はを削除", + "バスケットボールが好きです。"); + ToggleDictationWithKeystroke(); + WaitForRecognitionStopped(); +} + +IN_PROC_BROWSER_TEST_P(DictationJaTest, SmartReplacePhrase) { + ToggleDictationWithKeystroke(); + WaitForRecognitionStarted(); + // Dictate "I like basketball". + SendFinalResultAndWaitForTextAreaValue("私はバスケットボールが好きです。", + "私はバスケットボールが好きです。"); + // Replace "basketball" with "tennis". + SendFinalResultAndWaitForTextAreaValue("バスケットボールをテニスに置き換え", + "私はテニスが好きです。"); + ToggleDictationWithKeystroke(); + WaitForRecognitionStopped(); +} + class DictationCommandsTest : public DictationTest { protected: DictationCommandsTest() {}
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc index d0fd8955..6e13d64 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc
@@ -2479,23 +2479,19 @@ if (name == "executeScriptInChromeUntrusted") { for (auto* web_contents : GetAllWebContents()) { bool found = false; - web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating( - [](const base::Value::Dict& value, bool& found, - std::string* output, content::RenderFrameHost* frame) { - const url::Origin origin = frame->GetLastCommittedOrigin(); - if (origin.GetURL() == - ash::file_manager::kChromeUIFileManagerUntrustedURL) { - const std::string* script = value.FindString("data"); - EXPECT_TRUE(script); - CHECK(ExecuteScriptAndExtractString(frame, *script, output)); - found = true; - return content::RenderFrameHost::FrameIterationAction::kStop; - } - return content::RenderFrameHost::FrameIterationAction:: - kContinue; - }, - std::ref(value), std::ref(found), output)); + web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHostWithAction( + [&value, output, &found](content::RenderFrameHost* frame) { + const url::Origin origin = frame->GetLastCommittedOrigin(); + if (origin.GetURL() == + ash::file_manager::kChromeUIFileManagerUntrustedURL) { + const std::string* script = value.FindString("data"); + EXPECT_TRUE(script); + CHECK(ExecuteScriptAndExtractString(frame, *script, output)); + found = true; + return content::RenderFrameHost::FrameIterationAction::kStop; + } + return content::RenderFrameHost::FrameIterationAction::kContinue; + }); if (found) return; }
diff --git a/chrome/browser/ash/login/webview_login_browsertest.cc b/chrome/browser/ash/login/webview_login_browsertest.cc index 9a6d9bd..8934cbb 100644 --- a/chrome/browser/ash/login/webview_login_browsertest.cc +++ b/chrome/browser/ash/login/webview_login_browsertest.cc
@@ -353,14 +353,14 @@ auto* login_main_frame = GetLoginUI()->GetWebContents()->GetPrimaryMainFrame(); - login_main_frame->ForEachRenderFrameHost( - base::BindLambdaForTesting([&](content::RenderFrameHost* rfh) { + login_main_frame->ForEachRenderFrameHostWithAction( + [&](content::RenderFrameHost* rfh) { if (rfh->GetStoragePartition() == storage_partition) { web_view_found = true; return content::RenderFrameHost::FrameIterationAction::kStop; } return content::RenderFrameHost::FrameIterationAction::kContinue; - })); + }); return web_view_found; }
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector.cc b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector.cc index 303a34e..2cbd86f 100644 --- a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector.cc +++ b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector.cc
@@ -182,6 +182,7 @@ event->set_event_type( success ? em::AppInstallReportLogEvent::INSTALLATION_FINISHED : em::AppInstallReportLogEvent::INSTALLATION_FAILED); + delegate_->UpdatePolicySuccessRate(package_name, success); delegate_->Add(package_name, true /* gather_disk_space_info */, std::move(event)); }
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector.h b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector.h index 6bc25f9..11dd353 100644 --- a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector.h +++ b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector.h
@@ -49,6 +49,10 @@ std::unique_ptr<enterprise_management::AppInstallReportLogEvent> event) = 0; + // Uses a package's installation status to update policy success rate data. + virtual void UpdatePolicySuccessRate(const std::string& package, + bool success) = 0; + protected: virtual ~Delegate() = default; };
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector_unittest.cc b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector_unittest.cc index e815e9eac..b3b773e 100644 --- a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector_unittest.cc +++ b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector_unittest.cc
@@ -83,19 +83,43 @@ package_name, *event); } + void UpdatePolicySuccessRate(const std::string& package_name, + bool success) override { + ++update_policy_success_rate_count_; + auto event = std::make_unique<em::AppInstallReportLogEvent>(); + event->set_event_type( + success ? em::AppInstallReportLogEvent::INSTALLATION_FINISHED + : em::AppInstallReportLogEvent::INSTALLATION_FAILED); + + requests_.emplace_back(false /* for_all */, false /* add_disk_space_info */, + package_name, *event); + } + int add_for_all_count() const { return add_for_all_count_; } int add_count() const { return add_count_; } + int update_policy_success_rate_count() const { + return update_policy_success_rate_count_; + } + const em::AppInstallReportLogEvent& last_event() const { return last_request().event; } const Request& last_request() const { return requests_.back(); } + + const em::AppInstallReportLogEvent& event_at(int index) const { + return request_at(index).event; + } + + const Request& request_at(int index) const { return requests_.at(index); } + const std::vector<Request>& requests() const { return requests_; } private: int add_for_all_count_ = 0; int add_count_ = 0; + int update_policy_success_rate_count_ = 0; std::vector<Request> requests_; }; @@ -198,6 +222,7 @@ EXPECT_EQ(0, delegate()->add_count()); EXPECT_EQ(0, delegate()->add_for_all_count()); + EXPECT_EQ(0, delegate()->update_policy_success_rate_count()); } TEST_F(ArcAppInstallEventLogCollectorTest, LoginLogout) { @@ -461,4 +486,34 @@ EXPECT_TRUE(delegate()->last_request().add_disk_space_info); } +TEST_F(ArcAppInstallEventLogCollectorTest, + UpdatePolicySuccessRate_InstallSuccess) { + std::unique_ptr<ArcAppInstallEventLogCollector> collector = + std::make_unique<ArcAppInstallEventLogCollector>(delegate(), profile(), + packages_); + collector->OnInstallationFinished(kPackageName, /* success */ true); + + int second_to_last_request_index = delegate()->requests().size() - 2; + EXPECT_EQ(1, delegate()->update_policy_success_rate_count()); + EXPECT_EQ(em::AppInstallReportLogEvent::INSTALLATION_FINISHED, + delegate()->event_at(second_to_last_request_index).event_type()); + EXPECT_EQ(kPackageName, + delegate()->request_at(second_to_last_request_index).package_name); +} + +TEST_F(ArcAppInstallEventLogCollectorTest, + UpdatePolicySuccessRate_InstallFailure) { + std::unique_ptr<ArcAppInstallEventLogCollector> collector = + std::make_unique<ArcAppInstallEventLogCollector>(delegate(), profile(), + packages_); + collector->OnInstallationFinished(kPackageName, /* success */ false); + + int second_to_last_request_index = delegate()->requests().size() - 2; + EXPECT_EQ(1, delegate()->update_policy_success_rate_count()); + EXPECT_EQ(em::AppInstallReportLogEvent::INSTALLATION_FAILED, + delegate()->event_at(second_to_last_request_index).event_type()); + EXPECT_EQ(kPackageName, + delegate()->request_at(second_to_last_request_index).package_name); +} + } // namespace policy
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_event_logger.cc b/chrome/browser/ash/policy/reporting/arc_app_install_event_logger.cc index fb06932..b64b5bb 100644 --- a/chrome/browser/ash/policy/reporting/arc_app_install_event_logger.cc +++ b/chrome/browser/ash/policy/reporting/arc_app_install_event_logger.cc
@@ -115,6 +115,12 @@ AddEvent(package, gather_disk_space_info, event); } +void ArcAppInstallEventLogger::UpdatePolicySuccessRate( + const std::string& package, + bool success) { + policy_data_helper_.UpdatePolicySuccessRate(package, success); +} + void ArcAppInstallEventLogger::OnPolicyUpdated(const PolicyNamespace& ns, const PolicyMap& previous, const PolicyMap& current) { @@ -134,10 +140,12 @@ return; } + const std::set<std::string> all_force_install_apps_in_policy = + GetPackagesFromPref(arc::prefs::kArcPushInstallAppsRequested); const std::set<std::string> previous_pending = GetPackagesFromPref(arc::prefs::kArcPushInstallAppsPending); - std::set<std::string> pending_in_arc; + std::set<std::string> noncompliant_apps_in_report; for (const auto& detail : details->GetListDeprecated()) { const base::Value* const reason = detail.FindKeyOfType("nonComplianceReason", base::Value::Type::INTEGER); @@ -149,23 +157,28 @@ if (!app_name || app_name->GetString().empty()) { continue; } - pending_in_arc.insert(app_name->GetString()); + noncompliant_apps_in_report.insert(app_name->GetString()); } - const std::set<std::string> current_pending = GetDifference( - previous_pending, GetDifference(requested_in_arc_, pending_in_arc)); - const std::set<std::string> removed = - GetDifference(previous_pending, current_pending); - AddForSetOfAppsWithDiskSpaceInfo( - removed, CreateEvent(em::AppInstallReportLogEvent::SUCCESS)); + const std::set<std::string> all_installed_apps = GetDifference( + all_force_install_apps_in_policy, noncompliant_apps_in_report); - if (removed.empty()) { + std::set<std::string> newly_installed_apps; + std::set_intersection( + previous_pending.begin(), previous_pending.end(), + all_installed_apps.begin(), all_installed_apps.end(), + std::inserter(newly_installed_apps, newly_installed_apps.end())); + + AddForSetOfAppsWithDiskSpaceInfo( + newly_installed_apps, CreateEvent(em::AppInstallReportLogEvent::SUCCESS)); + + if (newly_installed_apps.empty()) { return; } - SetPref(arc::prefs::kArcPushInstallAppsPending, current_pending); + SetPref(arc::prefs::kArcPushInstallAppsPending, noncompliant_apps_in_report); - if (!current_pending.empty()) { - UpdateCollector(current_pending); + if (!noncompliant_apps_in_report.empty()) { + UpdateCollector(noncompliant_apps_in_report); } else { StopCollector(); } @@ -223,12 +236,20 @@ AddForSetOfAppsWithDiskSpaceInfo( added, CreateEvent(em::AppInstallReportLogEvent::SERVER_REQUEST)); AddForSetOfApps(removed, CreateEvent(em::AppInstallReportLogEvent::CANCELED)); + // Consider canceled packages as successful since they are not needed + policy_data_helper_.UpdatePolicySuccessRateForPackages(removed, + /* success */ true); - const std::set<std::string> current_pending = GetDifference( - current_requested, GetDifference(previous_requested, previous_pending)); + const std::set<std::string> previously_installed = + GetDifference(previous_requested, previous_pending); + const std::set<std::string> current_pending = + GetDifference(current_requested, previously_installed); SetPref(arc::prefs::kArcPushInstallAppsRequested, current_requested); SetPref(arc::prefs::kArcPushInstallAppsPending, current_pending); + policy_data_helper_.AddPolicyData(current_pending, + previously_installed.size()); + if (!current_pending.empty()) { UpdateCollector(current_pending); if (initial) {
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_event_logger.h b/chrome/browser/ash/policy/reporting/arc_app_install_event_logger.h index 3e3cfdf..c134e7e 100644 --- a/chrome/browser/ash/policy/reporting/arc_app_install_event_logger.h +++ b/chrome/browser/ash/policy/reporting/arc_app_install_event_logger.h
@@ -12,6 +12,7 @@ #include "base/memory/weak_ptr.h" #include "chrome/browser/ash/arc/policy/arc_policy_bridge.h" #include "chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector.h" +#include "chrome/browser/ash/policy/reporting/arc_app_install_policy_data_helper.h" #include "chrome/browser/ash/policy/reporting/install_event_logger_base.h" #include "components/policy/core/common/policy_service.h" #include "components/policy/proto/device_management_backend.pb.h" @@ -93,6 +94,8 @@ bool gather_disk_space_info, std::unique_ptr<enterprise_management::AppInstallReportLogEvent> event) override; + void UpdatePolicySuccessRate(const std::string& package, + bool success) override; // PolicyService::Observer: void OnPolicyUpdated(const PolicyNamespace& ns, @@ -152,6 +155,9 @@ // app push-install requests. std::unique_ptr<ArcAppInstallEventLogCollector> log_collector_; + // Handles operations for tracking policy metrics. + ArcAppInstallPolicyDataHelper policy_data_helper_; + // Weak factory used to reference |this| from background tasks. base::WeakPtrFactory<ArcAppInstallEventLogger> weak_factory_{this}; };
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_event_logger_unittest.cc b/chrome/browser/ash/policy/reporting/arc_app_install_event_logger_unittest.cc index b4cd81a..e4d87996 100644 --- a/chrome/browser/ash/policy/reporting/arc_app_install_event_logger_unittest.cc +++ b/chrome/browser/ash/policy/reporting/arc_app_install_event_logger_unittest.cc
@@ -144,6 +144,28 @@ MOCK_CONST_METHOD1(GetAndroidId_, void(AndroidIdCallback*)); }; +class MockArcAppInstallPolicyDataHelper : public ArcAppInstallPolicyDataHelper { + public: + MockArcAppInstallPolicyDataHelper() = default; + + MockArcAppInstallPolicyDataHelper(const MockArcAppInstallPolicyDataHelper&) = + delete; + MockArcAppInstallPolicyDataHelper& operator=( + const MockArcAppInstallPolicyDataHelper&) = delete; + + MOCK_METHOD2(AddPolicyData, + void(const std::set<std::string>& current_pending, + std::int64_t num_apps_previously_installed)); + + MOCK_METHOD(void, CheckForPolicyDataTimeout, ()); + + MOCK_METHOD2(UpdatePolicySuccessRate, + void(const std::string& package, bool success)); + + MOCK_METHOD2(UpdatePolicySuccessRateForPackages, + void(const std::set<std::string>& packages, bool success)); +}; + void SetPolicy(PolicyMap* map, const char* name, base::Value value) { map->Set(name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, std::move(value), nullptr); @@ -221,6 +243,44 @@ }))); } + PolicyMap CreatePolicyWithForceInstalls(std::set<std::string> package_names) { + PolicyMap policy_map; + + base::DictionaryValue arc_policy; + auto list = std::make_unique<base::ListValue>(); + + for (std::string package_name : package_names) { + base::Value::Dict package; + package.Set("installType", "FORCE_INSTALLED"); + package.Set("packageName", package_name); + list->Append(base::Value(std::move(package))); + } + + arc_policy.SetList("applications", std::move(list)); + std::string arc_policy_string; + base::JSONWriter::Write(arc_policy, &arc_policy_string); + SetPolicy(&policy_map, key::kArcEnabled, base::Value(true)); + SetPolicy(&policy_map, key::kArcPolicy, base::Value(arc_policy_string)); + + return policy_map; + } + + base::DictionaryValue CreateComplianceReport( + std::set<std::string> noncompliant_packages) { + auto details = std::make_unique<base::ListValue>(); + + for (std::string package_name : noncompliant_packages) { + base::Value::Dict package; + package.Set("nonComplianceReason", 5); + package.Set("packageName", package_name); + details->Append(base::Value(std::move(package))); + } + + base::DictionaryValue compliance_report; + compliance_report.SetList("nonComplianceDetails", std::move(details)); + return compliance_report; + } + content::BrowserTaskEnvironment task_environment_; ash::NetworkHandlerTestHelper network_handler_test_helper_; TestingProfile profile_; @@ -228,6 +288,8 @@ MockAppInstallEventLoggerDelegate delegate_; + MockArcAppInstallPolicyDataHelper policy_data_helper_; + em::AppInstallReportLogEvent event_; std::unique_ptr<ArcAppInstallEventLogger> logger_; @@ -461,4 +523,22 @@ g_browser_process->local_state()->SetBoolean(prefs::kWasRestarted, true); } +TEST_F(AppInstallEventLoggerTest, PolicySuccessRate_AddPolicyData) { + CreateLogger(); + logger_->SetStatefulPathForTesting(base::FilePath(kStatefulPath)); + PolicyMap policy = CreatePolicyWithForceInstalls({kPackageName}); + + logger_->OnPolicyUpdated(PolicyNamespace(), /* previous */ PolicyMap(), + policy); + ON_CALL(policy_data_helper_, UpdatePolicySuccessRateForPackages); + ON_CALL(policy_data_helper_, AddPolicyData); +} + +TEST_F(AppInstallEventLoggerTest, PolicySuccessRate_UpdatePolicySuccessRate) { + CreateLogger(); + logger_->SetStatefulPathForTesting(base::FilePath(kStatefulPath)); + logger_->UpdatePolicySuccessRate(kPackageName, true); + ON_CALL(policy_data_helper_, UpdatePolicySuccessRate); +} + } // namespace policy
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_policy_data.cc b/chrome/browser/ash/policy/reporting/arc_app_install_policy_data.cc new file mode 100644 index 0000000..2fd4003f --- /dev/null +++ b/chrome/browser/ash/policy/reporting/arc_app_install_policy_data.cc
@@ -0,0 +1,75 @@ +// Copyright 2022 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 "chrome/browser/ash/policy/reporting/arc_app_install_policy_data.h" + +#include <mutex> + +#include "base/logging.h" +#include "base/metrics/histogram_functions.h" + +namespace { + +// Timeout to record metrics even if all apps are not installed yet. +constexpr base::TimeDelta kTimeout = base::Minutes(30); + +std::mutex data_mutex; + +} // namespace + +namespace policy { + +ArcAppInstallPolicyData::ArcAppInstallPolicyData( + base::TimeTicks time_created, + const std::set<std::string>& requested_apps_pending, + std::int64_t success_count) { + std::int64_t num_total_apps = success_count + requested_apps_pending.size(); + DCHECK(num_total_apps != 0); // prevent divide by 0 + time_created_ = time_created; + requested_apps_pending_ = requested_apps_pending; + success_count_ = success_count; + requested_apps_total_ = num_total_apps; + is_success_rate_recorded_ = false; +} + +ArcAppInstallPolicyData::~ArcAppInstallPolicyData() = default; + +ArcAppInstallPolicyData::ArcAppInstallPolicyData( + const ArcAppInstallPolicyData& other) { + time_created_ = other.time_created_; + requested_apps_pending_ = other.requested_apps_pending_; + success_count_ = other.success_count_; + requested_apps_total_ = other.requested_apps_total_; + is_success_rate_recorded_ = other.is_success_rate_recorded_; +} + +bool ArcAppInstallPolicyData::operator<( + ArcAppInstallPolicyData const& other) const { + return time_created_ < other.time_created_; +} + +bool ArcAppInstallPolicyData::UpdatePackageInstallResult( + const std::string& package, + bool success) const { + if (requested_apps_pending_.erase(package) == 1 && success) + ++success_count_; + + return MaybeRecordSuccessRate(); +} + +bool ArcAppInstallPolicyData::MaybeRecordSuccessRate() const { + const std::lock_guard<std::mutex> lock(data_mutex); + if (requested_apps_pending_.empty() || + base::TimeTicks::Now() - time_created_ >= kTimeout) { + if (!is_success_rate_recorded_) { + std::int64_t rate = (double)success_count_ / requested_apps_total_ * 100; + base::UmaHistogramPercentage("Arc.AppInstall.PolicySuccessRate", rate); + is_success_rate_recorded_ = true; + } + return true; + } + return false; +} + +} // namespace policy
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_policy_data.h b/chrome/browser/ash/policy/reporting/arc_app_install_policy_data.h new file mode 100644 index 0000000..cbb05d8 --- /dev/null +++ b/chrome/browser/ash/policy/reporting/arc_app_install_policy_data.h
@@ -0,0 +1,58 @@ +// Copyright 2022 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. + +#ifndef CHROME_BROWSER_ASH_POLICY_REPORTING_ARC_APP_INSTALL_POLICY_DATA_H_ +#define CHROME_BROWSER_ASH_POLICY_REPORTING_ARC_APP_INSTALL_POLICY_DATA_H_ + +#include <set> +#include <string> + +#include "base/time/time.h" + +namespace policy { + +// Stores policy data that will be used to record metrics. +class ArcAppInstallPolicyData { + public: + ArcAppInstallPolicyData(base::TimeTicks time_created, + const std::set<std::string>& requested_apps_pending, + std::int64_t success_count); + + ~ArcAppInstallPolicyData(); + ArcAppInstallPolicyData(const ArcAppInstallPolicyData& other); + ArcAppInstallPolicyData& operator=(const ArcAppInstallPolicyData&) = delete; + + // Use time_created_ for comparisons since it is unique across policies + // for a single device/customer and will not change. + bool operator<(ArcAppInstallPolicyData const& other) const; + + // Updates data with package install result. Returns true when success rate + // metric was recorded. + bool UpdatePackageInstallResult(const std::string& package, + bool success) const; + + // Records success rate if there are no more pending packages or if the data + // has reached the time out. Returns true when metric was recorded. + bool MaybeRecordSuccessRate() const; + + private: + // Time this data was created. + base::TimeTicks time_created_; + + // Set of requested apps that have not been installed yet. + mutable std::set<std::string> requested_apps_pending_; + + // Number of apps for this policy that have successfully been installed. + mutable std::int64_t success_count_; + + // Total number of requested apps for this policy. + std::int64_t requested_apps_total_; + + // Whether or not the success rate has been recorded yet. + mutable bool is_success_rate_recorded_; +}; + +} // namespace policy + +#endif // CHROME_BROWSER_ASH_POLICY_REPORTING_ARC_APP_INSTALL_POLICY_DATA_H_
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_policy_data_helper.cc b/chrome/browser/ash/policy/reporting/arc_app_install_policy_data_helper.cc new file mode 100644 index 0000000..92e8982 --- /dev/null +++ b/chrome/browser/ash/policy/reporting/arc_app_install_policy_data_helper.cc
@@ -0,0 +1,71 @@ +// Copyright 2022 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 "chrome/browser/ash/policy/reporting/arc_app_install_policy_data_helper.h" + +#include <string> + +#include "base/logging.h" +#include "chrome/browser/ash/policy/reporting/arc_app_install_event_logger.h" + +namespace policy { + +ArcAppInstallPolicyDataHelper::ArcAppInstallPolicyDataHelper() = default; + +ArcAppInstallPolicyDataHelper::~ArcAppInstallPolicyDataHelper() = default; + +void ArcAppInstallPolicyDataHelper::AddPolicyData( + const std::set<std::string>& current_pending, + std::int64_t num_apps_previously_installed) { + if (!current_pending.empty()) { + ArcAppInstallPolicyData data(base::TimeTicks::Now(), current_pending, + num_apps_previously_installed); + policy_data_.insert(data); + if (!policy_data_timer_.IsRunning()) { + policy_data_timer_.Start( + FROM_HERE, base::Minutes(1), this, + &ArcAppInstallPolicyDataHelper::CheckForPolicyDataTimeout); + } + } +} + +void ArcAppInstallPolicyDataHelper::UpdatePolicySuccessRate( + const std::string& package, + bool success) { + std::set<ArcAppInstallPolicyData>::iterator it; + for (it = policy_data_.begin(); it != policy_data_.end();) { + bool isPolicyTrackingComplete = + it->UpdatePackageInstallResult(package, success); + if (isPolicyTrackingComplete) { + it = policy_data_.erase(it); + } else { + it++; + } + } +} + +void ArcAppInstallPolicyDataHelper::UpdatePolicySuccessRateForPackages( + const std::set<std::string>& packages, + bool success) { + for (std::string package : packages) { + UpdatePolicySuccessRate(package, success); + } +} + +void ArcAppInstallPolicyDataHelper::CheckForPolicyDataTimeout() { + std::set<ArcAppInstallPolicyData>::iterator it; + for (it = policy_data_.begin(); it != policy_data_.end();) { + bool isPolicyTimedOut = it->MaybeRecordSuccessRate(); + if (isPolicyTimedOut) { + it = policy_data_.erase(it); + } else { + it++; + } + } + + if (policy_data_.empty()) + policy_data_timer_.Stop(); +} + +} // namespace policy
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_policy_data_helper.h b/chrome/browser/ash/policy/reporting/arc_app_install_policy_data_helper.h new file mode 100644 index 0000000..fb0776d --- /dev/null +++ b/chrome/browser/ash/policy/reporting/arc_app_install_policy_data_helper.h
@@ -0,0 +1,50 @@ +// Copyright 2022 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. + +#ifndef CHROME_BROWSER_ASH_POLICY_REPORTING_ARC_APP_INSTALL_POLICY_DATA_HELPER_H_ +#define CHROME_BROWSER_ASH_POLICY_REPORTING_ARC_APP_INSTALL_POLICY_DATA_HELPER_H_ + +#include <stdint.h> +#include <set> + +#include "base/timer/timer.h" +#include "chrome/browser/ash/policy/reporting/arc_app_install_policy_data.h" + +namespace policy { + +// Handles operations to track policy metrics. +class ArcAppInstallPolicyDataHelper { + public: + ArcAppInstallPolicyDataHelper(); + ~ArcAppInstallPolicyDataHelper(); + + // Adds data for a new policy. + void AddPolicyData(const std::set<std::string>& current_pending, + std::int64_t num_apps_previously_installed); + + // Check if any policy data has timed out. + void CheckForPolicyDataTimeout(); + + // Updates policy data with new package info. + void UpdatePolicySuccessRate(const std::string& package, bool success); + + // Updates policy data for a set of packages. + void UpdatePolicySuccessRateForPackages(const std::set<std::string>& packages, + bool success); + + // For testing + std::set<ArcAppInstallPolicyData>* policy_data() { return &policy_data_; } + base::RepeatingTimer* policy_data_timer() { return &policy_data_timer_; } + + private: + // Data used to track metrics for single policies. + std::set<ArcAppInstallPolicyData> policy_data_; + + // Repeating timer to check if policy data has timed out. + base::RepeatingTimer policy_data_timer_; +}; + +} // namespace policy + +#endif // CHROME_BROWSER_ASH_POLICY_REPORTING_ARC_APP_INSTALL_POLICY_DATA_HELPER_H_
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_policy_data_helper_unittest.cc b/chrome/browser/ash/policy/reporting/arc_app_install_policy_data_helper_unittest.cc new file mode 100644 index 0000000..4c031d2 --- /dev/null +++ b/chrome/browser/ash/policy/reporting/arc_app_install_policy_data_helper_unittest.cc
@@ -0,0 +1,101 @@ +// Copyright 2022 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 "chrome/browser/ash/policy/reporting/arc_app_install_policy_data_helper.h" + +#include "base/time/time.h" +#include "content/public/test/browser_task_environment.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +constexpr char kPackageName[] = "com.example.app"; +constexpr char kPackageName2[] = "com.example.app2"; + +} // namespace + +namespace policy { + +class ArcAppInstallPolicyDataHelperTest : public testing::Test { + public: + ArcAppInstallPolicyDataHelperTest(const ArcAppInstallPolicyDataHelperTest&) = + delete; + ArcAppInstallPolicyDataHelperTest& operator=( + const ArcAppInstallPolicyDataHelperTest&) = delete; + + protected: + ArcAppInstallPolicyDataHelperTest() = default; + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + ArcAppInstallPolicyDataHelper policy_data_helper_; +}; + +TEST_F(ArcAppInstallPolicyDataHelperTest, AddPolicyData_NoPendingPackages) { + policy_data_helper_.AddPolicyData({}, 0); + EXPECT_EQ(0, policy_data_helper_.policy_data()->size()); + EXPECT_FALSE(policy_data_helper_.policy_data_timer()->IsRunning()); +} + +TEST_F(ArcAppInstallPolicyDataHelperTest, AddPolicyData) { + policy_data_helper_.AddPolicyData({kPackageName}, 0); + EXPECT_EQ(1, policy_data_helper_.policy_data()->size()); + EXPECT_TRUE(policy_data_helper_.policy_data_timer()->IsRunning()); +} + +TEST_F(ArcAppInstallPolicyDataHelperTest, + UpdatePolicySuccessRate_RemoveTrackedPolicy) { + policy_data_helper_.AddPolicyData({kPackageName}, 0); + EXPECT_EQ(1, policy_data_helper_.policy_data()->size()); + policy_data_helper_.UpdatePolicySuccessRate(kPackageName, /* success */ true); + EXPECT_EQ(0, policy_data_helper_.policy_data()->size()); +} + +TEST_F(ArcAppInstallPolicyDataHelperTest, + UpdatePolicySuccessRate_KeepUntrackedPolicy) { + policy_data_helper_.AddPolicyData({kPackageName, kPackageName2}, 0); + EXPECT_EQ(1, policy_data_helper_.policy_data()->size()); + policy_data_helper_.UpdatePolicySuccessRate(kPackageName, /* success */ true); + EXPECT_EQ(1, policy_data_helper_.policy_data()->size()); +} + +TEST_F(ArcAppInstallPolicyDataHelperTest, UpdatePolicySuccessRateForPackages) { + policy_data_helper_.AddPolicyData({kPackageName}, 0); + EXPECT_EQ(1, policy_data_helper_.policy_data()->size()); + + task_environment.AdvanceClock(base::Minutes(1)); + policy_data_helper_.AddPolicyData({kPackageName, kPackageName2}, 0); + EXPECT_EQ(2, policy_data_helper_.policy_data()->size()); + + policy_data_helper_.UpdatePolicySuccessRate(kPackageName, /* success */ true); + EXPECT_EQ(1, policy_data_helper_.policy_data()->size()); + + policy_data_helper_.UpdatePolicySuccessRate(kPackageName2, + /* success */ true); + EXPECT_EQ(0, policy_data_helper_.policy_data()->size()); +} + +TEST_F(ArcAppInstallPolicyDataHelperTest, + CheckForPolicyDataTimeout_HasTimedout) { + policy_data_helper_.AddPolicyData({kPackageName}, 0); + EXPECT_EQ(1, policy_data_helper_.policy_data()->size()); + EXPECT_TRUE(policy_data_helper_.policy_data_timer()->IsRunning()); + + task_environment.AdvanceClock(base::Minutes(30)); + policy_data_helper_.CheckForPolicyDataTimeout(); + EXPECT_EQ(0, policy_data_helper_.policy_data()->size()); + EXPECT_FALSE(policy_data_helper_.policy_data_timer()->IsRunning()); +} + +TEST_F(ArcAppInstallPolicyDataHelperTest, + CheckForPolicyDataTimeout_HasNotTimedout) { + policy_data_helper_.AddPolicyData({kPackageName}, 0); + EXPECT_EQ(1, policy_data_helper_.policy_data()->size()); + EXPECT_TRUE(policy_data_helper_.policy_data_timer()->IsRunning()); + + policy_data_helper_.CheckForPolicyDataTimeout(); + EXPECT_EQ(1, policy_data_helper_.policy_data()->size()); + EXPECT_TRUE(policy_data_helper_.policy_data_timer()->IsRunning()); +} + +} // namespace policy
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_policy_data_unittest.cc b/chrome/browser/ash/policy/reporting/arc_app_install_policy_data_unittest.cc new file mode 100644 index 0000000..e3bbb29 --- /dev/null +++ b/chrome/browser/ash/policy/reporting/arc_app_install_policy_data_unittest.cc
@@ -0,0 +1,96 @@ +// Copyright 2022 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 "chrome/browser/ash/policy/reporting/arc_app_install_policy_data.h" + +#include "base/test/gtest_util.h" +#include "base/test/metrics/histogram_tester.h" +#include "base/time/time.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +constexpr char kPackageName[] = "com.example.app"; +constexpr char kPackageName2[] = "com.example.app2"; + +} // namespace + +namespace policy { + +class ArcAppInstallPolicyDataTest : public testing::Test { + public: + ArcAppInstallPolicyDataTest(const ArcAppInstallPolicyDataTest&) = delete; + ArcAppInstallPolicyDataTest& operator=(const ArcAppInstallPolicyDataTest&) = + delete; + + protected: + ArcAppInstallPolicyDataTest() = default; + base::HistogramTester tester; +}; + +TEST_F(ArcAppInstallPolicyDataTest, InvalidConstruction) { + EXPECT_DCHECK_DEATH({ + ArcAppInstallPolicyData policy_data_ = + ArcAppInstallPolicyData(base::TimeTicks::Now(), {}, 0); + }); +} + +TEST_F(ArcAppInstallPolicyDataTest, UpdatePackageInstallResult_HundredPercent) { + ArcAppInstallPolicyData policy_data_(base::TimeTicks::Now(), + {kPackageName, kPackageName2}, 0); + + bool result; + result = policy_data_.UpdatePackageInstallResult(kPackageName, true); + EXPECT_FALSE(result); + + result = policy_data_.UpdatePackageInstallResult(kPackageName2, true); + EXPECT_TRUE(result); + + tester.ExpectUniqueSample("Arc.AppInstall.PolicySuccessRate", 100, 1); +} + +TEST_F(ArcAppInstallPolicyDataTest, UpdatePackageInstallResult_FiftyPercent) { + ArcAppInstallPolicyData policy_data_(base::TimeTicks::Now(), + {kPackageName, kPackageName2}, 0); + + bool result; + result = policy_data_.UpdatePackageInstallResult(kPackageName, true); + EXPECT_FALSE(result); + + result = policy_data_.UpdatePackageInstallResult(kPackageName2, false); + EXPECT_TRUE(result); + + tester.ExpectUniqueSample("Arc.AppInstall.PolicySuccessRate", 50, 1); +} + +TEST_F(ArcAppInstallPolicyDataTest, UpdatePackageInstallResult_Timeout) { + ArcAppInstallPolicyData policy_data_( + base::TimeTicks::Now() - base::Minutes(45), {kPackageName}, 1); + + bool result = policy_data_.UpdatePackageInstallResult("not_pending", false); + EXPECT_TRUE(result); + + tester.ExpectUniqueSample("Arc.AppInstall.PolicySuccessRate", 50, 1); +} + +TEST_F(ArcAppInstallPolicyDataTest, MaybeRecordSuccessRate_Timeout) { + ArcAppInstallPolicyData policy_data_( + base::TimeTicks::Now() - base::Minutes(45), {kPackageName, kPackageName2}, + 0); + + bool result = policy_data_.MaybeRecordSuccessRate(); + EXPECT_TRUE(result); + tester.ExpectUniqueSample("Arc.AppInstall.PolicySuccessRate", 0, 1); +} + +TEST_F(ArcAppInstallPolicyDataTest, MaybeRecordSuccessRate_NoTimeout) { + ArcAppInstallPolicyData policy_data_(base::TimeTicks::Now(), + {kPackageName, kPackageName2}, 0); + + bool result = policy_data_.MaybeRecordSuccessRate(); + EXPECT_FALSE(result); + tester.ExpectUniqueSample("Arc.AppInstall.PolicySuccessRate", 0, 0); +} + +} // namespace policy
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/network/network_info_sampler_browsertest.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/network/network_info_sampler_browsertest.cc index d79f45f..d380b81f 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/network/network_info_sampler_browsertest.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/network/network_info_sampler_browsertest.cc
@@ -2,18 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <string> +#include <utility> + #include "ash/components/settings/cros_settings_names.h" +#include "base/values.h" #include "chrome/browser/ash/login/test/session_manager_state_waiter.h" #include "chrome/browser/ash/policy/core/device_policy_cros_browser_test.h" #include "chrome/browser/ash/policy/reporting/metrics_reporting/metric_browsertest_utils.h" #include "chrome/browser/ash/settings/scoped_testing_cros_settings.h" #include "chrome/browser/ash/settings/stub_cros_settings_provider.h" +#include "chromeos/ash/components/dbus/hermes/hermes_manager_client.h" +#include "chromeos/ash/components/dbus/shill/shill_device_client.h" #include "chromeos/dbus/missive/missive_client_test_observer.h" #include "components/policy/core/common/cloud/cloud_policy_core.h" #include "components/reporting/proto/synced/metric_data.pb.h" #include "components/reporting/proto/synced/record.pb.h" #include "components/reporting/proto/synced/record_constants.pb.h" #include "content/public/test/browser_test.h" +#include "third_party/cros_system_api/dbus/shill/dbus-constants.h" namespace ash::reporting { @@ -23,51 +30,250 @@ using ::reporting::Destination; using ::reporting::MetricData; using ::reporting::Priority; +using ::reporting::Record; using ::testing::Eq; -using ::testing::NotNull; +constexpr char kEid0[] = "1234"; +constexpr char kEid1[] = "5678"; +constexpr char kEthernetPath[] = "ethernet/path"; +constexpr char kEthernetMac[] = "ethernet_mac"; +constexpr char kWifiPath[] = "wifi/path"; +constexpr char kWifiMac[] = "wifi_mac"; +constexpr char kCellularPath[] = "cellular/path"; +constexpr char kMeid[] = "12343"; +constexpr char kImei[] = "5689"; +constexpr char kIccid[] = "9876563"; +constexpr char kMdn[] = "134345"; + +class NetworkDevice { + public: + NetworkDevice(std::string path, + std::string type, + std::string name, + std::string mac_address) + : path_(std::move(path)), + type_(std::move(type)), + name_(std::move(name)), + mac_address_(mac_address) {} + + NetworkDevice(std::string path, + std::string type, + std::string name, + std::string meid, + std::string imei, + std::string iccid, + std::string mdn) + : path_(std::move(path)), + type_(std::move(type)), + name_(std::move(name)), + meid_(std::move(meid)), + imei_(std::move(imei)), + iccid_(std::move(iccid)), + mdn_(std::move(mdn)) {} + + const std::string& path() const { return path_; } + const std::string& type() const { return type_; } + const std::string& name() const { return name_; } + const std::string& mac_address() const { return mac_address_; } + const std::string& meid() const { return meid_; } + const std::string& imei() const { return imei_; } + const std::string& iccid() const { return iccid_; } + const std::string& mdn() const { return mdn_; } + + ::reporting::NetworkDeviceType GetReportingDeviceType() const { + if (type_ == shill::kTypeEthernet) { + return ::reporting::NetworkDeviceType::ETHERNET_DEVICE; + } else if (type_ == shill::kTypeWifi) { + return ::reporting::NetworkDeviceType::WIFI_DEVICE; + } else if (type_ == shill::kTypeCellular) { + return ::reporting::NetworkDeviceType::CELLULAR_DEVICE; + } else { + return ::reporting::NetworkDeviceType::NETWORK_DEVICE_TYPE_UNSPECIFIED; + } + } + + private: + const std::string path_; + const std::string type_; + const std::string name_; + const std::string mac_address_; + const std::string meid_; + const std::string imei_; + const std::string iccid_; + const std::string mdn_; +}; + +// TODO(b/237810858): Add a test for situations where +// kReportDeviceNetworkConfiguration being disabled and where no network +// interface is available. class NetworkInfoSamplerBrowserTest : public policy::DevicePolicyCrosBrowserTest { protected: NetworkInfoSamplerBrowserTest() = default; ~NetworkInfoSamplerBrowserTest() override = default; - ScopedTestingCrosSettings scoped_testing_cros_settings_; + void SetUpOnMainThread() override { + device_client_ = ash::ShillDeviceClient::Get()->GetTestInterface(); + device_client_->ClearDevices(); + ::ash::HermesManagerClient::Get()->GetTestInterface()->AddEuicc( + dbus::ObjectPath("path0"), kEid0, true, 1); + ::ash::HermesManagerClient::Get()->GetTestInterface()->AddEuicc( + dbus::ObjectPath("path1"), kEid1, true, 2); + } + + void EnableReportingNetworkInterfaces() { + scoped_testing_cros_settings_.device_settings()->SetBoolean( + kReportDeviceNetworkConfiguration, true); + } + + void AddDevice(const NetworkDevice& device) { + device_client_->AddDevice(device.path(), device.type(), device.name()); + if (!device.mac_address().empty()) { + device_client_->SetDeviceProperty(device.path(), shill::kAddressProperty, + base::Value(device.mac_address()), + /*notify_changed=*/true); + } + + // cellular devices have some unique properties + if (device.type() == shill::kTypeCellular) { + device_client_->SetDeviceProperty(device.path(), shill::kMeidProperty, + base::Value(device.meid()), + /*notify_changed=*/true); + device_client_->SetDeviceProperty(device.path(), shill::kImeiProperty, + base::Value(device.imei()), + /*notify_changed=*/true); + device_client_->SetDeviceProperty(device.path(), shill::kIccidProperty, + base::Value(device.iccid()), + /*notify_changed=*/true); + device_client_->SetDeviceProperty(device.path(), shill::kMdnProperty, + base::Value(device.mdn()), + /*notify_changed=*/true); + } + } + + template <typename DeviceSequence> + void AddDevices(const DeviceSequence& devices) { + for (const auto& device : devices) { + AddDevice(device); + } + } + + static bool IsRecordNetworkInterface(const Record& record) { + if (record.destination() != Destination::INFO_METRIC) { + return false; + } + + MetricData record_data; + EXPECT_TRUE(record_data.ParseFromString(record.data())); + if (!record_data.has_info_data()) { + return false; + } + + return record_data.info_data().has_networks_info(); + } + + // Gets next enqueued network interface record. This is useful in excluding + // other types of records from being examined. + static std::tuple<Priority, Record> GetNextEnqueuedNetworkInterfaceRecord( + MissiveClientTestObserver* observer) { + Priority priority; + Record record; + do { + // If no record is enqueued, this line would time out when the loop + // is entered for the first time. + std::tie(priority, record) = observer->GetNextEnqueuedRecord(); + } while (!IsRecordNetworkInterface(record)); + + return std::make_tuple(priority, record); + } + + template <typename DeviceSequence> + static void AssertNetworkInterfaces(const DeviceSequence& expected_devices, + MissiveClientTestObserver* observer) { + auto [priority, record] = GetNextEnqueuedNetworkInterfaceRecord(observer); + EXPECT_THAT(priority, Eq(Priority::SLOW_BATCH)); + EXPECT_THAT(record.destination(), Eq(Destination::INFO_METRIC)); + MetricData record_data; + ASSERT_TRUE(record_data.ParseFromString(record.data())); + EXPECT_TRUE(record_data.has_timestamp_ms()); + EXPECT_FALSE(record_data.has_telemetry_data()); + ASSERT_TRUE(record_data.has_info_data()); + + const auto& info_data = record_data.info_data(); + ASSERT_TRUE(info_data.has_networks_info()); + const auto& networks_info = info_data.networks_info(); + ASSERT_THAT(networks_info.network_interfaces_size(), + Eq(expected_devices.size())); + + // Assert details of each network interface + for (size_t i = 0u; i < expected_devices.size(); ++i) { + const auto& network_interface = networks_info.network_interfaces(i); + const auto& device = expected_devices[i]; + EXPECT_THAT(network_interface.type(), + Eq(device.GetReportingDeviceType())); + EXPECT_THAT(network_interface.device_path(), Eq(device.path())); + if (device.mac_address().empty()) { + EXPECT_FALSE(network_interface.has_mac_address()); + } else { + EXPECT_THAT(network_interface.mac_address(), Eq(device.mac_address())); + } + + if (device.type() == shill::kTypeCellular) { + EXPECT_THAT(network_interface.meid(), Eq(device.meid())); + EXPECT_THAT(network_interface.imei(), Eq(device.imei())); + EXPECT_THAT(network_interface.iccid(), Eq(device.iccid())); + EXPECT_THAT(network_interface.mdn(), Eq(device.mdn())); + // We always have 2 eids for all tests. + EXPECT_THAT(network_interface.eids_size(), Eq(2)); + EXPECT_THAT(network_interface.eids(0), Eq(kEid0)); + EXPECT_THAT(network_interface.eids(1), Eq(kEid1)); + } else { + EXPECT_FALSE(network_interface.has_meid()); + EXPECT_FALSE(network_interface.has_imei()); + EXPECT_FALSE(network_interface.has_iccid()); + EXPECT_FALSE(network_interface.has_mdn()); + EXPECT_THAT(network_interface.eids_size(), Eq(0)); + } + } + } + MetricTestInitializationHelper metric_test_initialization_helper_{ &device_state_}; + + private: + ::ash::ShillDeviceClient::TestInterface* device_client_; + ScopedTestingCrosSettings scoped_testing_cros_settings_; }; IN_PROC_BROWSER_TEST_F(NetworkInfoSamplerBrowserTest, - ReportNetworkInfoDefaultDevices) { - // Default network devices - scoped_testing_cros_settings_.device_settings()->SetBoolean( - kReportDeviceNetworkInterfaces, true); + ReportNetworkInfoSingleNetworkDevice) { + // Single network devices + const std::array<NetworkDevice, 1> devices{NetworkDevice( + kEthernetPath, shill::kTypeEthernet, "ethernet", kEthernetMac)}; + AddDevices(devices); + EnableReportingNetworkInterfaces(); MissiveClientTestObserver observer(Destination::INFO_METRIC); // Start initialization after the observer is initialized. metric_test_initialization_helper_.SetUpDelayedInitialization(); - // Indicates at least one network interface is available. - bool has_network_interfaces = false; - do { - // At least one record, otherwise this line would time out when the loop is - // entered for the first time. - auto [priority, record] = observer.GetNextEnqueuedRecord(); - EXPECT_THAT(priority, Eq(Priority::SLOW_BATCH)); - EXPECT_THAT(record.destination(), Eq(Destination::INFO_METRIC)); - ::reporting::MetricData record_data; - ASSERT_TRUE(record_data.ParseFromString(record.data())); - EXPECT_TRUE(record_data.has_timestamp_ms()); - EXPECT_TRUE(record_data.has_info_data()); - EXPECT_FALSE(record_data.has_telemetry_data()); + AssertNetworkInterfaces(devices, &observer); +} - const auto& info_data = record_data.info_data(); - if (info_data.has_networks_info()) { - const auto& networks_info = info_data.networks_info(); - has_network_interfaces |= (networks_info.network_interfaces_size() > 0); - } - } while (!has_network_interfaces); +IN_PROC_BROWSER_TEST_F(NetworkInfoSamplerBrowserTest, + ReportNetworkInfoAllTypesOfNetworkDevices) { + // All network devices + const std::array<NetworkDevice, 3> devices{ + NetworkDevice(kEthernetPath, shill::kTypeEthernet, "ethernet", + kEthernetMac), + NetworkDevice(kWifiPath, shill::kTypeWifi, "wifi", kWifiMac), + NetworkDevice(kCellularPath, shill::kTypeCellular, "cellular", kMeid, + kImei, kIccid, kMdn)}; + AddDevices(devices); + EnableReportingNetworkInterfaces(); + MissiveClientTestObserver observer(Destination::INFO_METRIC); + // Start initialization after the observer is initialized. + metric_test_initialization_helper_.SetUpDelayedInitialization(); - ASSERT_TRUE(has_network_interfaces) - << "No network interface is in any records."; + AssertNetworkInterfaces(devices, &observer); } } // namespace
diff --git a/chrome/browser/ash/web_applications/print_management_web_app_info.cc b/chrome/browser/ash/web_applications/print_management_web_app_info.cc index 2d82de9..736e2d1d 100644 --- a/chrome/browser/ash/web_applications/print_management_web_app_info.cc +++ b/chrome/browser/ash/web_applications/print_management_web_app_info.cc
@@ -23,7 +23,9 @@ info->title = l10n_util::GetStringUTF16(IDS_PRINT_MANAGEMENT_TITLE); web_app::CreateIconInfoForSystemWebApp( info->start_url, - {{"print_management_192.png", 192, IDR_PRINT_MANAGEMENT_ICON}}, *info); + {{"print_management_192.png", 192, + IDR_ASH_PRINT_MANAGEMENT_PRINT_MANAGEMENT_192_PNG}}, + *info); info->theme_color = web_app::GetDefaultBackgroundColor(/*use_dark_mode=*/false); info->dark_mode_theme_color =
diff --git a/chrome/browser/background/background_contents.cc b/chrome/browser/background/background_contents.cc index b1d2e43..333b113 100644 --- a/chrome/browser/background/background_contents.cc +++ b/chrome/browser/background/background_contents.cc
@@ -113,11 +113,11 @@ std::unique_ptr<WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) { delegate_->AddWebContents(std::move(new_contents), target_url, disposition, - initial_rect, was_blocked); + window_features, was_blocked); } bool BackgroundContents::IsNeverComposited(content::WebContents* web_contents) {
diff --git a/chrome/browser/background/background_contents.h b/chrome/browser/background/background_contents.h index 4553ec87f..456c75d1 100644 --- a/chrome/browser/background/background_contents.h +++ b/chrome/browser/background/background_contents.h
@@ -45,7 +45,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool* was_blocked) = 0; // Informs the delegate of lifetime events. @@ -88,7 +88,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; bool IsNeverComposited(content::WebContents* web_contents) override;
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc index f30a7c01..c11b4edc 100644 --- a/chrome/browser/background/background_contents_service.cc +++ b/chrome/browser/background/background_contents_service.cc
@@ -733,13 +733,13 @@ std::unique_ptr<WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool* was_blocked) { Browser* browser = chrome::FindLastActiveWithProfile( Profile::FromBrowserContext(new_contents->GetBrowserContext())); if (browser) { chrome::AddWebContents(browser, nullptr, std::move(new_contents), - target_url, disposition, initial_rect); + target_url, disposition, window_features); } }
diff --git a/chrome/browser/background/background_contents_service.h b/chrome/browser/background/background_contents_service.h index 940315c..4cd59e0 100644 --- a/chrome/browser/background/background_contents_service.h +++ b/chrome/browser/background/background_contents_service.h
@@ -109,7 +109,7 @@ void AddWebContents(std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool* was_blocked) override; void OnBackgroundContentsNavigated(BackgroundContents* contents) override; void OnBackgroundContentsTerminated(BackgroundContents* contents) override;
diff --git a/chrome/browser/browsing_data/access_context_audit_browsertest.cc b/chrome/browser/browsing_data/access_context_audit_browsertest.cc index 37ee8a32..1e4852f 100644 --- a/chrome/browser/browsing_data/access_context_audit_browsertest.cc +++ b/chrome/browser/browsing_data/access_context_audit_browsertest.cc
@@ -148,12 +148,12 @@ // each frame in the active web contents for |browser|. void EnsurePageAccessedStorage(content::WebContents* web_contents) { web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating([](content::RenderFrameHost* frame) { + [](content::RenderFrameHost* frame) { EXPECT_TRUE( content::EvalJs(frame, "(async () => { return await accessStorage();})()") .value.GetBool()); - })); + }); } } // namespace @@ -354,7 +354,13 @@ /* compare_host_only */ true); } -IN_PROC_BROWSER_TEST_F(AccessContextAuditBrowserTest, RemoveRecords) { +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_RemoveRecords DISABLED_RemoveRecords +#else +#define MAYBE_RemoveRecords RemoveRecords +#endif +IN_PROC_BROWSER_TEST_F(AccessContextAuditBrowserTest, MAYBE_RemoveRecords) { // Immediately remove all records and ensure no record remains. content::BrowsingDataRemover* remover = chrome_test_utils::GetProfile(this)->GetBrowsingDataRemover(); @@ -395,7 +401,13 @@ kEmbeddedPageCookieCount + kTopLevelPageCookieCount); } -IN_PROC_BROWSER_TEST_F(AccessContextAuditBrowserTest, CheckSessionOnly) { +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_CheckSessionOnly DISABLED_CheckSessionOnly +#else +#define MAYBE_CheckSessionOnly CheckSessionOnly +#endif +IN_PROC_BROWSER_TEST_F(AccessContextAuditBrowserTest, MAYBE_CheckSessionOnly) { // Confirm all records have been removed. auto records = GetAllAccessRecords(); auto cookies = GetAllCookies(); @@ -403,7 +415,13 @@ EXPECT_EQ(cookies.size(), 0u); } -IN_PROC_BROWSER_TEST_F(AccessContextAuditBrowserTest, RemoveHistory) { +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_RemoveHistory DISABLED_RemoveHistory +#else +#define MAYBE_RemoveHistory RemoveHistory +#endif +IN_PROC_BROWSER_TEST_F(AccessContextAuditBrowserTest, MAYBE_RemoveHistory) { // Check that removing all history entries for an origin also removes all // records where that origin is the top frame origin. NavigateToTopLevelPage(); @@ -458,7 +476,13 @@ cookies.end()); } -IN_PROC_BROWSER_TEST_F(AccessContextAuditBrowserTest, TreeModelDeletion) { +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_TreeModelDeletion DISABLED_TreeModelDeletion +#else +#define MAYBE_TreeModelDeletion TreeModelDeletion +#endif +IN_PROC_BROWSER_TEST_F(AccessContextAuditBrowserTest, MAYBE_TreeModelDeletion) { // Check that removing cookies and storage API usage via the CookiesTreeModel // also removes the associated access records. NavigateToTopLevelPage(); @@ -502,7 +526,13 @@ EXPECT_EQ(cookies.size(), 0u); } -IN_PROC_BROWSER_TEST_F(AccessContextAuditBrowserTest, MultipleAccesses) { +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_MultipleAccesses DISABLED_MultipleAccesses +#else +#define MAYBE_MultipleAccesses MultipleAccesses +#endif +IN_PROC_BROWSER_TEST_F(AccessContextAuditBrowserTest, MAYBE_MultipleAccesses) { // Ensure that renavigating to a page in the same tab correctly re-records // accesses. base::SimpleTestClock clock; @@ -531,7 +561,13 @@ EXPECT_EQ(record.last_access_time, clock.Now()); } -IN_PROC_BROWSER_TEST_F(AccessContextAuditBrowserTest, TabClosed) { +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_TabClosed DISABLED_TabClosed +#else +#define MAYBE_TabClosed TabClosed +#endif +IN_PROC_BROWSER_TEST_F(AccessContextAuditBrowserTest, MAYBE_TabClosed) { // Ensure closing a tab correctly flushes access records. NavigateToTopLevelPage(); NavigateToEmbeddedPage(); @@ -620,8 +656,14 @@ kEmbeddedPageCookieCount + kTopLevelPageCookieCount); } +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_RestoreSession DISABLED_RestoreSession +#else +#define MAYBE_RestoreSession RestoreSession +#endif IN_PROC_BROWSER_TEST_F(AccessContextAuditSessionRestoreBrowserTest, - RestoreSession) { + MAYBE_RestoreSession) { // Check all access records have been correctly persisted across restarts. auto records = GetAllAccessRecords(); auto cookies = GetAllCookies();
diff --git a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc index bbaf393..ece3ba26 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc
@@ -587,8 +587,14 @@ } } +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_Database DISABLED_Database +#else +#define MAYBE_Database Database +#endif // Verify can modify database after deleting it. -IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, Database) { +IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, MAYBE_Database) { GURL url = embedded_test_server()->GetURL("/simple_database.html"); ASSERT_TRUE(ui_test_utils::NavigateToURL(GetBrowser(), url)); @@ -1078,18 +1084,36 @@ TestSiteData("StorageFoundation", GetParam()); } -IN_PROC_BROWSER_TEST_P(BrowsingDataRemoverBrowserTestP, WebSqlDeletion) { +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_WebSqlDeletion DISABLED_WebSqlDeletion +#else +#define MAYBE_WebSqlDeletion WebSqlDeletion +#endif +IN_PROC_BROWSER_TEST_P(BrowsingDataRemoverBrowserTestP, MAYBE_WebSqlDeletion) { TestSiteData("WebSql", GetParam()); } +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_WebSqlIncognitoDeletion DISABLED_WebSqlIncognitoDeletion +#else +#define MAYBE_WebSqlIncognitoDeletion WebSqlIncognitoDeletion +#endif IN_PROC_BROWSER_TEST_P(BrowsingDataRemoverBrowserTestP, - WebSqlIncognitoDeletion) { + MAYBE_WebSqlIncognitoDeletion) { UseIncognitoBrowser(); TestSiteData("WebSql", GetParam()); } -// Test that empty websql dbs are deleted correctly. -IN_PROC_BROWSER_TEST_P(BrowsingDataRemoverBrowserTestP, EmptyWebSqlDeletion) { +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_EmptyWebSqlDeletion DISABLED_EmptyWebSqlDeletion +#else +#define MAYBE_EmptyWebSqlDeletion EmptyWebSqlDeletion +#endif +IN_PROC_BROWSER_TEST_P(BrowsingDataRemoverBrowserTestP, + MAYBE_EmptyWebSqlDeletion) { TestEmptySiteData("WebSql", GetParam()); } @@ -1356,9 +1380,16 @@ ExpectCookieTreeModelCount(0); } +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_StorageRemovedFromDisk DISABLED_StorageRemovedFromDisk +#else +#define MAYBE_StorageRemovedFromDisk StorageRemovedFromDisk +#endif // Check if any data remains after a deletion and a Chrome restart to force // all writes to be finished. -IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, StorageRemovedFromDisk) { +IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, + MAYBE_StorageRemovedFromDisk) { // Deletions should remove all traces of browsing data from disk // but there are a few bugs that need to be fixed. // Any addition to this list must have an associated TODO(). @@ -1399,9 +1430,15 @@ CONTENT_SETTING_SESSION_ONLY); } +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_SessionOnlyStorageRemoved DISABLED_SessionOnlyStorageRemoved +#else +#define MAYBE_SessionOnlyStorageRemoved SessionOnlyStorageRemoved +#endif // Restart to delete session only storage. IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, - SessionOnlyStorageRemoved) { + MAYBE_SessionOnlyStorageRemoved) { // All cookies should have been deleted. ExpectCookieTreeModelCount(0); GURL url = embedded_test_server()->GetURL("/browsing_data/site_data.html");
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_browsertest.cc b/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_browsertest.cc index af953a8..47729c9 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_browsertest.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_browsertest.cc
@@ -250,8 +250,14 @@ } } +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_SiteData DISABLED_SiteData +#else +#define MAYBE_SiteData SiteData +#endif IN_PROC_BROWSER_TEST_P(ChromeBrowsingDataLifetimeManagerScheduledRemovalTest, - SiteData) { + MAYBE_SiteData) { static constexpr char kPref[] = R"([{"time_to_live_in_hours": 1, "data_types": ["cookies_and_other_site_data"]}])"; @@ -296,8 +302,14 @@ EXPECT_NE(net::OK, content::LoadBasicRequest(network_context(), url)); } +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_KeepsOtherTabData DISABLED_KeepsOtherTabData +#else +#define MAYBE_KeepsOtherTabData KeepsOtherTabData +#endif IN_PROC_BROWSER_TEST_P(ChromeBrowsingDataLifetimeManagerScheduledRemovalTest, - KeepsOtherTabData) { + MAYBE_KeepsOtherTabData) { if (IsIncognito()) return; @@ -376,8 +388,14 @@ } #if !BUILDFLAG(IS_ANDROID) +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_KeepsOtherWindowData DISABLED_KeepsOtherWindowData +#else +#define MAYBE_KeepsOtherWindowData KeepsOtherWindowData +#endif IN_PROC_BROWSER_TEST_P(ChromeBrowsingDataLifetimeManagerScheduledRemovalTest, - KeepsOtherWindowData) { + MAYBE_KeepsOtherWindowData) { if (IsIncognito()) return;
diff --git a/chrome/browser/browsing_data/cookies_tree_model_browsertest.cc b/chrome/browser/browsing_data/cookies_tree_model_browsertest.cc index e8ce678..811617e0 100644 --- a/chrome/browser/browsing_data/cookies_tree_model_browsertest.cc +++ b/chrome/browser/browsing_data/cookies_tree_model_browsertest.cc
@@ -19,12 +19,12 @@ // each frame in the active web contents for |browser|. void EnsurePageAccessedStorage(content::WebContents* web_contents) { web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating([](content::RenderFrameHost* frame) { + [](content::RenderFrameHost* frame) { EXPECT_TRUE( content::EvalJs(frame, "(async () => { return await accessStorage();})()") .value.GetBool()); - })); + }); } std::vector<CookieTreeNode*> GetAllChildNodes(CookieTreeNode* node) {
diff --git a/chrome/browser/browsing_data/incognito_browsing_data_browsertest.cc b/chrome/browser/browsing_data/incognito_browsing_data_browsertest.cc index 3d7c16a..2adb18de 100644 --- a/chrome/browser/browsing_data/incognito_browsing_data_browsertest.cc +++ b/chrome/browser/browsing_data/incognito_browsing_data_browsertest.cc
@@ -322,8 +322,14 @@ EXPECT_TRUE(is_power_efficient); } +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_Database DISABLED_Database +#else +#define MAYBE_Database Database +#endif // Verify database is reset after Incognito restart. -IN_PROC_BROWSER_TEST_F(IncognitoBrowsingDataBrowserTest, Database) { +IN_PROC_BROWSER_TEST_F(IncognitoBrowsingDataBrowserTest, MAYBE_Database) { GURL url = embedded_test_server()->GetURL("/simple_database.html"); ASSERT_TRUE(ui_test_utils::NavigateToURL(GetBrowser(), url)); @@ -456,7 +462,13 @@ TestSiteData("StorageFoundation"); } -IN_PROC_BROWSER_TEST_F(IncognitoBrowsingDataBrowserTest, WebSqlDeletion) { +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_WebSqlDeletion DISABLED_WebSqlDeletion +#else +#define MAYBE_WebSqlDeletion WebSqlDeletion +#endif +IN_PROC_BROWSER_TEST_F(IncognitoBrowsingDataBrowserTest, MAYBE_WebSqlDeletion) { TestSiteData("WebSql"); } @@ -527,9 +539,15 @@ "Cookie", "LocalStorage", "FileSystem", "SessionStorage", "IndexedDb", "WebSql", "ServiceWorker", "CacheStorage", "MediaLicense"}; +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_StorageDoesntWriteToDisk DISABLED_StorageDoesntWriteToDisk +#else +#define MAYBE_StorageDoesntWriteToDisk StorageDoesntWriteToDisk +#endif // Test that storage doesn't leave any traces on disk. IN_PROC_BROWSER_TEST_F(IncognitoBrowsingDataBrowserTest, - StorageDoesntWriteToDisk) { + MAYBE_StorageDoesntWriteToDisk) { // Checking leveldb content fails in most cases. See https://crbug.com/1238325 ASSERT_EQ(0, CheckUserDirectoryForString(kLocalHost, {}, /*check_leveldb_content=*/false));
diff --git a/chrome/browser/chrome_back_forward_cache_browsertest.cc b/chrome/browser/chrome_back_forward_cache_browsertest.cc index 45ceb02..f07291b 100644 --- a/chrome/browser/chrome_back_forward_cache_browsertest.cc +++ b/chrome/browser/chrome_back_forward_cache_browsertest.cc
@@ -210,11 +210,10 @@ EXPECT_TRUE(content::WaitForLoadStop(web_contents())); content::RenderFrameHost* rfh_b = nullptr; - rfh_a->ForEachRenderFrameHost( - base::BindLambdaForTesting([&](content::RenderFrameHost* rfh) { - if (rfh != rfh_a.get()) - rfh_b = rfh; - })); + rfh_a->ForEachRenderFrameHost([&](content::RenderFrameHost* rfh) { + if (rfh != rfh_a.get()) + rfh_b = rfh; + }); EXPECT_TRUE(rfh_b); content::RenderFrameHostWrapper rfh_b_wrapper(rfh_b);
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index c6a9e76..c6c13b2 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -1380,6 +1380,10 @@ "../ash/policy/reporting/arc_app_install_event_log_uploader.h", "../ash/policy/reporting/arc_app_install_event_logger.cc", "../ash/policy/reporting/arc_app_install_event_logger.h", + "../ash/policy/reporting/arc_app_install_policy_data.cc", + "../ash/policy/reporting/arc_app_install_policy_data.h", + "../ash/policy/reporting/arc_app_install_policy_data_helper.cc", + "../ash/policy/reporting/arc_app_install_policy_data_helper.h", "../ash/policy/reporting/install_event_log.h", "../ash/policy/reporting/install_event_log_collector_base.cc", "../ash/policy/reporting/install_event_log_collector_base.h", @@ -3275,6 +3279,8 @@ "../ash/policy/reporting/arc_app_install_event_log_unittest.cc", "../ash/policy/reporting/arc_app_install_event_log_uploader_unittest.cc", "../ash/policy/reporting/arc_app_install_event_logger_unittest.cc", + "../ash/policy/reporting/arc_app_install_policy_data_helper_unittest.cc", + "../ash/policy/reporting/arc_app_install_policy_data_unittest.cc", "../ash/policy/reporting/metrics_reporting/audio/audio_events_observer_unittest.cc", "../ash/policy/reporting/metrics_reporting/cros_healthd_events_observer_base_unittest.cc", "../ash/policy/reporting/metrics_reporting/cros_healthd_metric_sampler_unittest.cc",
diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc index 789017ef..f7836e4 100644 --- a/chrome/browser/content_settings/content_settings_browsertest.cc +++ b/chrome/browser/content_settings/content_settings_browsertest.cc
@@ -120,7 +120,7 @@ size_t GetRenderFrameHostCount(content::RenderFrameHost* starting_frame) { size_t count = 0; starting_frame->ForEachRenderFrameHost( - base::BindLambdaForTesting([&](content::RenderFrameHost*) { ++count; })); + [&](content::RenderFrameHost*) { ++count; }); return count; }
diff --git a/chrome/browser/data_use_measurement/chrome_data_use_measurement.cc b/chrome/browser/data_use_measurement/chrome_data_use_measurement.cc index 6cd17c04..5855cf7 100644 --- a/chrome/browser/data_use_measurement/chrome_data_use_measurement.cc +++ b/chrome/browser/data_use_measurement/chrome_data_use_measurement.cc
@@ -4,14 +4,26 @@ #include "chrome/browser/data_use_measurement/chrome_data_use_measurement.h" +#include "base/feature_list.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/no_destructor.h" #include "base/trace_event/trace_event.h" #include "content/public/browser/browser_thread.h" +#if BUILDFLAG(IS_ANDROID) +#include "net/android/traffic_stats.h" +#endif + using content::BrowserThread; +#if BUILDFLAG(IS_ANDROID) +namespace { +const base::Feature kRunLegacyDataUseMeasurment{ + "RunLegacyDataUseMeasurement", base::FEATURE_DISABLED_BY_DEFAULT}; +} // anonymous namespace +#endif + // static ChromeDataUseMeasurement& ChromeDataUseMeasurement::GetInstance() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || @@ -22,7 +34,17 @@ return *s_chrome_data_use_measurement; } +#if BUILDFLAG(IS_ANDROID) +ChromeDataUseMeasurement::ChromeDataUseMeasurement() { + if (base::FeatureList::IsEnabled(kRunLegacyDataUseMeasurment)) { + int64_t bytes = 0; + net::android::traffic_stats::GetCurrentUidRxBytes(&bytes); + net::android::traffic_stats::GetCurrentUidTxBytes(&bytes); + } +} +#else ChromeDataUseMeasurement::ChromeDataUseMeasurement() = default; +#endif ChromeDataUseMeasurement::~ChromeDataUseMeasurement() = default; @@ -57,4 +79,12 @@ if (dir == TrafficDirection::kUpstream) UMA_HISTOGRAM_COUNTS_1M("DataUse.BytesSent3.Delegate", message_size_bytes); + +#if BUILDFLAG(IS_ANDROID) + if (base::FeatureList::IsEnabled(kRunLegacyDataUseMeasurment)) { + int64_t bytes = 0; + net::android::traffic_stats::GetCurrentUidRxBytes(&bytes); + net::android::traffic_stats::GetCurrentUidTxBytes(&bytes); + } +#endif }
diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc index c65d151..3c5bf85 100644 --- a/chrome/browser/devtools/devtools_window.cc +++ b/chrome/browser/devtools/devtools_window.cc
@@ -1287,13 +1287,14 @@ } } -void DevToolsWindow::AddNewContents(WebContents* source, - std::unique_ptr<WebContents> new_contents, - const GURL& target_url, - WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, - bool user_gesture, - bool* was_blocked) { +void DevToolsWindow::AddNewContents( + WebContents* source, + std::unique_ptr<WebContents> new_contents, + const GURL& target_url, + WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures& window_features, + bool user_gesture, + bool* was_blocked) { if (new_contents.get() == toolbox_web_contents_) { owned_toolbox_web_contents_ = std::move(new_contents); @@ -1312,8 +1313,8 @@ WebContents* inspected_web_contents = GetInspectedWebContents(); if (inspected_web_contents) { inspected_web_contents->GetDelegate()->AddNewContents( - source, std::move(new_contents), target_url, disposition, initial_rect, - user_gesture, was_blocked); + source, std::move(new_contents), target_url, disposition, + window_features, user_gesture, was_blocked); } }
diff --git a/chrome/browser/devtools/devtools_window.h b/chrome/browser/devtools/devtools_window.h index 82f0d80..9385492 100644 --- a/chrome/browser/devtools/devtools_window.h +++ b/chrome/browser/devtools/devtools_window.h
@@ -344,7 +344,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; void WebContentsCreated(content::WebContents* source_contents,
diff --git a/chrome/browser/download/bubble/download_display.h b/chrome/browser/download/bubble/download_display.h index 1b43226..fd79e23 100644 --- a/chrome/browser/download/bubble/download_display.h +++ b/chrome/browser/download/bubble/download_display.h
@@ -26,6 +26,9 @@ virtual void HideDetails() = 0; // Returns whether the details are visible. virtual bool IsShowingDetails() = 0; + // Returns whether it is currently in fullscreen and the view that hosts the + // download display is hidden. + virtual bool IsFullscreenWithParentViewHidden() = 0; protected: virtual ~DownloadDisplay();
diff --git a/chrome/browser/download/bubble/download_display_controller.cc b/chrome/browser/download/bubble/download_display_controller.cc index 58844ac5..ca3852d0 100644 --- a/chrome/browser/download/bubble/download_display_controller.cc +++ b/chrome/browser/download/bubble/download_display_controller.cc
@@ -101,17 +101,22 @@ std::vector<std::unique_ptr<DownloadUIModel>> all_models = bubble_controller_->GetAllItemsToDisplay(); UpdateToolbarButtonState(all_models); - if (show_details) { - if (browser_->window()->IsFullscreen()) { - browser_->exclusive_access_manager() - ->context() - ->UpdateExclusiveAccessExitBubbleContent( - GURL(), EXCLUSIVE_ACCESS_BUBBLE_TYPE_DOWNLOAD_STARTED, - ExclusiveAccessBubbleHideCallback(), - /*force_update=*/true); - } else if (download::ShouldShowDetailsAutomatically(browser_->profile())) { - display_->ShowDetails(); + if (!show_details) { + return; + } + if (display_->IsFullscreenWithParentViewHidden()) { + fullscreen_notification_shown_ = true; + ExclusiveAccessContext* exclusive_access_context = + browser_->exclusive_access_manager()->context(); + // exclusive_access_context can be null in tests. + if (exclusive_access_context) { + exclusive_access_context->UpdateExclusiveAccessExitBubbleContent( + GURL(), EXCLUSIVE_ACCESS_BUBBLE_TYPE_DOWNLOAD_STARTED, + ExclusiveAccessBubbleHideCallback(), + /*force_update=*/true); } + } else if (download::ShouldShowDetailsAutomatically(browser_->profile())) { + display_->ShowDetails(); } } @@ -123,7 +128,9 @@ if (is_done) { ScheduleToolbarDisappearance(kToolbarIconVisibilityTimeInterval); if (show_details_if_done) { - if (browser_->window()->IsFullscreen()) { + if (display_->IsFullscreenWithParentViewHidden()) { + // Suppress the complete event for now because the parent view is + // hidden. download_completed_while_fullscreen_ = true; } else if (download::ShouldShowDetailsAutomatically( browser_->profile())) { @@ -202,8 +209,11 @@ } void DownloadDisplayController::OnFullscreenStateChanged() { - if (browser_->window()->IsFullscreen()) + if (!fullscreen_notification_shown_ || + display_->IsFullscreenWithParentViewHidden()) { return; + } + fullscreen_notification_shown_ = false; std::vector<std::unique_ptr<DownloadUIModel>> all_models = bubble_controller_->GetAllItemsToDisplay(); @@ -235,7 +245,7 @@ last_complete_time)) { icon_info_.is_active = true; ScheduleToolbarInactive(kToolbarIconActiveTimeInterval); - } else if (!browser_->window()->IsFullscreen() && + } else if (!display_->IsFullscreenWithParentViewHidden() && download_completed_while_fullscreen_) { icon_info_.is_active = true; ScheduleToolbarInactive(kToolbarIconActiveTimeInterval);
diff --git a/chrome/browser/download/bubble/download_display_controller.h b/chrome/browser/download/bubble/download_display_controller.h index 5473708..5cddf1ed 100644 --- a/chrome/browser/download/bubble/download_display_controller.h +++ b/chrome/browser/download/bubble/download_display_controller.h
@@ -155,6 +155,7 @@ base::OneShotTimer icon_disappearance_timer_; base::OneShotTimer icon_inactive_timer_; IconInfo icon_info_; + bool fullscreen_notification_shown_ = false; bool download_completed_while_fullscreen_ = false; // DownloadDisplayController and DownloadBubbleUIController have the same // lifetime. Both are owned, constructed together, and destructed together by
diff --git a/chrome/browser/download/bubble/download_display_controller_unittest.cc b/chrome/browser/download/bubble/download_display_controller_unittest.cc index 3ea29d9..0c4f44c8 100644 --- a/chrome/browser/download/bubble/download_display_controller_unittest.cc +++ b/chrome/browser/download/bubble/download_display_controller_unittest.cc
@@ -15,8 +15,6 @@ #include "chrome/browser/download/download_core_service_factory.h" #include "chrome/browser/download/download_prefs.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_commands.h" -#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/test_browser_window.h" #include "chrome/test/base/testing_browser_process.h" @@ -82,9 +80,11 @@ void ShowDetails() override { detail_shown_ = true; } void HideDetails() override { detail_shown_ = false; } bool IsShowingDetails() override { return detail_shown_; } + bool IsFullscreenWithParentViewHidden() override { return is_fullscreen_; } DownloadIconState GetDownloadIconState() { return icon_state_; } bool IsActive() { return is_active_; } + void SetIsFullscreen(bool is_fullscreen) { is_fullscreen_ = is_fullscreen; } private: bool shown_ = false; @@ -92,6 +92,7 @@ DownloadIconState icon_state_ = DownloadIconState::kComplete; bool is_active_ = false; bool detail_shown_ = false; + bool is_fullscreen_ = false; DownloadDisplayController* controller_ = nullptr; }; @@ -116,54 +117,6 @@ } // namespace -class DownloadDisplayControllerTest; - -// A test browser window that can toggle fullscreen state. -class TestBrowserWindowWithFullscreen : public TestBrowserWindow, - ExclusiveAccessContext { - public: - explicit TestBrowserWindowWithFullscreen(DownloadDisplayControllerTest* test) - : test_(test) {} - - TestBrowserWindowWithFullscreen(const TestBrowserWindowWithFullscreen&) = - delete; - TestBrowserWindowWithFullscreen& operator=( - const TestBrowserWindowWithFullscreen&) = delete; - - ~TestBrowserWindowWithFullscreen() override = default; - - // TestBrowserWindow overrides: - bool ShouldHideUIForFullscreen() const override { return fullscreen_; } - bool IsFullscreen() const override { return fullscreen_; } - void EnterFullscreen(const GURL& url, - ExclusiveAccessBubbleType type, - int64_t display_id) override { - fullscreen_ = true; - } - void ExitFullscreen() override { fullscreen_ = false; } - bool IsToolbarShowing() const override { return toolbar_showing_; } - bool IsLocationBarVisible() const override { return true; } - - ExclusiveAccessContext* GetExclusiveAccessContext() override { return this; } - - // Exclusive access interface: - Profile* GetProfile() override; - content::WebContents* GetActiveWebContents() override; - void UpdateExclusiveAccessExitBubbleContent( - const GURL& url, - ExclusiveAccessBubbleType bubble_type, - ExclusiveAccessBubbleHideCallback bubble_first_hide_callback, - bool force_update) override {} - bool IsExclusiveAccessBubbleDisplayed() const override { return false; } - void OnExclusiveAccessUserInput() override {} - bool CanUserExitFullscreen() const override { return true; } - - private: - bool fullscreen_ = false; - bool toolbar_showing_ = false; - raw_ptr<DownloadDisplayControllerTest> test_; -}; - class DownloadDisplayControllerTest : public testing::Test { public: DownloadDisplayControllerTest() @@ -188,7 +141,7 @@ ->SetDownloadManagerDelegateForTesting(std::move(delegate)); display_ = std::make_unique<FakeDownloadDisplay>(); - window_ = std::make_unique<TestBrowserWindowWithFullscreen>(this); + window_ = std::make_unique<TestBrowserWindow>(); Browser::CreateParams params(profile_, true); params.type = Browser::TYPE_NORMAL; params.window = window_.get(); @@ -369,18 +322,10 @@ std::unique_ptr<FakeDownloadBubbleUIController> bubble_controller_; TestingProfileManager testing_profile_manager_; raw_ptr<Profile> profile_; - std::unique_ptr<TestBrowserWindowWithFullscreen> window_; + std::unique_ptr<TestBrowserWindow> window_; std::unique_ptr<Browser> browser_; }; -Profile* TestBrowserWindowWithFullscreen::GetProfile() { - return test_->browser()->profile(); -} - -content::WebContents* TestBrowserWindowWithFullscreen::GetActiveWebContents() { - return test_->browser()->tab_strip_model()->GetActiveWebContents(); -} - TEST_F(DownloadDisplayControllerTest, GetProgressItemsInProgress) { InitDownloadItem(FILE_PATH_LITERAL("/foo/bar.pdf"), download::DownloadItem::IN_PROGRESS); @@ -771,9 +716,7 @@ TEST_F(DownloadDisplayControllerTest, Fullscreen_ShowsDetailsForInProgressOnExitFullscreen) { - chrome::ToggleFullscreenMode(browser()); - EXPECT_TRUE(browser()->window()->IsFullscreen()); - controller().OnFullscreenStateChanged(); + display().SetIsFullscreen(true); InitDownloadItem(FILE_PATH_LITERAL("/foo/bar.pdf"), download::DownloadItem::IN_PROGRESS); // Do not show bubble for in-progress download in full screen mode. @@ -781,8 +724,7 @@ /*icon_state=*/DownloadIconState::kProgress, /*is_active=*/true)); - chrome::ToggleFullscreenMode(browser()); - EXPECT_FALSE(browser()->window()->IsFullscreen()); + display().SetIsFullscreen(false); controller().OnFullscreenStateChanged(); // Show bubble for in-progress download when exiting full screen mode. EXPECT_TRUE(VerifyDisplayState(/*shown=*/true, /*detail_shown=*/true, @@ -792,9 +734,7 @@ TEST_F(DownloadDisplayControllerTest, Fullscreen_ShowsIconForCompletedOnExitFullscreen) { - chrome::ToggleFullscreenMode(browser()); - EXPECT_TRUE(browser()->window()->IsFullscreen()); - controller().OnFullscreenStateChanged(); + display().SetIsFullscreen(true); InitDownloadItem(FILE_PATH_LITERAL("/foo/bar.pdf"), download::DownloadItem::IN_PROGRESS); EXPECT_TRUE(VerifyDisplayState(/*shown=*/true, /*detail_shown=*/false, @@ -805,8 +745,8 @@ download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, /*show_details_if_done=*/true); // While the bubble does not pop up, and the toolbar not shown, the icon - // state is still updated. So |is_active| should be true for one minute after - // completed download. + // state is still updated. So |is_active| should be true for one minute + // after completed download. EXPECT_TRUE(VerifyDisplayState(/*shown=*/true, /*detail_shown=*/false, /*icon_state=*/DownloadIconState::kComplete, /*is_active=*/true)); @@ -817,8 +757,7 @@ /*icon_state=*/DownloadIconState::kComplete, /*is_active=*/false)); - chrome::ToggleFullscreenMode(browser()); - EXPECT_FALSE(browser()->window()->IsFullscreen()); + display().SetIsFullscreen(false); controller().OnFullscreenStateChanged(); // On exiting full screen, show download icon as active for 1 minute. EXPECT_TRUE(VerifyDisplayState(/*shown=*/true, /*detail_shown=*/false,
diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc index 85b7ef5d5..d8c98f5b 100644 --- a/chrome/browser/download/save_page_browsertest.cc +++ b/chrome/browser/download/save_page_browsertest.cc
@@ -1162,10 +1162,9 @@ // Kill one of renderer processes (this is the essence of this test). WebContents* web_contents = GetCurrentTab(browser()); bool did_kill_a_process = false; - web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating( - [](WebContents* web_contents, bool* did_kill_a_process, - RenderFrameHost* frame) { + web_contents->GetPrimaryMainFrame() + ->ForEachRenderFrameHostWithAction( + [web_contents, &did_kill_a_process](RenderFrameHost* frame) { if (frame->GetLastCommittedURL().host() == "bar.com") { RenderProcessHost* process_to_kill = frame->GetProcess(); EXPECT_NE( @@ -1175,12 +1174,11 @@ EXPECT_TRUE(process_to_kill->FastShutdownIfPossible()); EXPECT_FALSE(process_to_kill->IsInitializedAndNotDead()); - *did_kill_a_process = true; + did_kill_a_process = true; return content::RenderFrameHost::FrameIterationAction::kStop; } return content::RenderFrameHost::FrameIterationAction::kContinue; - }, - web_contents, &did_kill_a_process)); + }); EXPECT_TRUE(did_kill_a_process); // Main verification is that we don't hang and time out when saving. @@ -1247,7 +1245,9 @@ if (GetParam() == content::SAVE_PAGE_TYPE_AS_MHTML) { std::set<url::Origin> origins; GetCurrentTab(browser())->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating(&CheckFrameForMHTML, base::Unretained(&origins))); + [&origins](content::RenderFrameHost* host) { + CheckFrameForMHTML(host, origins); + }); int unique_origins = origins.size(); EXPECT_EQ(expected_number_of_frames_in_saved_page, unique_origins) << "All origins should be unique"; @@ -1331,12 +1331,9 @@ DLOG(INFO) << "Verifying that a.htm frame has fully loaded..."; std::vector<std::string> frame_names; GetCurrentTab(browser())->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating( - [](std::vector<std::string>* frame_names, - content::RenderFrameHost* frame) { - frame_names->push_back(frame->GetFrameName()); - }, - &frame_names)); + [&frame_names](content::RenderFrameHost* frame) { + frame_names.push_back(frame->GetFrameName()); + }); EXPECT_THAT(frame_names, testing::Contains("Frame name of a.htm")); } @@ -1361,11 +1358,11 @@ } } - static void CheckFrameForMHTML(std::set<url::Origin>* origins, - content::RenderFrameHost* host) { + static void CheckFrameForMHTML(content::RenderFrameHost* host, + std::set<url::Origin>& origins) { // See RFC n°2557, section-8.3: "Use of the Content-ID header and CID URLs". const char kContentIdScheme[] = "cid"; - origins->insert(host->GetLastCommittedOrigin()); + origins.insert(host->GetLastCommittedOrigin()); EXPECT_TRUE(host->GetLastCommittedOrigin().opaque()); if (!host->GetParent()) EXPECT_TRUE(host->GetLastCommittedURL().SchemeIsFile());
diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc index a4ece96..f8aed76 100644 --- a/chrome/browser/extensions/api/debugger/debugger_api.cc +++ b/chrome/browser/extensions/api/debugger/debugger_api.cc
@@ -162,9 +162,9 @@ content::RenderFrameHost* render_frame_host, std::string* error) { bool result = true; - render_frame_host->ForEachRenderFrameHost(base::BindRepeating( - [](const Extension& extension, Profile* extension_profile, - std::string* error, bool& result, content::RenderFrameHost* rfh) { + render_frame_host->ForEachRenderFrameHostWithAction( + [&extension, extension_profile, error, + &result](content::RenderFrameHost* rfh) { // If |rfh| is attached to an inner MimeHandlerViewGuest skip it. // This is done to fix crbug.com/1293856 because an extension cannot // inspect another extension. @@ -193,8 +193,7 @@ } return content::RenderFrameHost::FrameIterationAction::kContinue; - }, - std::ref(extension), extension_profile, error, std::ref(result))); + }); return result; }
diff --git a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc index fffbced..e494972 100644 --- a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc +++ b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
@@ -63,6 +63,7 @@ #include "extensions/common/extension.h" #include "services/data_decoder/public/cpp/data_decoder.h" #include "third_party/blink/public/mojom/manifest/display_mode.mojom.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/components/arc/arc_util.h" @@ -404,9 +405,10 @@ content::WebContents* containing_contents = web_contents.get(); chrome::ScopedTabbedBrowserDisplayer displayer(profile); const GURL& url = web_contents->GetLastCommittedURL(); - chrome::AddWebContents( - displayer.browser(), nullptr, std::move(web_contents), url, - WindowOpenDisposition::NEW_FOREGROUND_TAB, gfx::Rect()); + chrome::AddWebContents(displayer.browser(), nullptr, + std::move(web_contents), url, + WindowOpenDisposition::NEW_FOREGROUND_TAB, + blink::mojom::WindowFeatures()); web_app::CreateWebAppFromManifest( containing_contents, /*bypass_service_worker_check=*/true, webapps::WebappInstallSource::MANAGEMENT_API,
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc index b492b94..92adb54 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -437,17 +437,15 @@ // The |pending_delete_rfh| and its children are now pending deletion. // Stop tracking them. - pending_delete_rfh->ForEachRenderFrameHost(base::BindRepeating( - [](WebNavigationTabObserver* observer, - content::RenderFrameHost* render_frame_host) { + pending_delete_rfh->ForEachRenderFrameHost( + [this](content::RenderFrameHost* render_frame_host) { auto* navigation_state = FrameNavigationState::GetForCurrentDocument(render_frame_host); if (navigation_state) { - observer->RenderFrameDeleted(render_frame_host); + RenderFrameDeleted(render_frame_host); FrameNavigationState::DeleteForCurrentDocument(render_frame_host); } - }, - this)); + }); } ExtensionFunction::ResponseAction WebNavigationGetFrameFunction::Run() { @@ -567,11 +565,10 @@ // We currently do not expose back/forward cached frames in the GetAllFrames // API, but we do explicitly include prerendered frames. - web_contents->ForEachRenderFrameHost( - base::BindRepeating( - [](content::WebContents* web_contents, - std::vector<GetAllFrames::Results::DetailsType>& result_list, - content::RenderFrameHost* render_frame_host) { + web_contents + ->ForEachRenderFrameHostWithAction( + [web_contents, + &result_list](content::RenderFrameHost* render_frame_host) { // Don't expose inner WebContents for the getFrames API. if (content::WebContents::FromRenderFrameHost(render_frame_host) != web_contents) { @@ -619,8 +616,7 @@ frame.error_occurred = navigation_state->GetErrorOccurredInFrame(); result_list.push_back(std::move(frame)); return content::RenderFrameHost::FrameIterationAction::kContinue; - }, - web_contents, std::ref(result_list))); + }); return RespondNow(ArgumentList(GetAllFrames::Results::Create(result_list))); }
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc index 95a246aa..a83081f5 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
@@ -288,13 +288,8 @@ ASSERT_TRUE(RunExtensionTest("webnavigation/api")) << message_; } -// TODO(crbug.com/1352957): Flakily timing out on win/mac/cros. -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) -#define MAYBE_GetFrame DISABLED_GetFrame -#else -#define MAYBE_GetFrame GetFrame -#endif -IN_PROC_BROWSER_TEST_P(WebNavigationApiTestWithContextType, MAYBE_GetFrame) { +// TODO(crbug.com/1352957): Flakily timing out. +IN_PROC_BROWSER_TEST_P(WebNavigationApiTestWithContextType, DISABLED_GetFrame) { ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("webnavigation/getFrame")) << message_; }
diff --git a/chrome/browser/extensions/back_forward_cache_browsertest.cc b/chrome/browser/extensions/back_forward_cache_browsertest.cc index 6e93e99..f550599 100644 --- a/chrome/browser/extensions/back_forward_cache_browsertest.cc +++ b/chrome/browser/extensions/back_forward_cache_browsertest.cc
@@ -972,10 +972,16 @@ base::StringPrintf(kScript, iframe_frame_tree_node_id))); } +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_StorageCallbackEvicts DISABLED_StorageCallbackEvicts +#else +#define MAYBE_StorageCallbackEvicts StorageCallbackEvicts +#endif // Test that running extensions message dispatching via a ScriptContext::ForEach // for back forward cached pages causes eviction of that RenderFrameHost. IN_PROC_BROWSER_TEST_F(ExtensionBackForwardCacheBrowserTest, - StorageCallbackEvicts) { + MAYBE_StorageCallbackEvicts) { const Extension* extension = extension = LoadExtension(test_data_dir_.AppendASCII("back_forward_cache") .AppendASCII("content_script_storage"));
diff --git a/chrome/browser/extensions/extension_storage_apitest.cc b/chrome/browser/extensions/extension_storage_apitest.cc index bb55525..f423965 100644 --- a/chrome/browser/extensions/extension_storage_apitest.cc +++ b/chrome/browser/extensions/extension_storage_apitest.cc
@@ -9,7 +9,8 @@ namespace extensions { // Flaky for Mac: crbug.com/1141100 -#if BUILDFLAG(IS_MAC) +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA) #define MAYBE_Storage DISABLED_Storage #else #define MAYBE_Storage Storage
diff --git a/chrome/browser/extensions/process_manager_browsertest.cc b/chrome/browser/extensions/process_manager_browsertest.cc index 9c33839..7953803 100644 --- a/chrome/browser/extensions/process_manager_browsertest.cc +++ b/chrome/browser/extensions/process_manager_browsertest.cc
@@ -66,12 +66,6 @@ namespace { -void AddFrameToSet(std::set<content::RenderFrameHost*>* frames, - content::RenderFrameHost* rfh) { - if (rfh->IsRenderFrameLive()) - frames->insert(rfh); -} - GURL CreateBlobURL(content::RenderFrameHost* frame, const std::string& content) { std::string blob_url_string; @@ -153,8 +147,10 @@ : content::WebContentsObserver(web_contents), message_loop_runner_(new content::MessageLoopRunner) { web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating(&AddFrameToSet, - base::Unretained(&live_original_frames_))); + [this](content::RenderFrameHost* rfh) { + if (rfh->IsRenderFrameLive()) + live_original_frames_.insert(rfh); + }); } NavigationCompletedObserver(const NavigationCompletedObserver&) = delete; @@ -182,7 +178,10 @@ bool AllLiveRenderFrameHostsAreCurrent() { std::set<content::RenderFrameHost*> current_frames; web_contents()->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating(&AddFrameToSet, base::Unretained(¤t_frames))); + [¤t_frames](content::RenderFrameHost* rfh) { + if (rfh->IsRenderFrameLive()) + current_frames.insert(rfh); + }); return base::STLSetDifference<std::set<content::RenderFrameHost*>>( live_original_frames_, current_frames)
diff --git a/chrome/browser/extensions/settings_api_bubble_delegate.cc b/chrome/browser/extensions/settings_api_bubble_delegate.cc index 9456837..baaf466 100644 --- a/chrome/browser/extensions/settings_api_bubble_delegate.cc +++ b/chrome/browser/extensions/settings_api_bubble_delegate.cc
@@ -118,9 +118,9 @@ return std::u16string(); } - bool home_change = settings->homepage != NULL; + bool home_change = settings->homepage.has_value(); bool startup_change = !settings->startup_pages.empty(); - bool search_change = settings->search_engine != NULL; + bool search_change = settings->search_engine.has_value(); int first_line_id = 0; int second_line_id = 0;
diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc index 8a70e86..f96730ff 100644 --- a/chrome/browser/extensions/tab_helper.cc +++ b/chrome/browser/extensions/tab_helper.cc
@@ -210,7 +210,7 @@ CreateSessionServiceTabHelper(web_contents); // The Unretained() is safe because ForEachRenderFrameHost() is synchronous. web_contents->ForEachRenderFrameHost( - base::BindRepeating(&TabHelper::SetTabId, base::Unretained(this))); + [this](content::RenderFrameHost* host) { SetTabId(host); }); active_tab_permission_granter_ = std::make_unique<ActiveTabPermissionGranter>( web_contents, sessions::SessionTabHelper::IdForTab(web_contents).id(), profile_);
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 1209bd8..6436aedd 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -1498,7 +1498,7 @@ { "name": "download-bubble", "owners": [ "bhatiarohit", "chrome-counter-abuse-alerts@google.com"], - "expiry_milestone": 106 + "expiry_milestone": 108 }, { "name": "download-bubble-v2", @@ -1506,7 +1506,7 @@ "bhatiarohit", "chrome-counter-abuse-alerts@google.com" ], - "expiry_milestone": 106 + "expiry_milestone": 108 }, { "name": "download-later", @@ -5990,6 +5990,11 @@ "expiry_milestone": 105 }, { + "name": "smart-sorting-new-destinations", + "owners": [ "bwwilliams@google.com", "bling-flags@google.com" ], + "expiry_milestone": 111 + }, + { "name": "smart-sorting-new-overflow-menu", "owners": [ "bwwilliams@google.com", "bling-flags@google.com" ], "expiry_milestone": 108 @@ -6017,6 +6022,14 @@ "expiry_milestone": 100 }, { + "name": "split-tabstrip", + "owners": [ + "chrome-desktop-ui-sea@google.com", + "tbergquist" + ], + "expiry_milestone": 115 + }, + { "name": "start-surface", "owners": [ "gogerald", "bling-flags@google.com" ], "expiry_milestone": 94
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index f23d7fca..b700521 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -2479,6 +2479,11 @@ const char kScrollableTabStripDescription[] = "Enables tab strip to scroll left and right when full."; +const char kSplitTabStripName[] = "Split TabStrip"; +const char kSplitTabStripDescription[] = + "Splits pinned and unpinned tabs into separate TabStrips under the hood. " + "Pure refactoring, no user-visible behavioral changes are included."; + const char kScrollUnificationName[] = "Scroll Unification"; const char kScrollUnificationDescription[] = "Refactoring project that eliminates scroll handling code from Blink. "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 39dc1964..5a42777 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1389,6 +1389,9 @@ extern const char kScrollableTabStripName[]; extern const char kScrollableTabStripDescription[]; +extern const char kSplitTabStripName[]; +extern const char kSplitTabStripDescription[]; + extern const char kScrollUnificationName[]; extern const char kScrollUnificationDescription[];
diff --git a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediator.java b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediator.java index fa386f9..6bbdda6 100644 --- a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediator.java +++ b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediator.java
@@ -182,8 +182,7 @@ // SearchDelegate implementation. @Override public void onSearchTextChanged(String query) { - resetModel(); - startQuery(query); + setQueryState(QueryState.forQuery(query, mDelegate.getSearchEmptyString())); } @Override @@ -214,10 +213,8 @@ mQueryState = queryState; mToolbarModel.set(HistoryClustersToolbarProperties.QUERY_STATE, queryState); - if (!queryState.isSearching()) { - resetModel(); - startQuery(mQueryState.getQuery()); - } + resetModel(); + startQuery(mQueryState.getQuery()); } @VisibleForTesting @@ -371,8 +368,9 @@ } private void queryComplete(HistoryClustersResult result) { - boolean isQueryLess = !mQueryState.isSearching(); - if (isQueryLess) { + boolean showClustersCollapsed = + !mQueryState.isSearching() || mQueryState.getQuery().isEmpty(); + if (showClustersCollapsed) { ensureHeaders(); for (Map.Entry<String, Integer> entry : result.getLabelCounts().entrySet()) { // Check if label exists in the model already
diff --git a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersToolbar.java b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersToolbar.java index 28951d0a..e2e08de 100644 --- a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersToolbar.java +++ b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersToolbar.java
@@ -44,8 +44,9 @@ } } - void setSearchText(String text) { + void setSearchText(String text, boolean wantFocus) { mSearchText.setText(text); + if (wantFocus) return; mSearchText.setSelection(text.length()); mSearchText.clearFocus(); }
diff --git a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersViewBinder.java b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersViewBinder.java index 04b0f427..b197f9b 100644 --- a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersViewBinder.java +++ b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersViewBinder.java
@@ -48,8 +48,11 @@ if (key == HistoryClustersToolbarProperties.QUERY_STATE) { QueryState queryState = model.get(HistoryClustersToolbarProperties.QUERY_STATE); if (queryState.isSearching()) { - toolbar.showSearchView(queryState.getQuery().isEmpty()); - toolbar.setSearchText(queryState.getQuery()); + String query = queryState.getQuery(); + toolbar.setSearchText(query, query.isEmpty()); + if (!toolbar.isSearching()) { + toolbar.showSearchView(queryState.getQuery().isEmpty()); + } } else { toolbar.hideSearchView(); }
diff --git a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/QueryState.java b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/QueryState.java index ae262ad..3208ea595 100644 --- a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/QueryState.java +++ b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/QueryState.java
@@ -4,8 +4,12 @@ package org.chromium.chrome.browser.history_clusters; +import android.text.TextUtils; + import androidx.annotation.NonNull; +import java.util.Objects; + /** * Class representing the state of the search UI. There are two meaningful properties: whether a * search is currently active and what that search is. Making these properties distinct lets us @@ -42,4 +46,18 @@ boolean isSearching() { return mIsSearching; } + + @Override + public int hashCode() { + return Objects.hash(mIsSearching, mIsSearching, mSearchEmptyString); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof QueryState)) return false; + QueryState other = (QueryState) obj; + + return other.mIsSearching == mIsSearching && TextUtils.equals(mQuery, other.mQuery) + && TextUtils.equals(mSearchEmptyString, other.mSearchEmptyString); + } } \ No newline at end of file
diff --git a/chrome/browser/long_screenshots/long_screenshots_tab_service.cc b/chrome/browser/long_screenshots/long_screenshots_tab_service.cc index 52e6c943..7d89450 100644 --- a/chrome/browser/long_screenshots/long_screenshots_tab_service.cc +++ b/chrome/browser/long_screenshots/long_screenshots_tab_service.cc
@@ -206,18 +206,16 @@ } std::vector<content::RenderFrameHost*> child_frames; - main_frame->ForEachRenderFrameHost(base::BindRepeating( - [](std::vector<content::RenderFrameHost*>* child_frames, - content::RenderFrameHost* main_frame, content::RenderFrameHost* rfh) { + main_frame->ForEachRenderFrameHostWithAction( + [main_frame, &child_frames](content::RenderFrameHost* rfh) { // All frames get traversed in breadth-first order. // If a direct child is found, skip traversing its children. if (rfh->GetParent() == main_frame) { - child_frames->push_back(rfh); + child_frames.push_back(rfh); return content::RenderFrameHost::FrameIterationAction::kSkipChildren; } return content::RenderFrameHost::FrameIterationAction::kContinue; - }, - &child_frames, main_frame)); + }); // In AMP pages the main frame should have exactly one child subframe. if (child_frames.size() != 1) {
diff --git a/chrome/browser/media/capture_access_handler_base.cc b/chrome/browser/media/capture_access_handler_base.cc index bccdf0d..4d31839 100644 --- a/chrome/browser/media/capture_access_handler_base.cc +++ b/chrome/browser/media/capture_access_handler_base.cc
@@ -49,14 +49,13 @@ } void SetWebContents(int render_process_id, int render_frame_id) { - auto* target_web_contents = content::WebContents::FromRenderFrameHost( + auto* web_contents = content::WebContents::FromRenderFrameHost( content::RenderFrameHost::FromID(render_process_id, render_frame_id)); // Use the outermost WebContents in the WebContents tree, if possible. // If we can't find the WebContents, clear |target_web_contents|. - this->target_web_contents = - target_web_contents - ? target_web_contents->GetOutermostWebContents()->GetWeakPtr() - : nullptr; + target_web_contents = + web_contents ? web_contents->GetOutermostWebContents()->GetWeakPtr() + : nullptr; } content::WebContents* GetWebContents() const {
diff --git a/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc b/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc index cecfbbfd..3c12232 100644 --- a/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc +++ b/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc
@@ -69,8 +69,9 @@ const std::string& origin) { ListPrefUpdate update(prefs, media_router::prefs::kMediaRouterTabMirroringSources); - if (!base::Contains(update->GetListDeprecated(), base::Value(origin))) - update->Append(origin); + base::Value::List& list = update->GetList(); + if (!base::Contains(list, base::Value(origin))) + list.Append(origin); } #endif @@ -799,7 +800,7 @@ { ListPrefUpdate update(profile()->GetPrefs(), prefs::kMediaRouterTabMirroringSources); - update->EraseListValue(base::Value(origin)); + update->GetList().EraseValue(base::Value(origin)); } // Auto-join requests should now go through. @@ -857,7 +858,7 @@ ListPrefUpdate update( profile()->GetPrimaryOTRProfile(/*create_if_needed=*/true)->GetPrefs(), prefs::kMediaRouterTabMirroringSources); - update->EraseListValue(base::Value(origin)); + update->GetList().EraseValue(base::Value(origin)); } // Auto-join requests should now go through.
diff --git a/chrome/browser/net/cookie_policy_browsertest.cc b/chrome/browser/net/cookie_policy_browsertest.cc index 6b0fddec..d2062b6 100644 --- a/chrome/browser/net/cookie_policy_browsertest.cc +++ b/chrome/browser/net/cookie_policy_browsertest.cc
@@ -620,8 +620,16 @@ TestNestedThirdPartyIFrameStorage(TestType::kWorker); } +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. +#if BUILDFLAG(IS_FUCHSIA) +#define MAYBE_NestedFirstPartyIFrameStorageForFrame \ + DISABLED_NestedFirstPartyIFrameStorageForFrame +#else +#define MAYBE_NestedFirstPartyIFrameStorageForFrame \ + NestedFirstPartyIFrameStorageForFrame +#endif IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest, - NestedFirstPartyIFrameStorageForFrame) { + MAYBE_NestedFirstPartyIFrameStorageForFrame) { TestNestedFirstPartyIFrameStorage(TestType::kFrame); }
diff --git a/chrome/browser/net/errorpage_browsertest.cc b/chrome/browser/net/errorpage_browsertest.cc index c11f3af0..d1a5aea 100644 --- a/chrome/browser/net/errorpage_browsertest.cc +++ b/chrome/browser/net/errorpage_browsertest.cc
@@ -1069,25 +1069,28 @@ // launch chrome://diagnostics/?connectivity app by default. Not running test on // LaCROS due to errors on Wayland initialization and to keep test to ChromeOS // devices. -// TODO(crbug.com/1285441): Disabled due to test flakes. using ErrorPageOfflineAppLaunchTest = ash::SystemWebAppBrowserTestBase; -IN_PROC_BROWSER_TEST_F(ErrorPageOfflineAppLaunchTest, - DISABLED_DiagnosticsConnectivity) { +IN_PROC_BROWSER_TEST_F(ErrorPageOfflineAppLaunchTest, DiagnosticsConnectivity) { WaitForTestSystemAppInstall(); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), URLRequestFailedJob::GetMockHttpUrl(net::ERR_INTERNET_DISCONNECTED))); + const GURL expected_url = GURL("chrome://diagnostics/?connectivity"); + content::TestNavigationObserver observer(expected_url); + observer.StartWatchingNewWebContents(); + // Click to open diagnostics app. ClickDiagnosticsLink(browser()); ash::FlushSystemWebAppLaunchesForTesting(browser()->profile()); + observer.Wait(); + EXPECT_TRUE(observer.last_navigation_succeeded()); // The active screen should be Connectivity Diagnostics app. content::WebContents* contents = ::chrome::FindLastActive()->tab_strip_model()->GetActiveWebContents(); - EXPECT_EQ(GURL("chrome://diagnostics/?connectivity"), - contents->GetVisibleURL()); + EXPECT_EQ(expected_url, contents->GetVisibleURL()); } #endif // BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc b/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc index f58586f..132e1257 100644 --- a/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc +++ b/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc
@@ -2460,14 +2460,9 @@ frame_routing_ids; web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating( - [](std::unordered_set<content::GlobalRenderFrameHostId, - content::GlobalRenderFrameHostIdHasher>* - frame_routing_ids, - content::RenderFrameHost* frame) { - frame_routing_ids->insert(frame->GetGlobalId()); - }, - &frame_routing_ids)); + [&frame_routing_ids](content::RenderFrameHost* frame) { + frame_routing_ids.insert(frame->GetGlobalId()); + }); return frame_routing_ids; }
diff --git a/chrome/browser/pdf/pdf_extension_test.cc b/chrome/browser/pdf/pdf_extension_test.cc index df1bc3f..0c966f93 100644 --- a/chrome/browser/pdf/pdf_extension_test.cc +++ b/chrome/browser/pdf/pdf_extension_test.cc
@@ -203,14 +203,25 @@ run_loop.Run(); } -void WaitForLoadStart(WebContents* web_contents) { - while (!web_contents->IsLoading() && - !web_contents->GetController().GetLastCommittedEntry()) { +// In preparation for the migration of guest view from inner WebContents to +// MPArch (crbug/1261928), individual tests should avoid accessing the guest's +// inner WebContents. The direct access is centralized in this helper function +// for easier migration. +// +// TODO(crbug/1261928): Update this implementation for MPArch, and consider +// relocate it to `content/public/test/browser_test_utils.h`. +void WaitForGuestLoadStartThenStop(GuestViewBase* guest_view) { + auto* guest_contents = guest_view->web_contents(); + + while (!guest_contents->IsLoading() && + !guest_contents->GetController().GetLastCommittedEntry()) { base::RunLoop run_loop; base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); run_loop.Run(); } + + ASSERT_TRUE(content::WaitForLoadStop(guest_contents)); } } // namespace @@ -223,6 +234,8 @@ class PDFExtensionTest : public extensions::ExtensionApiTest { public: + PDFExtensionTest() { GuestViewManager::set_factory_for_testing(&factory_); } + void SetUpCommandLine(base::CommandLine* /*command_line*/) override { feature_list_.InitWithFeatures(GetEnabledFeatures(), GetDisabledFeatures()); } @@ -333,6 +346,23 @@ } protected: + TestGuestViewManager* GetGuestViewManager() { + // TODO(wjmaclean): Re-implement FromBrowserContext in the + // TestGuestViewManager class to avoid all callers needing this cast. + auto* manager = static_cast<TestGuestViewManager*>( + TestGuestViewManager::FromBrowserContext(browser()->profile())); + // Test code may access the TestGuestViewManager before it would be created + // during creation of the first guest. + if (!manager) { + manager = static_cast<TestGuestViewManager*>( + GuestViewManager::CreateWithDelegate( + browser()->profile(), + ExtensionsAPIClient::Get()->CreateGuestViewManagerDelegate( + browser()->profile()))); + } + return manager; + } + WebContents* GetOnlyGuestContents(WebContents* embedder_contents) const { content::BrowserPluginGuestManager* guest_manager = embedder_contents->GetBrowserContext()->GetGuestManager(); @@ -383,6 +413,7 @@ private: base::test::ScopedFeatureList feature_list_; + TestGuestViewManagerFactory factory_; }; class PDFExtensionTestWithPartialLoading : public PDFExtensionTest { @@ -395,57 +426,26 @@ } }; -class PDFExtensionTestWithTestGuestViewManager : public PDFExtensionTest { - public: - PDFExtensionTestWithTestGuestViewManager() { - GuestViewManager::set_factory_for_testing(&factory_); - } - - protected: - TestGuestViewManager* GetGuestViewManager() { - // TODO(wjmaclean): Re-implement FromBrowserContext in the - // TestGuestViewManager class to avoid all callers needing this cast. - auto* manager = static_cast<TestGuestViewManager*>( - TestGuestViewManager::FromBrowserContext(browser()->profile())); - // Test code may access the TestGuestViewManager before it would be created - // during creation of the first guest. - if (!manager) { - manager = static_cast<TestGuestViewManager*>( - GuestViewManager::CreateWithDelegate( - browser()->profile(), - ExtensionsAPIClient::Get()->CreateGuestViewManagerDelegate( - browser()->profile()))); - } - return manager; - } - - private: - TestGuestViewManagerFactory factory_; -}; - // This test is a re-implementation of // WebPluginContainerTest.PluginDocumentPluginIsFocused, which was introduced // for https://crbug.com/536637. The original implementation checked that the // BrowserPlugin hosting the pdf extension was focused; in this re-write, we // make sure the guest view's WebContents has focus. -IN_PROC_BROWSER_TEST_F(PDFExtensionTestWithTestGuestViewManager, - PdfInMainFrameHasFocus) { +IN_PROC_BROWSER_TEST_F(PDFExtensionTest, PdfInMainFrameHasFocus) { // Load test HTML, and verify the text area has focus. ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL("/pdf/test.pdf"))); - auto* embedder_web_contents = GetActiveWebContents(); + auto* primary_main_frame = GetActiveWebContents()->GetPrimaryMainFrame(); // Verify the pdf has loaded. - auto* guest_web_contents = - GetGuestViewManager()->DeprecatedWaitForSingleGuestCreated(); - ASSERT_TRUE(guest_web_contents); - EXPECT_NE(embedder_web_contents, guest_web_contents); - WaitForLoadStart(guest_web_contents); - EXPECT_TRUE(content::WaitForLoadStop(guest_web_contents)); + auto* guest_view = GetGuestViewManager()->WaitForSingleGuestViewCreated(); + ASSERT_TRUE(guest_view); + ASSERT_NE(primary_main_frame, guest_view->GetGuestMainFrame()); + WaitForGuestLoadStartThenStop(guest_view); // Make sure the guest WebContents has focus. - EXPECT_EQ(guest_web_contents, - content::GetFocusedWebContents(embedder_web_contents)); + ASSERT_EQ(GetActiveWebContents()->GetFocusedFrame(), + guest_view->GetGuestMainFrame()); } // This test verifies that when a PDF is loaded, that (i) the embedder @@ -454,42 +454,40 @@ // has the correct URL for the PDF extension. // TODO(wjmaclean): Are there any attributes we can/should test with respect to // the extension's loaded html? -IN_PROC_BROWSER_TEST_F(PDFExtensionTestWithTestGuestViewManager, - PdfExtensionLoadedInGuest) { +IN_PROC_BROWSER_TEST_F(PDFExtensionTest, PdfExtensionLoadedInGuest) { // Load test HTML, and verify the text area has focus. const GURL main_url(embedded_test_server()->GetURL("/pdf/test.pdf")); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), main_url)); - auto* embedder_web_contents = GetActiveWebContents(); + auto* primary_main_frame = GetActiveWebContents()->GetPrimaryMainFrame(); // Verify the pdf has loaded. - auto* guest_web_contents = - GetGuestViewManager()->DeprecatedWaitForSingleGuestCreated(); - ASSERT_TRUE(guest_web_contents); - EXPECT_NE(embedder_web_contents, guest_web_contents); - WaitForLoadStart(guest_web_contents); - EXPECT_TRUE(content::WaitForLoadStop(guest_web_contents)); + auto* guest_view = GetGuestViewManager()->WaitForSingleGuestViewCreated(); + ASSERT_TRUE(guest_view); + EXPECT_NE(primary_main_frame, guest_view->GetGuestMainFrame()); + WaitForGuestLoadStartThenStop(guest_view); // Verify we loaded the extension. const GURL extension_url( "chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html"); - EXPECT_EQ(extension_url, guest_web_contents->GetLastCommittedURL()); - EXPECT_EQ(main_url, embedder_web_contents->GetLastCommittedURL()); + EXPECT_EQ(extension_url, + guest_view->GetGuestMainFrame()->GetLastCommittedURL()); + EXPECT_EQ(main_url, primary_main_frame->GetLastCommittedURL()); // Make sure the embedder has the correct html boilerplate. - EXPECT_EQ(1, content::EvalJs(embedder_web_contents, - "document.body.children.length;") - .ExtractInt()); - EXPECT_EQ("EMBED", content::EvalJs(embedder_web_contents, + EXPECT_EQ( + 1, content::EvalJs(primary_main_frame, "document.body.children.length;") + .ExtractInt()); + EXPECT_EQ("EMBED", content::EvalJs(primary_main_frame, "document.body.firstChild.tagName;") .ExtractString()); - EXPECT_EQ("application/pdf", content::EvalJs(embedder_web_contents, + EXPECT_EQ("application/pdf", content::EvalJs(primary_main_frame, "document.body.firstChild.type;") .ExtractString()); - EXPECT_EQ("about:blank", content::EvalJs(embedder_web_contents, - "document.body.firstChild.src;") - .ExtractString()); + EXPECT_EQ("about:blank", + content::EvalJs(primary_main_frame, "document.body.firstChild.src;") + .ExtractString()); EXPECT_TRUE( - content::EvalJs(embedder_web_contents, + content::EvalJs(primary_main_frame, "document.body.firstChild.hasAttribute('internalid');") .ExtractBool()); } @@ -533,26 +531,24 @@ // attaching an inner WebContents for a PDF, the inner WebContents can still // successfully complete its attachment and subsequent navigation. See // https://crbug.com/1295431. -IN_PROC_BROWSER_TEST_F(PDFExtensionTestWithTestGuestViewManager, - PdfExtensionLoadedWhileOldPdfCloses) { +IN_PROC_BROWSER_TEST_F(PDFExtensionTest, PdfExtensionLoadedWhileOldPdfCloses) { // Load test PDF in first tab. const GURL main_url(embedded_test_server()->GetURL("/pdf/test.pdf")); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), main_url)); - auto* embedder_web_contents = GetActiveWebContents(); + auto* primary_main_frame = GetActiveWebContents()->GetPrimaryMainFrame(); // Verify the PDF has loaded. - auto* guest_web_contents = - GetGuestViewManager()->DeprecatedWaitForSingleGuestCreated(); - ASSERT_TRUE(guest_web_contents); - EXPECT_NE(embedder_web_contents, guest_web_contents); - WaitForLoadStart(guest_web_contents); - EXPECT_TRUE(content::WaitForLoadStop(guest_web_contents)); + auto* guest_view = GetGuestViewManager()->WaitForSingleGuestViewCreated(); + ASSERT_TRUE(guest_view); + EXPECT_NE(primary_main_frame, guest_view->GetGuestMainFrame()); + WaitForGuestLoadStartThenStop(guest_view); // Verify we loaded the extension. const GURL extension_url( "chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html"); - EXPECT_EQ(extension_url, guest_web_contents->GetLastCommittedURL()); - EXPECT_EQ(main_url, embedder_web_contents->GetLastCommittedURL()); + EXPECT_EQ(extension_url, + guest_view->GetGuestMainFrame()->GetLastCommittedURL()); + EXPECT_EQ(main_url, primary_main_frame->GetLastCommittedURL()); // Open another tab and navigate it to a same-site non-PDF URL. ui_test_utils::TabAddedWaiter add_tab1(browser()); @@ -578,89 +574,87 @@ // the middle of initialization. In https://crbug.com/1295431, the extension // process exited here and caused a crash when the second PDF resumed. EXPECT_EQ(2U, GetGuestViewManager()->GetNumGuestsActive()); - content::WebContentsDestroyedWatcher destroyed_watcher(guest_web_contents); ASSERT_TRUE(browser()->tab_strip_model()->CloseWebContentsAt( 0, TabCloseTypes::CLOSE_USER_GESTURE)); - destroyed_watcher.Wait(); + // `TestGuestViewManager` manages the guests by the order of creation. + GetGuestViewManager()->WaitForFirstGuestDeleted(); EXPECT_EQ(1U, GetGuestViewManager()->GetNumGuestsActive()); + primary_main_frame = new_web_contents->GetPrimaryMainFrame(); // Now resume the guest attachment and ensure the second PDF loads without // crashing. delayer.ResumeAttach(); navigation_observer.Wait(); - auto* guest_web_contents2 = - GetGuestViewManager()->DeprecatedWaitForSingleGuestCreated(); - ASSERT_TRUE(guest_web_contents2); - EXPECT_NE(embedder_web_contents, guest_web_contents2); - WaitForLoadStart(guest_web_contents2); - EXPECT_TRUE(content::WaitForLoadStop(guest_web_contents2)); + auto* guest_view2 = GetGuestViewManager()->WaitForSingleGuestViewCreated(); + ASSERT_TRUE(guest_view2); + EXPECT_NE(primary_main_frame, guest_view2->GetGuestMainFrame()); + WaitForGuestLoadStartThenStop(guest_view2); // Verify we loaded the extension. - EXPECT_EQ(extension_url, guest_web_contents2->GetLastCommittedURL()); - EXPECT_EQ(main_url, new_web_contents->GetLastCommittedURL()); + EXPECT_EQ(extension_url, + guest_view2->GetGuestMainFrame()->GetLastCommittedURL()); + EXPECT_EQ(main_url, primary_main_frame->GetLastCommittedURL()); } // This test verifies that when a PDF is served with a restrictive // Content-Security-Policy, the embed tag is still sized correctly. // Regression test for https://crbug.com/271452. -IN_PROC_BROWSER_TEST_F(PDFExtensionTestWithTestGuestViewManager, - CSPDoesNotBlockEmbedStyles) { +IN_PROC_BROWSER_TEST_F(PDFExtensionTest, CSPDoesNotBlockEmbedStyles) { const GURL main_url(embedded_test_server()->GetURL("/pdf/test-csp.pdf")); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), main_url)); - auto* embedder_web_contents = GetActiveWebContents(); - ASSERT_TRUE(embedder_web_contents); + ASSERT_TRUE(GetActiveWebContents()); + auto* primary_main_frame = GetActiveWebContents()->GetPrimaryMainFrame(); + ASSERT_TRUE(primary_main_frame); // Verify the pdf has loaded. - auto* guest_web_contents = - GetGuestViewManager()->DeprecatedWaitForSingleGuestCreated(); - ASSERT_TRUE(guest_web_contents); - EXPECT_NE(embedder_web_contents, guest_web_contents); - WaitForLoadStart(guest_web_contents); - EXPECT_TRUE(content::WaitForLoadStop(guest_web_contents)); + auto* guest_view = GetGuestViewManager()->WaitForSingleGuestViewCreated(); + ASSERT_TRUE(guest_view); + auto* guest_main_frame = guest_view->GetGuestMainFrame(); + EXPECT_NE(primary_main_frame, guest_main_frame); + WaitForGuestLoadStartThenStop(guest_view); // Verify the extension was loaded. const GURL extension_url( "chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html"); - EXPECT_EQ(extension_url, guest_web_contents->GetLastCommittedURL()); - EXPECT_EQ(main_url, embedder_web_contents->GetLastCommittedURL()); + EXPECT_EQ(extension_url, guest_main_frame->GetLastCommittedURL()); + EXPECT_EQ(main_url, primary_main_frame->GetLastCommittedURL()); // Verify that the plugin occupies all of the page area. - const gfx::Rect embedder_rect = embedder_web_contents->GetContainerBounds(); - const gfx::Rect guest_rect = guest_web_contents->GetContainerBounds(); + const gfx::Rect embedder_rect = + primary_main_frame->GetView()->GetViewBounds(); + const gfx::Rect guest_rect = guest_main_frame->GetView()->GetViewBounds(); EXPECT_EQ(embedder_rect, guest_rect); } // This test verifies that when a PDF is served with // Content-Security-Policy: sandbox, this is ignored and the PDF is displayed. // Regression test for https://crbug.com/1187122. -IN_PROC_BROWSER_TEST_F(PDFExtensionTestWithTestGuestViewManager, - CSPWithSandboxDoesNotBlockPDF) { +IN_PROC_BROWSER_TEST_F(PDFExtensionTest, CSPWithSandboxDoesNotBlockPDF) { const GURL main_url( embedded_test_server()->GetURL("/pdf/test-csp-sandbox.pdf")); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), main_url)); - auto* embedder_web_contents = GetActiveWebContents(); - ASSERT_TRUE(embedder_web_contents); + ASSERT_TRUE(GetActiveWebContents()); + auto* primary_main_frame = GetActiveWebContents()->GetPrimaryMainFrame(); + ASSERT_TRUE(primary_main_frame); // Verify the pdf has loaded. - auto* guest_web_contents = - GetGuestViewManager()->DeprecatedWaitForSingleGuestCreated(); - ASSERT_TRUE(guest_web_contents); - EXPECT_NE(embedder_web_contents, guest_web_contents); - WaitForLoadStart(guest_web_contents); - EXPECT_TRUE(content::WaitForLoadStop(guest_web_contents)); + auto* guest_view = GetGuestViewManager()->WaitForSingleGuestViewCreated(); + ASSERT_TRUE(guest_view); + EXPECT_NE(primary_main_frame, guest_view->GetGuestMainFrame()); + WaitForGuestLoadStartThenStop(guest_view); // Verify the extension was loaded. const GURL extension_url( "chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html"); - EXPECT_EQ(extension_url, guest_web_contents->GetLastCommittedURL()); - EXPECT_EQ(main_url, embedder_web_contents->GetLastCommittedURL()); + EXPECT_EQ(extension_url, + guest_view->GetGuestMainFrame()->GetLastCommittedURL()); + EXPECT_EQ(main_url, primary_main_frame->GetLastCommittedURL()); } // This test verifies that Content-Security-Policy's frame-ancestors 'none' // directive is effective on a PDF response. // Regression test for https://crbug.com/1107535. -IN_PROC_BROWSER_TEST_F(PDFExtensionTestWithTestGuestViewManager, - CSPFrameAncestorsCanBlockEmbedding) { +IN_PROC_BROWSER_TEST_F(PDFExtensionTest, CSPFrameAncestorsCanBlockEmbedding) { WebContents* web_contents = GetActiveWebContents(); content::WebContentsConsoleObserver console_observer(web_contents); console_observer.SetPattern( @@ -679,27 +673,27 @@ // This test verifies that Content-Security-Policy's frame-ancestors directive // overrides an X-Frame-Options header on a PDF response. // Regression test for https://crbug.com/1107535. -IN_PROC_BROWSER_TEST_F(PDFExtensionTestWithTestGuestViewManager, +IN_PROC_BROWSER_TEST_F(PDFExtensionTest, CSPFrameAncestorsOverridesXFrameOptions) { const GURL main_url( embedded_test_server()->GetURL("/pdf/frame-test-csp-and-xfo.html")); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), main_url)); - auto* embedder_web_contents = GetActiveWebContents(); - ASSERT_TRUE(embedder_web_contents); + ASSERT_TRUE(GetActiveWebContents()); + auto* primary_main_frame = GetActiveWebContents()->GetPrimaryMainFrame(); + ASSERT_TRUE(primary_main_frame); // Verify the pdf has loaded. - auto* guest_web_contents = - GetGuestViewManager()->DeprecatedWaitForSingleGuestCreated(); - ASSERT_TRUE(guest_web_contents); - EXPECT_NE(embedder_web_contents, guest_web_contents); - WaitForLoadStart(guest_web_contents); - EXPECT_TRUE(content::WaitForLoadStop(guest_web_contents)); + auto* guest_view = GetGuestViewManager()->WaitForSingleGuestViewCreated(); + ASSERT_TRUE(guest_view); + EXPECT_NE(primary_main_frame, guest_view->GetGuestMainFrame()); + WaitForGuestLoadStartThenStop(guest_view); // Verify the extension was loaded. const GURL extension_url( "chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html"); - EXPECT_EQ(extension_url, guest_web_contents->GetLastCommittedURL()); - EXPECT_EQ(main_url, embedder_web_contents->GetLastCommittedURL()); + EXPECT_EQ(extension_url, + guest_view->GetGuestMainFrame()->GetLastCommittedURL()); + EXPECT_EQ(main_url, primary_main_frame->GetLastCommittedURL()); } class PDFExtensionLoadTest : public PDFExtensionTest, @@ -4525,14 +4519,13 @@ run_loop->Run(); } -class PDFExtensionPrerenderAndFencedFrameTest - : public PDFExtensionTestWithTestGuestViewManager { +class PDFExtensionPrerenderAndFencedFrameTest : public PDFExtensionTest { public: PDFExtensionPrerenderAndFencedFrameTest() = default; ~PDFExtensionPrerenderAndFencedFrameTest() override = default; void SetUpCommandLine(base::CommandLine* command_line) override { - PDFExtensionTestWithTestGuestViewManager::SetUpCommandLine(command_line); + PDFExtensionTest::SetUpCommandLine(command_line); // `prerender_helper_` and `fenced_frame_helper_` has a ScopedFeatureList so // we needed to delay its creation until now because PDFExtensionTest // also uses a ScopedFeatureList and initialization order matters. @@ -4583,11 +4576,9 @@ GetActiveWebContents()->GetPrimaryMainFrame(), fenced_frame_url); ASSERT_TRUE(fenced_frame_host); - auto* guest_web_contents = - GetGuestViewManager()->DeprecatedWaitForSingleGuestCreated(); - ASSERT_TRUE(guest_web_contents); - WaitForLoadStart(guest_web_contents); - EXPECT_TRUE(content::WaitForLoadStop(guest_web_contents)); + auto* guest_view = GetGuestViewManager()->WaitForSingleGuestViewCreated(); + ASSERT_TRUE(guest_view); + WaitForGuestLoadStartThenStop(guest_view); // Ensure that the fenced frame's navigation should not abort the PDF stream. EXPECT_EQ(1U, GetGuestViewManager()->GetNumGuestsActive());
diff --git a/chrome/browser/pdf/pdf_extension_test_util.cc b/chrome/browser/pdf/pdf_extension_test_util.cc index ee66516..f55ed7e 100644 --- a/chrome/browser/pdf/pdf_extension_test_util.cc +++ b/chrome/browser/pdf/pdf_extension_test_util.cc
@@ -36,11 +36,11 @@ std::vector<content::RenderFrameHost*> GetPdfPluginFrames( content::WebContents* contents) { std::vector<content::RenderFrameHost*> plugin_frames; - contents->ForEachRenderFrameHost(base::BindLambdaForTesting( + contents->ForEachRenderFrameHost( [&plugin_frames](content::RenderFrameHost* frame) { if (IsPluginFrame(*frame)) plugin_frames.push_back(frame); - })); + }); return plugin_frames; } @@ -87,8 +87,8 @@ if (wait_for_hit_test_data) { frame.render_frame_host()->ForEachRenderFrameHost( - base::BindRepeating<void(content::RenderFrameHost*)>( - content::WaitForHitTestData)); + static_cast<void (*)(content::RenderFrameHost*)>( + &content::WaitForHitTestData)); } return load_success ? testing::AssertionSuccess()
diff --git a/chrome/browser/pdf/pdf_frame_util.cc b/chrome/browser/pdf/pdf_frame_util.cc index c3e9bbe0..f2cee25 100644 --- a/chrome/browser/pdf/pdf_frame_util.cc +++ b/chrome/browser/pdf/pdf_frame_util.cc
@@ -19,8 +19,8 @@ return nullptr; content::RenderFrameHost* pdf_rfh = nullptr; - rfh->ForEachRenderFrameHost(base::BindRepeating( - [](content::RenderFrameHost*& pdf_rfh, content::RenderFrameHost* rfh) { + rfh->ForEachRenderFrameHost( + [&pdf_rfh](content::RenderFrameHost* rfh) { if (!rfh->GetProcess()->IsPdf()) return; @@ -28,8 +28,7 @@ rfh->GetParent()->GetLastCommittedOrigin())); DCHECK(!pdf_rfh); pdf_rfh = rfh; - }, - std::ref(pdf_rfh))); + }); return pdf_rfh; }
diff --git a/chrome/browser/plugins/chrome_plugin_service_filter.cc b/chrome/browser/plugins/chrome_plugin_service_filter.cc index 1768c80f..47bc7cf 100644 --- a/chrome/browser/plugins/chrome_plugin_service_filter.cc +++ b/chrome/browser/plugins/chrome_plugin_service_filter.cc
@@ -98,23 +98,21 @@ // Authorize all plugins is intended for the granting access to only // the currently active page, so we iterate on the main frame. web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating([](content::RenderFrameHost* render_frame_host) { + [](content::RenderFrameHost* render_frame_host) { ChromePluginServiceFilter::GetInstance()->AuthorizePlugin( render_frame_host->GetProcess()->GetID(), base::FilePath()); - })); + }); if (load_blocked) { - web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating( - [](const std::string& identifier, - content::RenderFrameHost* render_frame_host) { + web_contents->GetPrimaryMainFrame() + ->ForEachRenderFrameHost( + [&identifier](content::RenderFrameHost* render_frame_host) { mojo::AssociatedRemote<chrome::mojom::ChromeRenderFrame> chrome_render_frame; render_frame_host->GetRemoteAssociatedInterfaces()->GetInterface( &chrome_render_frame); chrome_render_frame->LoadBlockedPlugins(identifier); - }, - identifier)); + }); } }
diff --git a/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc b/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc index 9407828..2d643457 100644 --- a/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc +++ b/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc
@@ -263,16 +263,13 @@ frame_count = 0; preview_dialog->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindLambdaForTesting( - [&frame_count](content::RenderFrameHost* /*frame*/) { - ++frame_count; - })); + [&frame_count](content::RenderFrameHost* /*frame*/) { ++frame_count; }); } while (frame_count < kExpectedFrameCount); ASSERT_EQ(kExpectedFrameCount, frame_count); // Make sure all the frames in the dialog has access to the PDF plugin. preview_dialog->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating(&CheckPdfPluginForRenderFrame)); + &CheckPdfPluginForRenderFrame); PrintPreviewDone(); }
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc index 8f4cb7f..b73982f2 100644 --- a/chrome/browser/printing/print_view_manager_base.cc +++ b/chrome/browser/printing/print_view_manager_base.cc
@@ -416,11 +416,10 @@ void PrintViewManagerBase::UpdatePrintingEnabled() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - // The Unretained() is safe because ForEachRenderFrameHost() is synchronous. web_contents()->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating(&PrintViewManagerBase::SendPrintingEnabled, - base::Unretained(this), - printing_enabled_.GetValue())); + [this](content::RenderFrameHost* rfh) { + SendPrintingEnabled(printing_enabled_.GetValue(), rfh); + }); } void PrintViewManagerBase::NavigationStopped() {
diff --git a/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc b/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc index 65f480e..18b4ead 100644 --- a/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc +++ b/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc
@@ -311,17 +311,11 @@ void LinkToTextMenuObserver::ReshareLink() { // Get the list of RenderFrameHosts from the current page. proxy_->GetWebContents()->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating( - [](std::vector<content::GlobalRenderFrameHostId>* - render_frame_host_ids, - std::vector<mojo::Remote<blink::mojom::TextFragmentReceiver>>* - text_fragment_remotes, - content::RenderFrameHost* rfh) { - render_frame_host_ids->push_back(rfh->GetGlobalId()); - mojo::Remote<blink::mojom::TextFragmentReceiver> remote; - text_fragment_remotes->push_back(std::move(remote)); - }, - &render_frame_host_ids_, &text_fragment_remotes_)); + [this](content::RenderFrameHost* rfh) { + render_frame_host_ids_.push_back(rfh->GetGlobalId()); + mojo::Remote<blink::mojom::TextFragmentReceiver> remote; + text_fragment_remotes_.push_back(std::move(remote)); + }); get_frames_existing_selectors_counter_ = render_frame_host_ids_.size(); @@ -381,7 +375,7 @@ void LinkToTextMenuObserver::RemoveHighlights() { // Remove highlights from all frames in the primary page. proxy_->GetWebContents()->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating(RemoveHighlightsInFrame)); + &RemoveHighlightsInFrame); execute_command_pending_ = false; NotifyLinkToTextMenuCompleted();
diff --git a/chrome/browser/resources/chromeos/accessibility/accessibility_common/BUILD.gn b/chrome/browser/resources/chromeos/accessibility/accessibility_common/BUILD.gn index af4420b..2bfe77df 100644 --- a/chrome/browser/resources/chromeos/accessibility/accessibility_common/BUILD.gn +++ b/chrome/browser/resources/chromeos/accessibility/accessibility_common/BUILD.gn
@@ -312,6 +312,7 @@ js_library("dictation_editing_util") { sources = [ "dictation/editing_util.js" ] + deps = [ ":dictation_locale_info" ] } js_library("dictation_locale_info") {
diff --git a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util.js b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util.js index 3138c64..d1df8252 100644 --- a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util.js +++ b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util.js
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {LocaleInfo} from './locale_info.js'; + /** * EditingUtil provides utility and helper methods for editing-related * operations. @@ -29,10 +31,15 @@ deletePhrase = deletePhrase.trim(); insertPhrase = insertPhrase.trim(); - // Find the right-most occurrence of `deletePhrase`. Require `deletePhrase` - // to be separated by word boundaries. If we're deleting text, prefer - // the RegExps that include a leading/trailing space to preserve spacing. - const re = EditingUtil.getPhraseRegex_(deletePhrase); + // Find the right-most occurrence of `deletePhrase`. If we're deleting text, + // prefer the RegExps that include a leading/trailing space to preserve + // spacing. + let re; + if (LocaleInfo.considerSpaces()) { + re = EditingUtil.getPhraseRegex_(deletePhrase); + } else { + re = EditingUtil.getPhraseRegexNoWordBoundaries_(deletePhrase); + } const reWithLeadingSpace = EditingUtil.getPhraseRegexLeadingSpace_(deletePhrase); const reWithTrailingSpace = @@ -279,6 +286,7 @@ } /** + * TODO(akihiroota): Break regex construction into smaller chunks. * Returns a RegExp that matches on the right-most occurrence of a phrase. * The returned RegExp is case insensitive and requires that `phrase` is * separated by word boundaries. @@ -291,6 +299,17 @@ } /** + * Similar to above, but doesn't include word boundaries. This is useful for + * languages that don't use spaces e.g. Japanese. + * @param {string} phrase + * @return {!RegExp} + * @private + */ + static getPhraseRegexNoWordBoundaries_(phrase) { + return new RegExp(`(${phrase})(?!.*\\1)`, 'i'); + } + + /** * Similar to above, but accounts for a leading space. * @param {string} phrase * @return {!RegExp}
diff --git a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util_test.js b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util_test.js index 4832de03..3641331 100644 --- a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util_test.js +++ b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util_test.js
@@ -19,6 +19,7 @@ let caretIndex; let deletePhrase; let insertPhrase; + let result; const f = () => EditingUtil.replacePhrase(value, caretIndex, deletePhrase, insertPhrase); @@ -27,24 +28,27 @@ caretIndex = value.length; deletePhrase = 'difficult'; insertPhrase = ''; - assertEquals('This is a test', f().value); - assertEquals(9, f().caretIndex); + result = f(); + assertEquals('This is a test', result.value); + assertEquals(9, result.caretIndex); // Case-insensitive delete. value = 'This is a DIFFICULT test'; caretIndex = value.length; deletePhrase = 'difficult'; insertPhrase = ''; - assertEquals('This is a test', f().value); - assertEquals(9, f().caretIndex); + result = f(); + assertEquals('This is a test', result.value); + assertEquals(9, result.caretIndex); // Delete when there are multiple instances of `deletePhrase`. value = 'The cow jumped over the moon'; caretIndex = value.length; deletePhrase = 'the'; insertPhrase = ''; - assertEquals('The cow jumped over moon', f().value); - assertEquals(19, f().caretIndex); + result = f(); + assertEquals('The cow jumped over moon', result.value); + assertEquals(19, result.caretIndex); // Delete only content to the left of the caret. // "The cow| jumped over the moon" @@ -52,40 +56,45 @@ caretIndex = 7; deletePhrase = 'the'; insertPhrase = ''; - assertEquals('cow jumped over the moon', f().value); - assertEquals(0, f().caretIndex); + result = f(); + assertEquals('cow jumped over the moon', result.value); + assertEquals(0, result.caretIndex); // Delete last word. value = 'The cow jumped over the moon.'; caretIndex = value.length; deletePhrase = 'moon'; insertPhrase = ''; - assertEquals('The cow jumped over the.', f().value); - assertEquals(23, f().caretIndex); + result = f(); + assertEquals('The cow jumped over the.', result.value); + assertEquals(23, result.caretIndex); // Delete only at word boundaries. value = 'A square is also a rectangle'; caretIndex = value.length; deletePhrase = 'a'; insertPhrase = ''; - assertEquals('A square is also rectangle', f().value); - assertEquals(16, f().caretIndex); + result = f(); + assertEquals('A square is also rectangle', result.value); + assertEquals(16, result.caretIndex); // Nothing is deleted if we can't find `deletePhrase`. value = 'This is a test'; caretIndex = value.length; deletePhrase = 'coconut'; insertPhrase = ''; - assertEquals('This is a test', f().value); - assertEquals(caretIndex, f().caretIndex); + result = f(); + assertEquals('This is a test', result.value); + assertEquals(caretIndex, result.caretIndex); // Nothing is deleted if the caret is at index 0. value = 'This is a test'; caretIndex = 0; deletePhrase = 'test'; insertPhrase = ''; - assertEquals('This is a test', f().value); - assertEquals(caretIndex, f().caretIndex); + result = f(); + assertEquals('This is a test', result.value); + assertEquals(caretIndex, result.caretIndex); // Nothing is deleted if the caret is in the middle of the matched phrase. // "A squ|are is also a rectangle". @@ -93,48 +102,63 @@ caretIndex = 5; deletePhrase = 'square'; insertPhrase = ''; - assertEquals('A square is also a rectangle', f().value); - assertEquals(caretIndex, f().caretIndex); + result = f(); + assertEquals('A square is also a rectangle', result.value); + assertEquals(caretIndex, result.caretIndex); + + // Verify that we don't unexpectedly remove punctuation. + value = 'Hello world.'; + caretIndex = value.length; + deletePhrase = 'world'; + insertPhrase = ''; + result = f(); + assertEquals('Hello.', result.value); + assertEquals(5, result.caretIndex); // Nothing is deleted if `deletePhrase` includes punctuation. value = 'Hello world.'; caretIndex = value.length; deletePhrase = 'world.'; insertPhrase = ''; - assertEquals('Hello world.', f().value); - assertEquals(caretIndex, f().caretIndex); + result = f(); + assertEquals('Hello world.', result.value); + assertEquals(caretIndex, result.caretIndex); // Simple replacement. value = 'This is a difficult test'; caretIndex = value.length; deletePhrase = 'difficult'; insertPhrase = 'simple'; - assertEquals('This is a simple test', f().value); - assertEquals(16, f().caretIndex); + result = f(); + assertEquals('This is a simple test', result.value); + assertEquals(16, result.caretIndex); // Replace multiple words. value = 'The cow jumped over the moon'; caretIndex = value.length; deletePhrase = 'jumped over the moon'; insertPhrase = 'went to bed early'; - assertEquals('The cow went to bed early', f().value); - assertEquals(25, f().caretIndex); + result = f(); + assertEquals('The cow went to bed early', result.value); + assertEquals(25, result.caretIndex); // Edge case: value is empty. value = ''; caretIndex = 0; deletePhrase = 'coconut'; insertPhrase = ''; - assertEquals('', f().value); - assertEquals(caretIndex, f().caretIndex); + result = f(); + assertEquals('', result.value); + assertEquals(caretIndex, result.caretIndex); // Edge case: caretIndex is negative. value = 'This is a test'; caretIndex = -1; deletePhrase = 'test'; insertPhrase = ''; - assertEquals('This is a test', f().value); - assertEquals(caretIndex, f().caretIndex); + result = f(); + assertEquals('This is a test', result.value); + assertEquals(caretIndex, result.caretIndex); // Edge case: caretIndex is larger than `value.length`. We treat this as // if the text caret is at the end of value. @@ -142,8 +166,9 @@ caretIndex = 5000; deletePhrase = 'Hello'; insertPhrase = ''; - assertEquals('', f().value); - assertEquals(0, f().caretIndex); + result = f(); + assertEquals('', result.value); + assertEquals(0, result.caretIndex); }); AX_TEST_F('DictationEditingUtilTest', 'InsertBefore', function() { @@ -151,6 +176,7 @@ let caretIndex; let insertPhrase; let beforePhrase; + let result; const f = () => EditingUtil.insertBefore(value, caretIndex, insertPhrase, beforePhrase); @@ -159,24 +185,27 @@ caretIndex = value.length; insertPhrase = 'simple'; beforePhrase = 'test'; - assertEquals('This is a simple test.', f().value); - assertEquals(16, f().caretIndex); + result = f(); + assertEquals('This is a simple test.', result.value); + assertEquals(16, result.caretIndex); // Insert and match multiple words. value = 'This is a test'; caretIndex = value.length; insertPhrase = 'This is a drill'; beforePhrase = 'This is a test'; - assertEquals('This is a drill This is a test', f().value); - assertEquals(insertPhrase.length, f().caretIndex); + result = f(); + assertEquals('This is a drill This is a test', result.value); + assertEquals(insertPhrase.length, result.caretIndex); // Nothing is inserted if `beforePhrase` isn't present. value = 'This is a test'; caretIndex = value.length; insertPhrase = 'pineapple'; beforePhrase = 'coconut'; - assertEquals('This is a test', f().value); - assertEquals(caretIndex, f().caretIndex); + result = f(); + assertEquals('This is a test', result.value); + assertEquals(caretIndex, result.caretIndex); }); AX_TEST_F('DictationEditingUtilTest', 'SelectBetween', function() {
diff --git a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/locale_info.js b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/locale_info.js index ba925759..8fbe8c8 100644 --- a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/locale_info.js +++ b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/locale_info.js
@@ -48,6 +48,15 @@ (LocaleInfo.getUILanguage() === systemLanguage || LocaleInfo.getUILanguage() === systemLocale); } + + /** + * Returns true if we should consider spaces, false otherwise. + * @return {boolean} + */ + static considerSpaces() { + const language = LocaleInfo.locale.toLowerCase().split('-')[0]; + return !LocaleInfo.NO_SPACE_LANGUAGES_.has(language); + } } /** @@ -87,3 +96,12 @@ 'yue-hant-hk': 'zh-tw', 'no-no': 'nb', }; + +/** + * TODO(akihiroota): Follow-up with an i18n expert to get a full list of + * languages. + * All languages that don't use spaces. + * @private {!Set<string>} + * @const + */ +LocaleInfo.NO_SPACE_LANGUAGES_ = new Set(['ja', 'zh']);
diff --git a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/parse/simple_parse_strategy.js b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/parse/simple_parse_strategy.js index 8515fd84..56b9fce 100644 --- a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/parse/simple_parse_strategy.js +++ b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/parse/simple_parse_strategy.js
@@ -81,7 +81,13 @@ const message = chrome.i18n.getMessage( SimpleMacroFactory.getData_()[macroName].messageId, args); const pattern = `^${message}$`; - this.commandRegex_ = new RegExp(pattern, 'i'); + if (LocaleInfo.considerSpaces()) { + this.commandRegex_ = new RegExp(pattern, 'i'); + } else { + // A regex to be used if the Dictation language doesn't use spaces e.g. + // Japanese. + this.commandRegex_ = new RegExp(pattern.replace(/\s+/g, ''), 'i'); + } } /**
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js index 1e123ef9..a2784ea 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js
@@ -1303,8 +1303,10 @@ // Note: this test needs the test server running because the browser // does not follow same-page links on data urls (because it modifies the // url fragment, and any change to the url is disallowed for a data url). +// crbug.com/1356181 Disable due to flaky. AX_TEST_F( - 'ChromeVoxBackgroundTestWithTestServer', 'InPageLinks', async function() { + 'ChromeVoxBackgroundTestWithTestServer', + 'DISABLED_InPageLinks', async function() { const mockFeedback = this.createMockFeedback(); const root = await this.runWithLoadedTree(undefined, { url: `${ @@ -1788,7 +1790,9 @@ await mockFeedback.replay(); }); -AX_TEST_F('ChromeVoxBackgroundTest', 'GestureGranularity', async function() { +// crbug.com/1356181 Disable due to flaky. +AX_TEST_F('ChromeVoxBackgroundTest', + 'DISABLED_aGestureGranularity', async function() { const mockFeedback = this.createMockFeedback(); const site = ` <p>This is a test</p> @@ -3086,8 +3090,9 @@ }); // TODO(crbug.com/1228418) - Improve the generation of summaries across ChromeOS +// crbug.com/1356181 Disable due to flaky. AX_TEST_F( - 'ChromeVoxBackgroundTest', 'AlertDialogAutoSummaryTextContent', + 'ChromeVoxBackgroundTest', 'DISABLED_AlertDialogAutoSummaryTextContent', async function() { this.resetContextualOutput(); const mockFeedback = this.createMockFeedback(); @@ -3997,8 +4002,10 @@ }); // Make sure navigation with touch to ListBox lands on options. +// crbug.com/1356181 Disable due to flaky. AX_TEST_F( - 'ChromeVoxBackgroundTest', 'TouchListBoxItemsNavigation', async function() { + 'ChromeVoxBackgroundTest', + 'DISABLED_TouchListBoxItemsNavigation', async function() { const mockFeedback = this.createMockFeedback(); await this.runWithLoadedTree(this.listBoxDoc); mockFeedback
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing_test.js index 8e56078..a466762 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing_test.js
@@ -1988,7 +1988,8 @@ await mockFeedback.replay(); }); -AX_TEST_F('ChromeVoxEditingTest', 'TableNavigation', async function() { +// crbug.com/1356181 Disable due to flaky. +AX_TEST_F('ChromeVoxEditingTest', 'DISABLED_TableNavigation', async function() { const mockFeedback = this.createMockFeedback(); const site = ` <div contenteditable role="textbox" tabindex=0>
diff --git a/chrome/browser/resources/chromeos/accessibility/switch_access/point_scan_manager_test.js b/chrome/browser/resources/chromeos/accessibility/switch_access/point_scan_manager_test.js index c4df1466..09c27fb9 100644 --- a/chrome/browser/resources/chromeos/accessibility/switch_access/point_scan_manager_test.js +++ b/chrome/browser/resources/chromeos/accessibility/switch_access/point_scan_manager_test.js
@@ -51,8 +51,9 @@ await new Promise(verifyChecked(false)); }); +// TODO(crbug.com/1284450): Flaky. AX_TEST_F( - 'SwitchAccessPointScanManagerTest', 'PointScanRightClick', + 'SwitchAccessPointScanManagerTest', 'DISABLED_PointScanRightClick', async function() { const website = '<p>Kittens r cute</p>'; const rootWebArea = await this.runWithLoadedTree(website);
diff --git a/chrome/browser/resources/chromeos/emoji_picker/BUILD.gn b/chrome/browser/resources/chromeos/emoji_picker/BUILD.gn index 9bdbe95..1d14181 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/BUILD.gn +++ b/chrome/browser/resources/chromeos/emoji_picker/BUILD.gn
@@ -224,7 +224,6 @@ deps = [ ":icons", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button", ] } @@ -233,7 +232,6 @@ ":events", ":icons", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button", ] }
diff --git a/chrome/browser/resources/chromeos/login/BUILD.gn b/chrome/browser/resources/chromeos/login/BUILD.gn index 9836ede..d9a1602 100644 --- a/chrome/browser/resources/chromeos/login/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/BUILD.gn
@@ -261,7 +261,6 @@ "screens/common/offline_ad_login.m.js", "screens/common/os_trial.m.js", "screens/common/oobe_eula.m.js", - "screens/common/oobe_reset.m.js", "screens/common/os_install.m.js", "screens/common/parental_handoff.m.js", "screens/common/pin_setup.m.js", @@ -306,6 +305,7 @@ out_manifest = "$target_gen_dir/$web_components_manifest" in_files = [ + "screens/common/oobe_reset.js", "screens/common/adb_sideloading.js", "screens/common/arc_terms_of_service.js", "screens/login/encryption_migration.js",
diff --git a/chrome/browser/resources/chromeos/login/components/BUILD.gn b/chrome/browser/resources/chromeos/login/components/BUILD.gn index 25fd7d7..cb03c2c 100644 --- a/chrome/browser/resources/chromeos/login/components/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/components/BUILD.gn
@@ -377,7 +377,7 @@ js_file = "oobe_cr_lottie.js" html_file = "oobe_cr_lottie.html" html_type = "dom-module" - auto_imports = oobe_auto_imports + auto_imports = oobe_auto_imports + [ "ui/webui/resources/cr_elements/cr_lottie/cr_lottie.html|CrLottieElement" ] migrated_imports = oobe_migrated_imports namespace_rewrites = oobe_namespace_rewrites }
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_cr_lottie.js b/chrome/browser/resources/chromeos/login/components/oobe_cr_lottie.js index 3be07c3..5dc6383 100644 --- a/chrome/browser/resources/chromeos/login/components/oobe_cr_lottie.js +++ b/chrome/browser/resources/chromeos/login/components/oobe_cr_lottie.js
@@ -23,7 +23,7 @@ */ OobeCrLottieBase.$; -class OobeCrLottie extends OobeCrLottieBase { +/* #export */ class OobeCrLottie extends OobeCrLottieBase { static get is() { return 'oobe-cr-lottie'; }
diff --git a/chrome/browser/resources/chromeos/login/screens.js b/chrome/browser/resources/chromeos/login/screens.js index 588c2a2..efa87b1 100644 --- a/chrome/browser/resources/chromeos/login/screens.js +++ b/chrome/browser/resources/chromeos/login/screens.js
@@ -27,7 +27,7 @@ import './screens/common/multidevice_setup.m.js'; import './screens/common/offline_ad_login.m.js'; import './screens/common/oobe_eula.m.js'; -import './screens/common/oobe_reset.m.js'; +import './screens/common/oobe_reset.js'; import './screens/common/os_install.m.js'; import './screens/common/os_trial.m.js'; import './screens/common/parental_handoff.m.js';
diff --git a/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn b/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn index 8bcade7..5f6259e5 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn
@@ -32,7 +32,6 @@ ":multidevice_setup_module", ":offline_ad_login_module", ":oobe_eula_module", - ":oobe_reset_module", ":os_install_module", ":os_trial_module", ":parental_handoff_module", @@ -81,7 +80,7 @@ ":marketing_opt_in.m", ":offline_ad_login.m", ":oobe_eula.m", - ":oobe_reset.m", + ":oobe_reset", ":os_install.m", ":os_trial.m", ":parental_handoff.m", @@ -432,8 +431,8 @@ extra_deps = [ ":oobe_eula_module" ] } -js_library("oobe_reset.m") { - sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/screens/common/oobe_reset.m.js" ] +js_library("oobe_reset") { + sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/screens/common/oobe_reset.js" ] deps = [ "../../components/behaviors:login_screen_behavior.m", "../../components/behaviors:oobe_dialog_host_behavior.m", @@ -444,7 +443,7 @@ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/js:util.m", ] - extra_deps = [ ":oobe_reset_module" ] + extra_deps = [ ":web_components" ] } js_library("os_install.m") { @@ -736,7 +735,7 @@ js_file = "fingerprint_setup.js" html_file = "fingerprint_setup.html" html_type = "dom-module" - auto_imports = oobe_auto_imports + auto_imports = oobe_auto_imports + [ "chrome/browser/resources/chromeos/login/components/oobe_cr_lottie.html|OobeCrLottie" ] migrated_imports = oobe_migrated_imports namespace_rewrites = oobe_namespace_rewrites } @@ -819,15 +818,6 @@ migrated_imports = oobe_migrated_imports } -polymer_modulizer("oobe_reset") { - js_file = "oobe_reset.js" - html_file = "oobe_reset.html" - html_type = "dom-module" - auto_imports = oobe_auto_imports - namespace_rewrites = oobe_namespace_rewrites - migrated_imports = oobe_migrated_imports -} - polymer_modulizer("os_install") { js_file = "os_install.js" html_file = "os_install.html" @@ -949,5 +939,6 @@ js_files = [ "adb_sideloading.js", "arc_terms_of_service.js", + "oobe_reset.js", ] }
diff --git a/chrome/browser/resources/chromeos/login/screens/common/fingerprint_setup.js b/chrome/browser/resources/chromeos/login/screens/common/fingerprint_setup.js index bff6685..df9f134e 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/fingerprint_setup.js +++ b/chrome/browser/resources/chromeos/login/screens/common/fingerprint_setup.js
@@ -194,7 +194,7 @@ * @param {boolean} playing True if animation should be playing. */ setAnimationState_(playing) { - const lottieElement = /** @type{CrLottieElement} */ ( + const lottieElement = /** @type{OobeCrLottie} */ ( this.$.setupFingerprint.querySelector('#scannerLocationLottie')); lottieElement.playing = playing; this.$.arc.setPlay(playing);
diff --git a/chrome/browser/resources/chromeos/login/screens/common/oobe_reset.html b/chrome/browser/resources/chromeos/login/screens/common/oobe_reset.html index 326eee8f..1eafba1 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/oobe_reset.html +++ b/chrome/browser/resources/chromeos/login/screens/common/oobe_reset.html
@@ -2,144 +2,123 @@ Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> -<link rel="import" href="chrome://resources/html/polymer.html"> -<link rel="import" href="chrome://resources/cr_elements/cr_checkbox/cr_checkbox.html"> -<link rel="import" href="chrome://resources/html/action_link.html"> -<link rel="import" href="chrome://resources/html/util.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> +<style include="oobe-dialog-host-styles"> + #reset-revert-spinner { + padding-inline-end: 5px; + } -<link rel="import" href="../../components/oobe_icons.html"> -<link rel="import" href="../../components/behaviors/login_screen_behavior.html"> -<link rel="import" href="../../components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="../../components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="../../components/buttons/oobe_text_button.html"> -<link rel="import" href="../../components/common_styles/common_styles.html"> -<link rel="import" href="../../components/common_styles/oobe_dialog_host_styles.html"> -<link rel="import" href="../../components/dialogs/oobe_adaptive_dialog.html"> -<link rel="import" href="../../components/dialogs/oobe_modal_dialog.html"> + #tpmFirmwareUpdate { + margin-top: 20px; + } -<dom-module id="oobe-reset-element"> - <template> - <style include="oobe-dialog-host-styles"> - #reset-revert-spinner { - padding-inline-end: 5px; - } + .illustration { + max-height: 80%; + max-width: 100%; + object-fit: contain; + } - #tpmFirmwareUpdate { - margin-top: 20px; - } - - .illustration { - max-height: 80%; - max-width: 100%; - object-fit: contain; - } - - #tpmFirmwareUpdateContainer { - cursor: default; - line-height: 20px; - pointer-events: auto; - } - </style> - <link rel="stylesheet" href="chrome://resources/css/throbber.css"> - <oobe-adaptive-dialog id="resetDialog" role="dialog" - aria-label$="[[i18nDynamic(locale, 'resetScreenAccessibleTitle')]]" - footer-shrinkable> - <iron-icon slot="icon" icon="oobe-32:alert"></iron-icon> - <h1 slot="title"> - [[i18nDynamic(locale, 'resetWarningTitle')]] - </h1> - <div slot="subtitle" class="powerwash-warning"> - <!-- Subtitle: Restart required --> - <span hidden="[[!inRestartRequiredState_]]"> - [[i18nDynamic(locale, 'resetRestartMessage')]] - </span> - <!-- Subtitle: Powerwash state (depends on powerwash mode) --> - <span hidden="[[!inPowerwashState_]]"> - <span>[[powerwashStateSubtitle_]]</span> + #tpmFirmwareUpdateContainer { + cursor: default; + line-height: 20px; + pointer-events: auto; + } +</style> +<link rel="stylesheet" href="chrome://resources/css/throbber.css"> +<oobe-adaptive-dialog id="resetDialog" role="dialog" + aria-label$="[[i18nDynamic(locale, 'resetScreenAccessibleTitle')]]" + footer-shrinkable> + <iron-icon slot="icon" icon="oobe-32:alert"></iron-icon> + <h1 slot="title"> + [[i18nDynamic(locale, 'resetWarningTitle')]] + </h1> + <div slot="subtitle" class="powerwash-warning"> + <!-- Subtitle: Restart required --> + <span hidden="[[!inRestartRequiredState_]]"> + [[i18nDynamic(locale, 'resetRestartMessage')]] + </span> + <!-- Subtitle: Powerwash state (depends on powerwash mode) --> + <span hidden="[[!inPowerwashState_]]"> + <span>[[powerwashStateSubtitle_]]</span> + <span> + [[i18nDynamic(locale, 'resetWarningDataDetails')]] + </span> + </span> + <!-- Help Link - Hidden when reverting/rolling back. --> + <if expr="_google_chrome"> + <a id="powerwash-help-link-md" class="oobe-local-link" + hidden="[[inRevertState_]]" is="action-link" + on-click="onLearnMoreTap_"> + [[i18nDynamic(locale, 'learnMore')]] + </a> + </if> + <!-- Spinner - Shown when the revert process is ongoing --> + <div hidden="[[!inRevertState_]]"> + <div> + [[i18nDynamic(locale, 'resetRevertPromise')]] + </div> + <div class="flex horizontal layout"> + <div id="reset-revert-spinner" class="throbber"></div> + <div> + [[i18nDynamic(locale, 'resetRevertSpinnerMessage')]] + </div> + </div> + </div> + </div> + <div slot="content" class="flex layout vertical center center-justified"> + <!-- Reset screen illustration --> + <img src="images/powerwash.svg" + class="oobe-illustration" aria-hidden="true"> + <!-- TPM Update - Only shown during powerwash state --> + <div id="tpmFirmwareUpdate" class="layout horizontal" + hidden="[[!inPowerwashState_]]"> + <cr-checkbox id="tpmFirmwareUpdateCheckbox" + checked="{{tpmUpdateChecked_}}" + disabled="[[!tpmUpdateEditable_]]" + hidden="[[!tpmUpdateAvailable_]]" + on-change="onTPMFirmwareUpdateChanged_"> + <div id="tpmFirmwareUpdateContainer"> <span> - [[i18nDynamic(locale, 'resetWarningDataDetails')]] + [[i18nDynamic(locale, 'resetTPMFirmwareUpdate')]] </span> - </span> - <!-- Help Link - Hidden when reverting/rolling back. --> - <if expr="_google_chrome"> - <a id="powerwash-help-link-md" class="oobe-local-link" - hidden="[[inRevertState_]]" is="action-link" - on-click="onLearnMoreTap_"> - [[i18nDynamic(locale, 'learnMore')]] - </a> - </if> - <!-- Spinner - Shown when the revert process is ongoing --> - <div hidden="[[!inRevertState_]]"> - <div> - [[i18nDynamic(locale, 'resetRevertPromise')]] - </div> - <div class="flex horizontal layout"> - <div id="reset-revert-spinner" class="throbber"></div> - <div> - [[i18nDynamic(locale, 'resetRevertSpinnerMessage')]] - </div> - </div> + <if expr="_google_chrome"> + <a class="oobe-local-link" is="action-link" + on-click="onTPMFirmwareUpdateLearnMore_"> + [[i18nDynamic(locale, 'learnMore')]] + </a> + </if> </div> - </div> - <div slot="content" class="flex layout vertical center center-justified"> - <!-- Reset screen illustration --> - <img src="images/powerwash.svg" - class="oobe-illustration" aria-hidden="true"> - <!-- TPM Update - Only shown during powerwash state --> - <div id="tpmFirmwareUpdate" class="layout horizontal" - hidden="[[!inPowerwashState_]]"> - <cr-checkbox id="tpmFirmwareUpdateCheckbox" - checked="{{tpmUpdateChecked_}}" - disabled="[[!tpmUpdateEditable_]]" - hidden="[[!tpmUpdateAvailable_]]" - on-change="onTPMFirmwareUpdateChanged_"> - <div id="tpmFirmwareUpdateContainer"> - <span> - [[i18nDynamic(locale, 'resetTPMFirmwareUpdate')]] - </span> - <if expr="_google_chrome"> - <a class="oobe-local-link" is="action-link" - on-click="onTPMFirmwareUpdateLearnMore_"> - [[i18nDynamic(locale, 'learnMore')]] - </a> - </if> - </div> - </cr-checkbox> - </div> - </div> - <div slot="bottom-buttons"> - <!-- Cancel button, only disabled when reverting --> - <oobe-text-button border on-click="onCancelTap_" text-key="cancelButton" - id="resetCancel" disabled="[[inRevertState_]]"></oobe-text-button> - <!-- Restart button --> - <oobe-text-button inverse on-click="onRestartTap_" class="focus-on-show" - id="restart" text-key="resetButtonRestart" - hidden="[[!inRestartRequiredState_]]"> - </oobe-text-button> - <!-- Powerwash button (depends on powerwash mode) --> - <oobe-text-button inverse on-click="onPowerwashTap_" - class="focus-on-show" id="powerwash" - hidden="[[!inPowerwashState_]]" - text-key="[[powerwashButtonTextKey_]]" - disabled="[[powerwashButtonDisabled_]]"> - </oobe-text-button> - </div> - </oobe-adaptive-dialog> + </cr-checkbox> + </div> + </div> + <div slot="bottom-buttons"> + <!-- Cancel button, only disabled when reverting --> + <oobe-text-button border on-click="onCancelTap_" text-key="cancelButton" + id="resetCancel" disabled="[[inRevertState_]]"></oobe-text-button> + <!-- Restart button --> + <oobe-text-button inverse on-click="onRestartTap_" class="focus-on-show" + id="restart" text-key="resetButtonRestart" + hidden="[[!inRestartRequiredState_]]"> + </oobe-text-button> + <!-- Powerwash button (depends on powerwash mode) --> + <oobe-text-button inverse on-click="onPowerwashTap_" + class="focus-on-show" id="powerwash" + hidden="[[!inPowerwashState_]]" + text-key="[[powerwashButtonTextKey_]]" + disabled="[[powerwashButtonDisabled_]]"> + </oobe-text-button> + </div> +</oobe-adaptive-dialog> - <!-- Powerwash confirmation dialog (depends on powerwash mode) --> - <oobe-modal-dialog id="confirmationDialog" on-close="onDialogClosed_"> - <div slot="title">[[confirmationDialogTitle_]]</div> - <div slot="content">[[confirmationDialogText_]]</div> - <div slot="buttons"> - <oobe-text-button id="cancelButton" border on-click="onDialogCancelTap_" - text-key="cancel"></oobe-text-button> - <oobe-text-button inverse on-click="onDialogContinueTap_" - id="confirmPowerwash" - text-key="confirmResetButton"></oobe-text-button> - </div> - </oobe-modal-dialog> - </template> - <script src="oobe_reset.js"></script> -</dom-module> +<!-- Powerwash confirmation dialog (depends on powerwash mode) --> +<oobe-modal-dialog id="confirmationDialog" on-close="onDialogClosed_"> + <div slot="title">[[confirmationDialogTitle_]]</div> + <div slot="content">[[confirmationDialogText_]]</div> + <div slot="buttons"> + <oobe-text-button id="cancelButton" border on-click="onDialogCancelTap_" + text-key="cancel"></oobe-text-button> + <oobe-text-button inverse on-click="onDialogContinueTap_" + id="confirmPowerwash" + text-key="confirmResetButton"></oobe-text-button> + </div> +</oobe-modal-dialog>
diff --git a/chrome/browser/resources/chromeos/login/screens/common/oobe_reset.js b/chrome/browser/resources/chromeos/login/screens/common/oobe_reset.js index ff09ad9b..6d436e7 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/oobe_reset.js +++ b/chrome/browser/resources/chromeos/login/screens/common/oobe_reset.js
@@ -6,7 +6,23 @@ * @fileoverview Polymer element for displaying material design reset screen. */ -/* #js_imports_placeholder */ +import '//resources/cr_elements/cr_checkbox/cr_checkbox.js'; +import '//resources/js/action_link.js'; +import '//resources/polymer/v3_0/iron-icon/iron-icon.js'; +import '../../components/oobe_icons.m.js'; +import '../../components/common_styles/common_styles.m.js'; +import '../../components/common_styles/oobe_dialog_host_styles.m.js'; +import '../../components/dialogs/oobe_adaptive_dialog.m.js'; +import '../../components/dialogs/oobe_modal_dialog.m.js'; + +import {announceAccessibleMessage, ensureTransitionEndEvent} from '//resources/js/util.m.js'; +import {afterNextRender, dom, flush, html, mixinBehaviors, Polymer, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {LoginScreenBehavior, LoginScreenBehaviorInterface} from '../../components/behaviors/login_screen_behavior.m.js'; +import {OobeDialogHostBehavior} from '../../components/behaviors/oobe_dialog_host_behavior.m.js'; +import {OobeI18nBehavior, OobeI18nBehaviorInterface} from '../../components/behaviors/oobe_i18n_behavior.m.js'; +import {OobeTextButton} from '../../components/buttons/oobe_text_button.m.js'; + /** @enum {number} */ const RESET_SCREEN_STATE = { @@ -52,9 +68,9 @@ * @implements {LoginScreenBehaviorInterface} * @implements {OobeI18nBehaviorInterface} */ -const ResetScreenElementBase = Polymer.mixinBehaviors( +const ResetScreenElementBase = mixinBehaviors( [OobeI18nBehavior, OobeDialogHostBehavior, LoginScreenBehavior], - Polymer.Element); + PolymerElement); /** * @typedef {{ @@ -73,7 +89,9 @@ return 'oobe-reset-element'; } - /* #html_template_placeholder */ + static get template() { + return html`{__html_template__}`; + } static get properties() { return {
diff --git a/chrome/browser/resources/chromeos/login/screens/oobe/BUILD.gn b/chrome/browser/resources/chromeos/login/screens/oobe/BUILD.gn index a18f4f6..1df5b70 100644 --- a/chrome/browser/resources/chromeos/login/screens/oobe/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/screens/oobe/BUILD.gn
@@ -213,6 +213,7 @@ sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/screens/oobe/welcome_dialog.m.js" ] deps = [ "../../components:long_touch_detector.m", + "../../components:oobe_cr_lottie.m", "../../components/behaviors:oobe_i18n_behavior.m", "../../components/buttons:oobe_icon_button.m", "../../components/buttons:oobe_text_button.m", @@ -312,7 +313,7 @@ js_file = "welcome_dialog.js" html_file = "welcome_dialog.html" html_type = "dom-module" - auto_imports = oobe_auto_imports + auto_imports = oobe_auto_imports + [ "chrome/browser/resources/chromeos/login/components/oobe_cr_lottie.html|OobeCrLottie" ] migrated_imports = oobe_migrated_imports namespace_rewrites = oobe_namespace_rewrites }
diff --git a/chrome/browser/resources/chromeos/login/screens/oobe/welcome_dialog.js b/chrome/browser/resources/chromeos/login/screens/oobe/welcome_dialog.js index c56f200..1c73810 100644 --- a/chrome/browser/resources/chromeos/login/screens/oobe/welcome_dialog.js +++ b/chrome/browser/resources/chromeos/login/screens/oobe/welcome_dialog.js
@@ -18,7 +18,7 @@ * @typedef {{ * title: HTMLAnchorElement, * chromeVoxHint: OobeModalDialogElement, - * welcomeAnimation: CrLottieElement, + * welcomeAnimation: OobeCrLottie, * }} */ OobeWelcomeDialogBase.$;
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/crostini_page/BUILD.gn index f4c7f0e..160e7dd 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/crostini_page/BUILD.gn
@@ -141,7 +141,6 @@ "../guest_os:guest_os_shared_paths", "../guest_os:guest_os_shared_usb_devices", "//ui/webui/resources/cr_elements/cr_button:cr_button", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button", "//ui/webui/resources/cr_elements/policy:cr_policy_indicator", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", @@ -157,7 +156,6 @@ "../guest_os:guest_os_browser_proxy", "../guest_os:guest_os_container_select", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", @@ -193,7 +191,6 @@ "..:prefs_behavior", "../guest_os:guest_os_browser_proxy", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js:web_ui_listener_behavior.m",
diff --git a/chrome/browser/resources/settings/chromeos/guest_os/BUILD.gn b/chrome/browser/resources/settings/chromeos/guest_os/BUILD.gn index 2d7d2a6..caabdde1 100644 --- a/chrome/browser/resources/settings/chromeos/guest_os/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/guest_os/BUILD.gn
@@ -64,7 +64,6 @@ ":guest_os_browser_proxy", "..:metrics_recorder", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button", "//ui/webui/resources/js:i18n_behavior.m", ] }
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn index 876d15c..260e6628 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn
@@ -71,7 +71,6 @@ "//ui/webui/resources/cr_components/chromeos/cellular_setup:esim_manager_listener_behavior.m", "//ui/webui/resources/cr_components/chromeos/network:mojo_interface_provider.m", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo.m", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", ] @@ -139,7 +138,6 @@ "//ui/webui/resources/cr_components/chromeos/network:mojo_interface_provider.m", "//ui/webui/resources/cr_components/chromeos/network:network_listener_behavior.m", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo.m", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:i18n_behavior.m", ] @@ -174,7 +172,6 @@ "//ui/webui/resources/cr_components/chromeos/network:network_listener_behavior.m", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo.m", "//ui/webui/resources/cr_components/chromeos/network:sim_lock_dialogs.m", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button", "//ui/webui/resources/cr_elements/policy:cr_policy_indicator", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", @@ -215,7 +212,6 @@ "//ui/webui/resources/cr_components/chromeos/network:network_list.m", "//ui/webui/resources/cr_components/chromeos/network:network_listener_behavior.m", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo.m", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button", "//ui/webui/resources/cr_elements/policy:cr_policy_indicator", "//ui/webui/resources/js:i18n_behavior.m", ] @@ -272,7 +268,6 @@ "//ui/webui/resources/cr_components/chromeos/network:network_siminfo.m", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo.m", "//ui/webui/resources/cr_components/chromeos/traffic_counters:traffic_counters", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button", "//ui/webui/resources/cr_elements/policy:cr_policy_indicator_behavior", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:i18n_behavior.m", @@ -307,7 +302,6 @@ "//ui/webui/resources/cr_components/chromeos/cellular_setup:esim_manager_utils.m", "//ui/webui/resources/cr_components/chromeos/network:cellular_utils.m", "//ui/webui/resources/cr_components/chromeos/network:network_list_types.m", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:web_ui_listener_behavior.m",
diff --git a/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc b/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc index a47845b..da67b5b 100644 --- a/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc +++ b/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc
@@ -22,12 +22,11 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager_observer.h" #include "chrome/browser/profiles/profile_window.h" -#include "chrome/browser/signin/chrome_signin_client_factory.h" -#include "chrome/browser/signin/chrome_signin_client_test_util.h" #include "chrome/browser/signin/dice_intercepted_session_startup_helper.h" #include "chrome/browser/signin/dice_web_signin_interceptor_factory.h" #include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/signin/identity_test_environment_profile_adaptor.h" +#include "chrome/browser/signin/signin_browser_test_base.h" #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/ui/browser.h" @@ -229,20 +228,12 @@ } // namespace -class DiceWebSigninInterceptorBrowserTest : public InProcessBrowserTest { +class DiceWebSigninInterceptorBrowserTest : public SigninBrowserTestBase { public: DiceWebSigninInterceptorBrowserTest() = default; Profile* profile() { return browser()->profile(); } - signin::IdentityTestEnvironment* identity_test_env() { - return identity_test_env_profile_adaptor_->identity_test_env(); - } - - network::TestURLLoaderFactory* test_url_loader_factory() { - return &test_url_loader_factory_; - } - content::WebContents* AddTab(const GURL& url) { ui_test_utils::NavigateToURLWithDisposition( browser(), url, WindowOpenDisposition::NEW_FOREGROUND_TAB, @@ -281,34 +272,15 @@ private: // InProcessBrowserTest: void SetUpOnMainThread() override { + SigninBrowserTestBase::SetUpOnMainThread(); ASSERT_TRUE(embedded_test_server()->Start()); - identity_test_env_profile_adaptor_ = - std::make_unique<IdentityTestEnvironmentProfileAdaptor>(profile()); DiceWebSigninInterceptorFactory::GetForProfile(profile()) ->SetAccountLevelSigninRestrictionFetchResultForTesting(""); } - void TearDownOnMainThread() override { - // Must be destroyed before the Profile. - identity_test_env_profile_adaptor_.reset(); - } - - void SetUpInProcessBrowserTestFixture() override { - InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); - create_services_subscription_ = - BrowserContextDependencyManager::GetInstance() - ->RegisterCreateServicesCallbackForTesting( - base::BindRepeating(&DiceWebSigninInterceptorBrowserTest:: - OnWillCreateBrowserContextServices, - base::Unretained(this))); - } - - void OnWillCreateBrowserContextServices(content::BrowserContext* context) { - IdentityTestEnvironmentProfileAdaptor:: - SetIdentityTestEnvironmentFactoriesOnBrowserContext(context); - ChromeSigninClientFactory::GetInstance()->SetTestingFactory( - context, base::BindRepeating(&BuildChromeSigninClientWithURLLoader, - &test_url_loader_factory_)); + void OnWillCreateBrowserContextServices( + content::BrowserContext* context) override { + SigninBrowserTestBase::OnWillCreateBrowserContextServices(context); DiceWebSigninInterceptorFactory::GetInstance()->SetTestingFactory( context, base::BindRepeating(&DiceWebSigninInterceptorBrowserTest:: @@ -327,10 +299,6 @@ Profile::FromBrowserContext(context), std::move(fake_delegate)); } - network::TestURLLoaderFactory test_url_loader_factory_; - std::unique_ptr<IdentityTestEnvironmentProfileAdaptor> - identity_test_env_profile_adaptor_; - base::CallbackListSubscription create_services_subscription_; std::map<content::BrowserContext*, FakeDiceWebSigninInterceptorDelegate*> interceptor_delegates_; };
diff --git a/chrome/browser/signin/signin_browser_test_base.cc b/chrome/browser/signin/signin_browser_test_base.cc new file mode 100644 index 0000000..900702e --- /dev/null +++ b/chrome/browser/signin/signin_browser_test_base.cc
@@ -0,0 +1,61 @@ +// Copyright 2022 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 "chrome/browser/signin/signin_browser_test_base.h" + +#include "chrome/browser/signin/chrome_signin_client_factory.h" +#include "chrome/browser/signin/chrome_signin_client_test_util.h" +#include "chrome/browser/ui/browser.h" +#include "components/signin/public/base/account_consistency_method.h" +#include "components/signin/public/base/signin_buildflags.h" +#include "testing/gtest/include/gtest/gtest.h" + +SigninBrowserTestBase::SigninBrowserTestBase() = default; + +SigninBrowserTestBase::~SigninBrowserTestBase() = default; + +std::vector<AccountInfo> SigninBrowserTestBase::SetAccounts( + const std::vector<std::string>& emails) { + return identity_test_env()->MakeAccountsAvailableWithCookies(emails); +} + +void SigninBrowserTestBase::SetUpOnMainThread() { + identity_test_env_profile_adaptor_ = + std::make_unique<IdentityTestEnvironmentProfileAdaptor>( + browser()->profile()); + identity_test_env()->SetTestURLLoaderFactory(&test_url_loader_factory_); +} + +void SigninBrowserTestBase::TearDownOnMainThread() { + // Must be destroyed before the Profile. + identity_test_env_profile_adaptor_.reset(); +} + +void SigninBrowserTestBase::SetUpInProcessBrowserTestFixture() { + InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); + create_services_subscription_ = + BrowserContextDependencyManager::GetInstance() + ->RegisterCreateServicesCallbackForTesting(base::BindRepeating( + &SigninBrowserTestBase::OnWillCreateBrowserContextServices, + base::Unretained(this))); +} + +void SigninBrowserTestBase::OnWillCreateBrowserContextServices( + content::BrowserContext* context) { + signin::AccountConsistencyMethod account_consistency_method = +#if BUILDFLAG(ENABLE_MIRROR) + signin::AccountConsistencyMethod::kMirror; +#elif BUILDFLAG(ENABLE_DICE_SUPPORT) + signin::AccountConsistencyMethod::kDice; +#else + signin::AccountConsistencyMethod::kDisabled; +#endif + + IdentityTestEnvironmentProfileAdaptor:: + SetIdentityTestEnvironmentFactoriesOnBrowserContext( + context, account_consistency_method); + ChromeSigninClientFactory::GetInstance()->SetTestingFactory( + context, base::BindRepeating(&BuildChromeSigninClientWithURLLoader, + &test_url_loader_factory_)); +}
diff --git a/chrome/browser/signin/signin_browser_test_base.h b/chrome/browser/signin/signin_browser_test_base.h new file mode 100644 index 0000000..08cb776c --- /dev/null +++ b/chrome/browser/signin/signin_browser_test_base.h
@@ -0,0 +1,59 @@ +// Copyright 2022 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. + +#ifndef CHROME_BROWSER_SIGNIN_SIGNIN_BROWSER_TEST_BASE_H_ +#define CHROME_BROWSER_SIGNIN_SIGNIN_BROWSER_TEST_BASE_H_ + +#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h" + +#include "chrome/test/base/in_process_browser_test.h" +#include "components/signin/public/identity_manager/account_info.h" +#include "components/signin/public/identity_manager/identity_test_environment.h" +#include "services/network/test/test_url_loader_factory.h" + +// Base class for browser tests that rely on accounts. +// +// Sets up the test environment and account consistency to simplify the +// management of accounts and cookies state. +class SigninBrowserTestBase : public InProcessBrowserTest { + public: + SigninBrowserTestBase(); + ~SigninBrowserTestBase() override; + + // Sets accounts in the environment to new ones based on the given `emails`, + // and makes the first one primary. + // Returns `AccountInfo`s for each added account, in the same order as + // `emails`. + std::vector<AccountInfo> SetAccounts(const std::vector<std::string>& emails); + + signin::IdentityTestEnvironment* identity_test_env() const { + return identity_test_env_profile_adaptor_->identity_test_env(); + } + + signin::IdentityManager* identity_manager() const { + return identity_test_env()->identity_manager(); + } + + network::TestURLLoaderFactory* test_url_loader_factory() { + return &test_url_loader_factory_; + } + + protected: + // InProcessBrowserTest: + void SetUpOnMainThread() override; + void TearDownOnMainThread() override; + void SetUpInProcessBrowserTestFixture() override; + + virtual void OnWillCreateBrowserContextServices( + content::BrowserContext* context); + + private: + std::unique_ptr<IdentityTestEnvironmentProfileAdaptor> + identity_test_env_profile_adaptor_; + base::CallbackListSubscription create_services_subscription_; + + network::TestURLLoaderFactory test_url_loader_factory_; +}; + +#endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSER_TEST_BASE_H_
diff --git a/chrome/browser/site_isolation/site_details.cc b/chrome/browser/site_isolation/site_details.cc index f9eda07..97016ca 100644 --- a/chrome/browser/site_isolation/site_details.cc +++ b/chrome/browser/site_isolation/site_details.cc
@@ -65,8 +65,8 @@ void SiteDetails::CollectSiteInfo(content::Page& page, SiteData* site_data) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - page.GetMainDocument().ForEachRenderFrameHost(base::BindRepeating( - [](content::Page* page, SiteData* site_data, RenderFrameHost* frame) { + page.GetMainDocument().ForEachRenderFrameHost( + [site_data](RenderFrameHost* frame) { // Each Page (whether primary or nested) will have its own primary // SiteInstance and BrowsingInstance. With MPArch we may have multiple // pages which could be in separate BrowsingInstances for nested pages. @@ -93,8 +93,7 @@ site_data->out_of_process_inner_frame_trees++; } } - }, - &page, site_data)); + }); } int SiteDetails::EstimateOriginAgentClusterOverhead(const SiteData& site_data) {
diff --git a/chrome/browser/ssl/security_state_tab_helper_browsertest.cc b/chrome/browser/ssl/security_state_tab_helper_browsertest.cc index 046f0ce..cd871a8 100644 --- a/chrome/browser/ssl/security_state_tab_helper_browsertest.cc +++ b/chrome/browser/ssl/security_state_tab_helper_browsertest.cc
@@ -147,12 +147,12 @@ // into all of them to ensure that notifications from all of them have been // sent. contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating([](content::RenderFrameHost* frame) { + [](content::RenderFrameHost* frame) { bool js_result = false; EXPECT_TRUE(content::ExecuteScriptAndExtractBool( frame, "window.domAutomationController.send(true);", &js_result)); EXPECT_TRUE(js_result); - })); + }); } // A WebContentsObserver useful for testing the DidChangeVisibleSecurityState()
diff --git a/chrome/browser/ssl/ssl_browsertest.cc b/chrome/browser/ssl/ssl_browsertest.cc index b4b5235..6883a7a 100644 --- a/chrome/browser/ssl/ssl_browsertest.cc +++ b/chrome/browser/ssl/ssl_browsertest.cc
@@ -196,6 +196,7 @@ #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/common/page_state/page_state.h" #include "third_party/blink/public/common/web_preferences/web_preferences.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" #include "ui/base/l10n/l10n_util.h" #if BUILDFLAG(USE_NSS_CERTS) @@ -5272,9 +5273,9 @@ WebContents::CreateParams params(tab->GetBrowserContext()); std::unique_ptr<WebContents> tab2 = WebContents::Create(params); WebContents* raw_tab2 = tab2.get(); - tab->GetDelegate()->AddNewContents(nullptr, std::move(tab2), url, - WindowOpenDisposition::NEW_FOREGROUND_TAB, - gfx::Rect(), false, nullptr); + tab->GetDelegate()->AddNewContents( + nullptr, std::move(tab2), url, WindowOpenDisposition::NEW_FOREGROUND_TAB, + blink::mojom::WindowFeatures(), false, nullptr); std::vector<std::unique_ptr<content::NavigationEntry>> entries; entries.push_back(std::move(restored_entry)); content::TestNavigationObserver observer(raw_tab2);
diff --git a/chrome/browser/supervised_user/supervised_user_navigation_observer.cc b/chrome/browser/supervised_user/supervised_user_navigation_observer.cc index 52f5436b..b335885 100644 --- a/chrome/browser/supervised_user/supervised_user_navigation_observer.cc +++ b/chrome/browser/supervised_user/supervised_user_navigation_observer.cc
@@ -173,8 +173,9 @@ // Iframe filtering has been enabled. main_frame->ForEachRenderFrameHost( - base::BindRepeating(&SupervisedUserNavigationObserver::FilterRenderFrame, - base::Unretained(this))); + [this](content::RenderFrameHost* render_frame_host) { + FilterRenderFrame(render_frame_host); + }); } void SupervisedUserNavigationObserver::OnInterstitialDone(int frame_id) {
diff --git a/chrome/browser/task_manager/providers/web_contents/web_contents_task_provider.cc b/chrome/browser/task_manager/providers/web_contents/web_contents_task_provider.cc index 847379a..6b7fdf62 100644 --- a/chrome/browser/task_manager/providers/web_contents/web_contents_task_provider.cc +++ b/chrome/browser/task_manager/providers/web_contents/web_contents_task_provider.cc
@@ -124,8 +124,10 @@ void WebContentsTaskProvider::WebContentsEntry::CreateAllTasks() { DCHECK(web_contents()->GetPrimaryMainFrame()); - web_contents()->ForEachRenderFrameHost(base::BindRepeating( - &WebContentsEntry::CreateTaskForFrame, base::Unretained(this))); + web_contents()->ForEachRenderFrameHost( + [this](content::RenderFrameHost* render_frame_host) { + CreateTaskForFrame(render_frame_host); + }); } void WebContentsTaskProvider::WebContentsEntry::ClearAllTasks( @@ -472,15 +474,12 @@ void WebContentsTaskProvider::WebContentsEntry::ClearTasksForDescendantsOf( RenderFrameHost* ancestor) { - ancestor->ForEachRenderFrameHost(base::BindRepeating( - [](WebContentsTaskProvider::WebContentsEntry* provider, - content::RenderFrameHost* ancestor, - content::RenderFrameHost* render_frame_host) { + ancestor->ForEachRenderFrameHost( + [this, ancestor](content::RenderFrameHost* render_frame_host) { if (render_frame_host == ancestor) return; - provider->ClearTaskForFrame(render_frame_host); - }, - this, ancestor)); + ClearTaskForFrame(render_frame_host); + }); } ////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index fade934e..63c74ee 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -4958,6 +4958,8 @@ "views/tabs/browser_tab_strip_controller.h", "views/tabs/color_picker_view.cc", "views/tabs/color_picker_view.h", + "views/tabs/compound_tab_container.cc", + "views/tabs/compound_tab_container.h", "views/tabs/glow_hover_controller.cc", "views/tabs/glow_hover_controller.h", "views/tabs/new_tab_button.cc",
diff --git a/chrome/browser/ui/app_list/search/omnibox_provider.h b/chrome/browser/ui/app_list/search/omnibox_provider.h index 06aef50..20a50a57 100644 --- a/chrome/browser/ui/app_list/search/omnibox_provider.h +++ b/chrome/browser/ui/app_list/search/omnibox_provider.h
@@ -46,7 +46,7 @@ // procedures. void set_query_finished_for_test(bool query_finished) { query_finished_ = query_finished; - }; + } private: // AutocompleteController::Observer overrides:
diff --git a/chrome/browser/ui/apps/chrome_app_delegate.cc b/chrome/browser/ui/apps/chrome_app_delegate.cc index 0dee4ec..22b63c37 100644 --- a/chrome/browser/ui/apps/chrome_app_delegate.cc +++ b/chrome/browser/ui/apps/chrome_app_delegate.cc
@@ -272,7 +272,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture) { if (!disable_external_open_for_testing_) { // We don't really want to open a window for |new_contents|, but we need to @@ -292,7 +292,7 @@ ? disposition : WindowOpenDisposition::NEW_FOREGROUND_TAB; chrome::AddWebContents(displayer.browser(), nullptr, std::move(new_contents), - target_url, disposition, initial_rect); + target_url, disposition, window_features); } void ChromeAppDelegate::RunFileChooser(
diff --git a/chrome/browser/ui/apps/chrome_app_delegate.h b/chrome/browser/ui/apps/chrome_app_delegate.h index 5791abb..0eec51ca 100644 --- a/chrome/browser/ui/apps/chrome_app_delegate.h +++ b/chrome/browser/ui/apps/chrome_app_delegate.h
@@ -55,7 +55,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture) override; void RunFileChooser(content::RenderFrameHost* render_frame_host, scoped_refptr<content::FileSelectListener> listener,
diff --git a/chrome/browser/ui/blocked_content/blocked_window_params.cc b/chrome/browser/ui/blocked_content/blocked_window_params.cc index 1ae4fe0..e04e674c 100644 --- a/chrome/browser/ui/blocked_content/blocked_window_params.cc +++ b/chrome/browser/ui/blocked_content/blocked_window_params.cc
@@ -9,6 +9,7 @@ #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" #include "url/gurl.h" BlockedWindowParams::BlockedWindowParams( @@ -55,13 +56,13 @@ nav_params.opened_by_another_window = !opener_suppressed_; nav_params.window_bounds = web_contents->GetContainerBounds(); if (features_.has_x) - nav_params.window_bounds.set_x(features_.x); + nav_params.window_bounds.set_x(features_.bounds.x()); if (features_.has_y) - nav_params.window_bounds.set_y(features_.y); + nav_params.window_bounds.set_y(features_.bounds.y()); if (features_.has_width) - nav_params.window_bounds.set_width(features_.width); + nav_params.window_bounds.set_width(features_.bounds.width()); if (features_.has_height) - nav_params.window_bounds.set_height(features_.height); + nav_params.window_bounds.set_height(features_.bounds.height()); nav_params.disposition = disposition_;
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index be496c1..298cff90 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc
@@ -1636,13 +1636,14 @@ } } -void Browser::AddNewContents(WebContents* source, - std::unique_ptr<WebContents> new_contents, - const GURL& target_url, - WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, - bool user_gesture, - bool* was_blocked) { +void Browser::AddNewContents( + WebContents* source, + std::unique_ptr<WebContents> new_contents, + const GURL& target_url, + WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures& window_features, + bool user_gesture, + bool* was_blocked) { FullscreenController* fullscreen_controller = exclusive_access_manager_->fullscreen_controller(); #if BUILDFLAG(IS_MAC) @@ -1679,12 +1680,12 @@ // cannot switch their independent spaces simultaneously (crbug.com/1315749) fullscreen_controller->RunOrDeferUntilTransitionIsComplete(base::BindOnce( &chrome::AddWebContents, this, source, std::move(new_contents), - target_url, disposition, initial_rect, window_action)); + target_url, disposition, window_features, window_action)); return; } chrome::AddWebContents(this, source, std::move(new_contents), target_url, - disposition, initial_rect, window_action); + disposition, window_features, window_action); } void Browser::ActivateContents(WebContents* contents) {
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 38ee0d84..9a1513f2 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h
@@ -828,7 +828,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; void ActivateContents(content::WebContents* contents) override;
diff --git a/chrome/browser/ui/browser_tabstrip.cc b/chrome/browser/ui/browser_tabstrip.cc index 0b377aa..8760ab6 100644 --- a/chrome/browser/ui/browser_tabstrip.cc +++ b/chrome/browser/ui/browser_tabstrip.cc
@@ -19,6 +19,7 @@ #include "content/public/browser/navigation_entry.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" #include "ui/base/page_transition_types.h" #include "url/gurl.h" @@ -63,7 +64,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, NavigateParams::WindowAction window_action) { // No code for this yet. DCHECK(disposition != WindowOpenDisposition::SAVE_TO_DISK); @@ -74,7 +75,7 @@ params.source_contents = source_contents; params.url = target_url; params.disposition = disposition; - params.window_bounds = initial_rect; + params.window_bounds = window_features.bounds; params.window_action = window_action; // At this point, we're already beyond the popup blocker. Even if the popup // was created without a user gesture, we have to set |user_gesture| to true,
diff --git a/chrome/browser/ui/browser_tabstrip.h b/chrome/browser/ui/browser_tabstrip.h index 6c2a57a1..e7f0852 100644 --- a/chrome/browser/ui/browser_tabstrip.h +++ b/chrome/browser/ui/browser_tabstrip.h
@@ -16,6 +16,12 @@ class Browser; class GURL; +namespace blink { +namespace mojom { +class WindowFeatures; +} +} // namespace blink + namespace gfx { class Rect; } @@ -39,16 +45,17 @@ // Creates a new tab with the already-created WebContents 'new_contents'. // The window for the added contents will be reparented correctly when this -// method returns. If |disposition| is NEW_POPUP, |initial_rect| should hold the -// initial position and size. |window_action| may optionally specify whether the -// window should be shown or activated. +// method returns. If |disposition| is NEW_POPUP, |window_features| should hold +// the initial position and size and other features of the new window. +// |window_action| may optionally specify whether the window should be shown or +// activated. void AddWebContents( Browser* browser, content::WebContents* source_contents, std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, NavigateParams::WindowAction window_action = NavigateParams::SHOW_WINDOW); // Closes the specified WebContents in the specified Browser. If
diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc index 23f254c6..d75a62c 100644 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
@@ -388,9 +388,8 @@ } // Update renderer side settings to allow active mixed content. - GetPage().GetMainDocument().ForEachRenderFrameHost(base::BindRepeating( - [](MixedContentSettingsTabHelper* mixed_content_settings, - content::RenderFrameHost* frame) { + GetPage().GetMainDocument().ForEachRenderFrameHostWithAction( + [mixed_content_settings](content::RenderFrameHost* frame) { // Stop the child frame enumeration if we have reached a fenced frame. // This is correct since fence frames should ignore InsecureContent // setting. @@ -398,8 +397,7 @@ return content::RenderFrameHost::FrameIterationAction::kSkipChildren; SetAllowRunningInsecureContent(mixed_content_settings, frame); return content::RenderFrameHost::FrameIterationAction::kContinue; - }, - mixed_content_settings)); + }); } // Don't set any manage text since none is displayed.
diff --git a/chrome/browser/ui/hung_renderer/hung_renderer_core.cc b/chrome/browser/ui/hung_renderer/hung_renderer_core.cc index 911aeb7..0001ad2a 100644 --- a/chrome/browser/ui/hung_renderer/hung_renderer_core.cc +++ b/chrome/browser/ui/hung_renderer/hung_renderer_core.cc
@@ -35,18 +35,14 @@ content::RenderFrameHost* result = nullptr; // We only consider frames visible to the user for hung frames. This is // fine because only frames receiving input are considered hung. - web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating( - [](const content::RenderProcessHost* hung_process, - content::RenderFrameHost** result, - content::RenderFrameHost* render_frame_host) { - if (render_frame_host->GetProcess() == hung_process) { - *result = render_frame_host; - return content::RenderFrameHost::FrameIterationAction::kStop; - } - return content::RenderFrameHost::FrameIterationAction::kContinue; - }, - hung_process, &result)); + web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHostWithAction( + [hung_process, &result](content::RenderFrameHost* render_frame_host) { + if (render_frame_host->GetProcess() == hung_process) { + result = render_frame_host; + return content::RenderFrameHost::FrameIterationAction::kStop; + } + return content::RenderFrameHost::FrameIterationAction::kContinue; + }); return result; }
diff --git a/chrome/browser/ui/signin_intercept_first_run_experience_dialog_browsertest.cc b/chrome/browser/ui/signin_intercept_first_run_experience_dialog_browsertest.cc index 7928c0c..af21b03 100644 --- a/chrome/browser/ui/signin_intercept_first_run_experience_dialog_browsertest.cc +++ b/chrome/browser/ui/signin_intercept_first_run_experience_dialog_browsertest.cc
@@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/signin/signin_browser_test_base.h" #include "chrome/browser/ui/signin_intercept_first_run_experience_dialog.h" #include "base/containers/enum_set.h" @@ -13,7 +14,6 @@ #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/identity_manager_factory.h" -#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h" #include "chrome/browser/signin/signin_features.h" #include "chrome/browser/sync/sync_service_factory.h" #include "chrome/browser/themes/theme_service.h" @@ -28,7 +28,6 @@ #include "chrome/browser/ui/webui/signin/profile_customization_handler.h" #include "chrome/browser/ui/webui/signin/signin_url_utils.h" #include "chrome/browser/ui/webui/signin/turn_sync_on_helper.h" -#include "chrome/test/base/in_process_browser_test.h" #include "components/feature_engagement/public/feature_constants.h" #include "components/feature_engagement/public/tracker.h" #include "components/feature_engagement/test/test_tracker.h" @@ -38,7 +37,6 @@ #include "components/policy/core/common/policy_map.h" #include "components/policy/core/common/policy_types.h" #include "components/policy/policy_constants.h" -#include "components/signin/public/base/account_consistency_method.h" #include "components/signin/public/base/signin_metrics.h" #include "components/sync/driver/test_sync_service.h" #include "components/user_education/common/feature_promo_controller.h" @@ -108,7 +106,7 @@ // Browser tests for SigninInterceptFirstRunExperienceDialog. class SigninInterceptFirstRunExperienceDialogBrowserTest - : public InProcessBrowserTest { + : public SigninBrowserTestBase { public: using DialogEvent = SigninInterceptFirstRunExperienceDialog::DialogEvent; using DialogEventSet = @@ -124,13 +122,8 @@ ~SigninInterceptFirstRunExperienceDialogBrowserTest() override = default; void SetUpInProcessBrowserTestFixture() override { - InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); - create_services_subscription_ = - BrowserContextDependencyManager::GetInstance() - ->RegisterCreateServicesCallbackForTesting(base::BindRepeating( - &SigninInterceptFirstRunExperienceDialogBrowserTest:: - OnWillCreateBrowserContextServices, - base::Unretained(this))); + SigninBrowserTestBase::SetUpInProcessBrowserTestFixture(); + policy_provider_.SetDefaultReturns( /*is_initialization_complete_return=*/true, /*is_first_policy_load_complete_return=*/true); @@ -138,10 +131,10 @@ &policy_provider_); } - void OnWillCreateBrowserContextServices(content::BrowserContext* context) { - IdentityTestEnvironmentProfileAdaptor:: - SetIdentityTestEnvironmentFactoriesOnBrowserContext( - context, signin::AccountConsistencyMethod::kDice); + void OnWillCreateBrowserContextServices( + content::BrowserContext* context) override { + SigninBrowserTestBase::OnWillCreateBrowserContextServices(context); + feature_engagement::TrackerFactory::GetInstance()->SetTestingFactory( context, base::BindRepeating(&CreateTestTracker)); SyncServiceFactory::GetInstance()->SetTestingFactory( @@ -151,10 +144,7 @@ } void SetUpOnMainThread() override { - InProcessBrowserTest::SetUpOnMainThread(); - identity_test_env_profile_adaptor_ = - std::make_unique<IdentityTestEnvironmentProfileAdaptor>( - browser()->profile()); + SigninBrowserTestBase::SetUpOnMainThread(); identity_test_env()->SetAutomaticIssueOfAccessTokens(true); // Needed for profile switch IPH testing. @@ -189,10 +179,7 @@ } void SignIn(const std::string& email) { - account_id_ = - identity_test_env() - ->MakePrimaryAccountAvailable(email, signin::ConsentLevel::kSignin) - .account_id; + account_id_ = SetAccounts({email})[0].account_id; EXPECT_EQ( identity_manager()->GetPrimaryAccountId(signin::ConsentLevel::kSignin), account_id()); @@ -245,14 +232,6 @@ consent_level == signin::ConsentLevel::kSync); } - signin::IdentityTestEnvironment* identity_test_env() { - return identity_test_env_profile_adaptor_->identity_test_env(); - } - - signin::IdentityManager* identity_manager() { - return IdentityManagerFactory::GetForProfile(browser()->profile()); - } - syncer::TestSyncService* sync_service() { return static_cast<syncer::TestSyncService*>( SyncServiceFactory::GetForProfile(browser()->profile())); @@ -281,9 +260,6 @@ const GURL kSyncSettingsUrl = GURL("chrome://settings/syncSetup"); private: - base::CallbackListSubscription create_services_subscription_; - std::unique_ptr<IdentityTestEnvironmentProfileAdaptor> - identity_test_env_profile_adaptor_; testing::NiceMock<policy::MockConfigurationPolicyProvider> policy_provider_; base::test::ScopedFeatureList feature_list_;
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index 66d8732..ad6f8d11 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
@@ -54,6 +54,7 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/webui/welcome/helpers.h" #include "chrome/browser/ui/webui/whats_new/whats_new_util.h" +#include "chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_provider_factory.h" #include "chrome/common/chrome_switches.h" @@ -188,6 +189,8 @@ command_line_.GetSwitchValueASCII(switches::kInstallChromeApp)); } + web_app::MaybeInstallAppFromCommandLine(command_line_, *profile); + #if BUILDFLAG(IS_MAC) if (process_startup == chrome::startup::IsProcessStartup::kYes) { // Check whether the auto-update system needs to be promoted from user
diff --git a/chrome/browser/ui/ui_features.cc b/chrome/browser/ui/ui_features.cc index 25f1214..90b616ec 100644 --- a/chrome/browser/ui/ui_features.cc +++ b/chrome/browser/ui/ui_features.cc
@@ -173,6 +173,11 @@ base::FEATURE_DISABLED_BY_DEFAULT}; const char kMinimumTabWidthFeatureParameterName[] = "minTabWidth"; +// Splits pinned and unpinned tabs into separate TabStrips. +// https://crbug.com/1346019 +const base::Feature kSplitTabStrip("SplitTabStrip", + base::FEATURE_DISABLED_BY_DEFAULT); + // Directly controls the "new" badge (as opposed to old "master switch"; see // https://crbug.com/1169907 for master switch deprecation and // https://crbug.com/968587 for the feature itself)
diff --git a/chrome/browser/ui/ui_features.h b/chrome/browser/ui/ui_features.h index 2ee0385..0d939988 100644 --- a/chrome/browser/ui/ui_features.h +++ b/chrome/browser/ui/ui_features.h
@@ -61,6 +61,8 @@ extern const base::Feature kScrollableTabStrip; extern const char kMinimumTabWidthFeatureParameterName[]; +extern const base::Feature kSplitTabStrip; + // TODO(pbos): Once kReadLater is cleaned up on Desktop, move definition into // ui_features.cc. This is currently temporarily in reading_list_switches.h. extern const base::Feature kSidePanelImprovedClobbering;
diff --git a/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc b/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc index 44e1bd1..9b7a78c 100644 --- a/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc +++ b/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc
@@ -20,6 +20,7 @@ #include "chrome/browser/ui/views/download/bubble/download_bubble_security_view.h" #include "chrome/browser/ui/views/download/bubble/download_dialog_view.h" #include "chrome/browser/ui/views/frame/browser_view.h" +#include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" @@ -143,6 +144,11 @@ UpdateIcon(); } +bool DownloadToolbarButtonView::IsFullscreenWithParentViewHidden() { + return browser_->window()->IsFullscreen() && + !browser_->window()->IsToolbarVisible(); +} + // This function shows the partial view. If the main view is already showing, // we do not show the partial view. If the partial view is already showing, // there is nothing to do here, the controller should update the partial view.
diff --git a/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h b/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h index 86591e5..48377d6 100644 --- a/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h +++ b/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h
@@ -54,6 +54,7 @@ void ShowDetails() override; void HideDetails() override; bool IsShowingDetails() override; + bool IsFullscreenWithParentViewHidden() override; // ToolbarButton: void UpdateIcon() override;
diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_mac.mm b/chrome/browser/ui/views/frame/immersive_mode_controller_mac.mm index fa6eb7e..71a2f20 100644 --- a/chrome/browser/ui/views/frame/immersive_mode_controller_mac.mm +++ b/chrome/browser/ui/views/frame/immersive_mode_controller_mac.mm
@@ -18,8 +18,9 @@ #include "chrome/common/pref_names.h" #include "components/prefs/pref_service.h" #include "components/remote_cocoa/app_shim/bridged_content_view.h" +#include "components/remote_cocoa/app_shim/immersive_mode_controller.h" +#include "components/remote_cocoa/app_shim/immersive_mode_delegate_mac.h" #include "ui/gfx/geometry/rect.h" -#include "ui/views/cocoa/immersive_mode_delegate_mac.h" #include "ui/views/cocoa/native_widget_mac_ns_window_host.h" #include "ui/views/focus/focus_manager.h" #include "ui/views/layout/layout_manager.h" @@ -27,96 +28,13 @@ #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_utils_mac.h" -// A stub NSWindowDelegate class that will be used to map the AppKit controlled -// NSWindow to the overlay view widget's NSWindow. The delegate will be used to -// help with input routing. -@interface ImmersiveModeMapper : NSObject <ImmersiveModeDelegate> -@property(assign) NSWindow* originalHostingWindow; -@end - -@implementation ImmersiveModeMapper -@synthesize originalHostingWindow = _originalHostingWindow; -@end - -// Host of the overlay view. -@interface ImmersiveModeTitlebarViewController - : NSTitlebarAccessoryViewController { - base::mac::ScopedBlock<void (^)()> _view_will_appear_handler; - base::mac::ScopedBlock<void (^)()> _view_did_appear_handler; -} -@end - -@implementation ImmersiveModeTitlebarViewController - -- (instancetype)initWithHandlers:(void (^)())viewWillAppearHandle - viewDidAppearHandle:(void (^)())viewDidAppearHandle { - if ((self = [super init])) { - _view_will_appear_handler.reset([viewWillAppearHandle copy]); - _view_did_appear_handler.reset([viewDidAppearHandle copy]); - } - return self; -} - -- (void)viewWillAppear { - [super viewWillAppear]; - _view_will_appear_handler.get()(); - - // TODO(bur): Get the updated width from OnViewBoundsChanged - NSView* tab_view = self.view; - NSRect f = tab_view.frame; - f.size.width = 2400; - tab_view.frame = f; - for (NSView* view in tab_view.subviews) { - if ([view isKindOfClass:[BridgedContentView class]]) { - view.frame = tab_view.frame; - } - } -} - -- (void)viewDidAppear { - [super viewDidAppear]; - _view_did_appear_handler.get()(); -} - -@end - -// An NSView that will set the ImmersiveModeDelegate on the AppKit created -// window that ends up hosting this view via the -// NSTitlebarAccessoryViewController API. -@interface ImmersiveModeView : NSView -- (instancetype)initWithImmersiveModeDelegate: - (id<ImmersiveModeDelegate>)delegate; -@end - -@implementation ImmersiveModeView { - ImmersiveModeMapper* _fullscreenDelegate; -} - -- (instancetype)initWithImmersiveModeDelegate: - (id<ImmersiveModeDelegate>)delegate { - self = [super init]; - if (self) { - _fullscreenDelegate = delegate; - } - return self; -} - -- (void)viewWillMoveToWindow:(NSWindow*)window { - if (views::IsNSToolbarFullScreenWindow(window)) { - // This window is created by AppKit. Make sure it doesn't have a delegate so - // we can use it for out own purposes. - DCHECK(!window.delegate); - window.delegate = _fullscreenDelegate; - } -} - -@end - namespace { -class ImmersiveModeControllerMac : public ImmersiveModeController, - public views::FocusChangeListener, - public views::ViewObserver, - public views::WidgetObserver { +class ImmersiveModeControllerMac + : public ImmersiveModeController, + public views::FocusChangeListener, + public views::ViewObserver, + public views::WidgetObserver, + public remote_cocoa::ImmersiveModeController::Delegate { public: class RevealedLock : public ImmersiveRevealedLock { public: @@ -166,6 +84,10 @@ // views::WidgetObserver implementation void OnWidgetDestroying(views::Widget* widget) override; + // remote_cocoa::ImmersiveModeController::Delegate implementation: + void TopViewWillAppear() override; + void TopViewDidAppear(NSView* content_view) override; + private: friend class RevealedLock; @@ -181,9 +103,10 @@ std::unique_ptr<ImmersiveRevealedLock> menu_lock_; bool enabled_ = false; int revealed_lock_count_ = 0; - base::scoped_nsobject<ImmersiveModeTitlebarViewController> - immersive_mode_titlebar_view_controller_; - base::scoped_nsobject<ImmersiveModeMapper> immersive_mode_mapper_; + // The remote_cocoa counterpart of this class. + // TODO(mek): Rather than directly accessing the class, interact via some + // kind of mojo interface. + std::unique_ptr<remote_cocoa::ImmersiveModeController> remote_controller_; base::ScopedObservation<views::View, views::ViewObserver> top_container_observation_{this}; base::ScopedObservation<views::Widget, views::WidgetObserver> @@ -224,19 +147,9 @@ } void ImmersiveModeControllerMac::ShowFullscreenToolbar() { - if (*show_fullscreen_toolbar_) { - immersive_mode_titlebar_view_controller_.get().fullScreenMinHeight = - immersive_mode_titlebar_view_controller_.get().view.frame.size.height; - browser_view_->GetWidget() - ->GetNativeWindow() - .GetNativeNSWindow() - .styleMask &= ~NSWindowStyleMaskFullSizeContentView; - } else { - immersive_mode_titlebar_view_controller_.get().fullScreenMinHeight = 0; - browser_view_->GetWidget() - ->GetNativeWindow() - .GetNativeNSWindow() - .styleMask |= NSWindowStyleMaskFullSizeContentView; + if (remote_controller_) { + remote_controller_->SetAlwaysShowFullscreenToolbar( + *show_fullscreen_toolbar_); } // TODO(bur): Re-layout so that "no show" -> "always show" will work @@ -264,49 +177,13 @@ browser_frame_observation_.Observe(browser_view_->GetWidget()); overlay_widget_observation_.Observe(browser_view_->overlay_widget()); - // Create a new NSTitlebarAccessoryViewController that will host the - // overlay_view_. - NSView* contentView = browser_view_->overlay_widget() - ->GetNativeWindow() - .GetNativeNSWindow() - .contentView; - immersive_mode_titlebar_view_controller_.reset( - [[ImmersiveModeTitlebarViewController alloc] - initWithHandlers:^() { - SetMenuRevealed(true); - } - viewDidAppearHandle:^() { - browser_view_->overlay_widget()->SetNativeWindowProperty( - views::NativeWidgetMacNSWindowHost::kImmersiveContentNSView, - contentView); - }]); - - // Create a NSWindow delegate that will be used to map the AppKit created - // NSWindow to the overlay view widget's NSWindow. - immersive_mode_mapper_.reset([[ImmersiveModeMapper alloc] init]); - immersive_mode_mapper_.get().originalHostingWindow = - browser_view_->overlay_widget()->GetNativeWindow().GetNativeNSWindow(); - immersive_mode_titlebar_view_controller_.get().view = - [[ImmersiveModeView alloc] - initWithImmersiveModeDelegate:immersive_mode_mapper_.get()]; - - // Remove the content view from the overlay view widget's NSWindow. This - // view will be re-parented into the AppKit created NSWindow. - NSView* overlay_content_view = browser_view_->overlay_widget() - ->GetNativeWindow() - .GetNativeNSWindow() - .contentView; - [overlay_content_view removeFromSuperview]; - - // Add the overlay view to the accessory view controller and hand everything - // over to AppKit. - [immersive_mode_titlebar_view_controller_.get().view - addSubview:overlay_content_view]; - immersive_mode_titlebar_view_controller_.get().layoutAttribute = - NSLayoutAttributeBottom; - [browser_view_->GetWidget()->GetNativeWindow().GetNativeNSWindow() - addTitlebarAccessoryViewController: - immersive_mode_titlebar_view_controller_]; + remote_controller_ = + std::make_unique<remote_cocoa::ImmersiveModeController>( + this, + browser_view_->GetWidget()->GetNativeWindow().GetNativeNSWindow(), + browser_view_->overlay_widget() + ->GetNativeWindow() + .GetNativeNSWindow()); // TODO(bur): Figure out why this Show() is needed. // Overlay content view will not be displayed unless we call Show() on the @@ -332,21 +209,7 @@ // Rollback the view shuffling from enablement. browser_view_->overlay_widget()->Hide(); - NSView* overlay_content_view = - immersive_mode_titlebar_view_controller_.get() - .view.subviews.firstObject; - [overlay_content_view removeFromSuperview]; - browser_view_->overlay_widget() - ->GetNativeWindow() - .GetNativeNSWindow() - .contentView = overlay_content_view; - [immersive_mode_titlebar_view_controller_ removeFromParentViewController]; - [immersive_mode_titlebar_view_controller_.get().view release]; - immersive_mode_titlebar_view_controller_.reset(); - browser_view_->GetWidget() - ->GetNativeWindow() - .GetNativeNSWindow() - .styleMask |= NSWindowStyleMaskFullSizeContentView; + remote_controller_.reset(); menu_lock_.reset(); focus_lock_.reset(); @@ -405,8 +268,9 @@ void ImmersiveModeControllerMac::OnViewBoundsChanged( views::View* observed_view) { browser_view_->overlay_widget()->SetBounds(observed_view->bounds()); - NSRect frame_rect = observed_view->bounds().ToCGRect(); - immersive_mode_titlebar_view_controller_.get().view.frame = frame_rect; + if (remote_controller_) { + remote_controller_->OnTopViewBoundsChanged(observed_view->bounds()); + } ShowFullscreenToolbar(); } @@ -414,6 +278,18 @@ SetEnabled(false); } +void ImmersiveModeControllerMac::TopViewWillAppear() { + SetMenuRevealed(true); +} + +void ImmersiveModeControllerMac::TopViewDidAppear(NSView* content_view) { + // TODO(mek): Figure out a way to do what this is doing without passing a + // NSView* instance back from the remote_cocoa side. + browser_view_->overlay_widget()->SetNativeWindowProperty( + views::NativeWidgetMacNSWindowHost::kImmersiveContentNSView, + content_view); +} + void ImmersiveModeControllerMac::LockDestroyed() { revealed_lock_count_--; if (revealed_lock_count_ == 0)
diff --git a/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc b/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc index c833891..da455323 100644 --- a/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc +++ b/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc
@@ -299,7 +299,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) { // Open new foreground tab or popup triggered by user activation in payment @@ -309,7 +309,7 @@ (disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB || disposition == WindowOpenDisposition::NEW_POPUP)) { chrome::AddWebContents(browser, source, std::move(new_contents), target_url, - disposition, initial_rect); + disposition, window_features); } }
diff --git a/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.h b/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.h index b9dd342..3e3d5a261 100644 --- a/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.h +++ b/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.h
@@ -77,7 +77,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; bool HandleKeyboardEvent(
diff --git a/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view.cc b/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view.cc index 0553f51..6907efc 100644 --- a/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view.cc +++ b/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view.cc
@@ -150,13 +150,13 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) { // Allows the Signin Interception bubble to open links in a new tab. if (browser_) { chrome::AddWebContents(browser_.get(), source, std::move(new_contents), - target_url, disposition, initial_rect); + target_url, disposition, window_features); } }
diff --git a/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view.h b/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view.h index 801b578..3186a2a 100644 --- a/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view.h +++ b/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view.h
@@ -63,7 +63,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override;
diff --git a/chrome/browser/ui/views/profiles/profile_picker_dice_sign_in_provider.cc b/chrome/browser/ui/views/profiles/profile_picker_dice_sign_in_provider.cc index b51057528d..d21ffd20 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_dice_sign_in_provider.cc +++ b/chrome/browser/ui/views/profiles/profile_picker_dice_sign_in_provider.cc
@@ -31,6 +31,7 @@ #include "google_apis/gaia/gaia_auth_util.h" #include "google_apis/gaia/gaia_urls.h" #include "net/base/url_util.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" #include "ui/base/theme_provider.h" #include "ui/color/color_provider.h" #include "ui/views/controls/webview/web_contents_set_background_color.h" @@ -149,14 +150,15 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) { NavigateParams params(profile_, target_url, ui::PAGE_TRANSITION_LINK); // Open all links as new popups. params.disposition = WindowOpenDisposition::NEW_POPUP; params.contents_to_insert = std::move(new_contents); - params.window_bounds = initial_rect; + + params.window_bounds = window_features.bounds; Navigate(¶ms); }
diff --git a/chrome/browser/ui/views/profiles/profile_picker_dice_sign_in_provider.h b/chrome/browser/ui/views/profiles/profile_picker_dice_sign_in_provider.h index 408d8a8..1983fd20 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_dice_sign_in_provider.h +++ b/chrome/browser/ui/views/profiles/profile_picker_dice_sign_in_provider.h
@@ -85,7 +85,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; bool HandleKeyboardEvent(
diff --git a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc index 4bea9796..4dce039 100644 --- a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc +++ b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc
@@ -262,12 +262,12 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) { // Allows the Gaia reauth page to open links in a new tab. chrome::AddWebContents(browser_, source, std::move(new_contents), target_url, - disposition, initial_rect); + disposition, window_features); } web_modal::WebContentsModalDialogHost*
diff --git a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h index 85134681..0b728c0 100644 --- a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h +++ b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h
@@ -105,7 +105,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override;
diff --git a/chrome/browser/ui/views/tabs/compound_tab_container.cc b/chrome/browser/ui/views/tabs/compound_tab_container.cc new file mode 100644 index 0000000..051d58b81 --- /dev/null +++ b/chrome/browser/ui/views/tabs/compound_tab_container.cc
@@ -0,0 +1,549 @@ +// Copyright 2022 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 "chrome/browser/ui/views/tabs/compound_tab_container.h" +#include <memory> + +#include "base/auto_reset.h" +#include "base/bind.h" +#include "chrome/browser/ui/tabs/tab_types.h" +#include "chrome/browser/ui/ui_features.h" +#include "chrome/browser/ui/views/tabs/tab_container_impl.h" +#include "tab_strip_controller.h" +#include "ui/base/metadata/metadata_impl_macros.h" +#include "ui/base/models/list_selection_model.h" +#include "ui/views/layout/flex_layout.h" +#include "ui/views/layout/layout_types.h" +#include "ui/views/view.h" + +namespace { +class PinnedTabContainerController final : public TabContainerController { + public: + explicit PinnedTabContainerController( + raw_ref<TabContainerController> base_controller) + : base_controller_(base_controller) {} + + ~PinnedTabContainerController() override = default; + + bool IsValidModelIndex(int index) const override { + return base_controller_->IsValidModelIndex(index) && + index < NumPinnedTabsInModel(); + } + + int GetActiveIndex() const override { + const int active_index = base_controller_->GetActiveIndex(); + if (!IsValidModelIndex(active_index)) + return TabStripModel::kNoTab; + return active_index; + } + + int NumPinnedTabsInModel() const override { + return base_controller_->NumPinnedTabsInModel(); + } + + void OnDropIndexUpdate(int index, bool drop_before) override { + base_controller_->OnDropIndexUpdate(index, drop_before); + } + + bool IsGroupCollapsed(const tab_groups::TabGroupId& group) const override { + NOTREACHED(); + return false; + } + + absl::optional<int> GetFirstTabInGroup( + const tab_groups::TabGroupId& group) const override { + NOTREACHED(); + return absl::nullopt; + } + + gfx::Range ListTabsInGroup( + const tab_groups::TabGroupId& group) const override { + NOTREACHED(); + return gfx::Range(); + } + + bool CanExtendDragHandle() const override { + return base_controller_->CanExtendDragHandle(); + } + + private: + const raw_ref<TabContainerController> base_controller_; +}; + +class UnpinnedTabContainerController final : public TabContainerController { + public: + explicit UnpinnedTabContainerController( + raw_ref<TabContainerController> base_controller) + : base_controller_(base_controller) {} + + ~UnpinnedTabContainerController() override = default; + + bool IsValidModelIndex(int index) const override { + return index >= 0 && + base_controller_->IsValidModelIndex(ContainerToModelIndex(index)); + } + + int GetActiveIndex() const override { + const absl::optional<int> active_index = + ModelToContainerIndex(base_controller_->GetActiveIndex()); + // TODO(crbug.com/1346023): Maybe optional instead. + return active_index.value_or(TabStripModel::kNoTab); + } + + int NumPinnedTabsInModel() const override { return 0; } + + void OnDropIndexUpdate(int index, bool drop_before) override { + base_controller_->OnDropIndexUpdate(ContainerToModelIndex(index), + drop_before); + } + + bool IsGroupCollapsed(const tab_groups::TabGroupId& group) const override { + return base_controller_->IsGroupCollapsed(group); + } + + absl::optional<int> GetFirstTabInGroup( + const tab_groups::TabGroupId& group) const override { + const absl::optional<int> model_index = + base_controller_->GetFirstTabInGroup(group); + if (!model_index) + return absl::nullopt; + return ModelToContainerIndex(model_index.value()); + } + + gfx::Range ListTabsInGroup( + const tab_groups::TabGroupId& group) const override { + const gfx::Range model_range = base_controller_->ListTabsInGroup(group); + return gfx::Range(ModelToContainerIndex(model_range.start()).value(), + ModelToContainerIndex(model_range.end()).value()); + } + + bool CanExtendDragHandle() const override { + return base_controller_->CanExtendDragHandle(); + } + + private: + absl::optional<int> ModelToContainerIndex(int model_index) const { + if (model_index < base_controller_->NumPinnedTabsInModel() || + !base_controller_->IsValidModelIndex(model_index)) + return absl::nullopt; + return model_index - base_controller_->NumPinnedTabsInModel(); + } + + int ContainerToModelIndex(int container_index) const { + if (container_index < 0) + return TabStripModel::kNoTab; + const int model_index = + container_index + base_controller_->NumPinnedTabsInModel(); + if (!base_controller_->IsValidModelIndex(model_index)) + return TabStripModel::kNoTab; + return model_index; + } + + const raw_ref<TabContainerController> base_controller_; +}; +} // namespace + +CompoundTabContainer::CompoundTabContainer( + const raw_ref<TabContainerController> controller, + TabHoverCardController* hover_card_controller, + TabDragContextBase* drag_context, + TabSlotController& tab_slot_controller, + views::View* scroll_contents_view) + : controller_(controller), + pinned_tab_container_controller_( + std::make_unique<PinnedTabContainerController>(controller)), + pinned_tab_container_(*AddChildView(std::make_unique<TabContainerImpl>( + *(pinned_tab_container_controller_.get()), + hover_card_controller, + drag_context, + tab_slot_controller, + scroll_contents_view))), + unpinned_tab_container_controller_( + std::make_unique<UnpinnedTabContainerController>(controller)), + unpinned_tab_container_(*AddChildView(std::make_unique<TabContainerImpl>( + *(unpinned_tab_container_controller_.get()), + hover_card_controller, + drag_context, + tab_slot_controller, + scroll_contents_view))) { + const views::FlexSpecification tab_container_flex_spec = + views::FlexSpecification(views::LayoutOrientation::kHorizontal, + views::MinimumFlexSizeRule::kScaleToMinimum, + views::MaximumFlexSizeRule::kPreferred); + pinned_tab_container_->SetProperty(views::kFlexBehaviorKey, + tab_container_flex_spec); + unpinned_tab_container_->SetProperty(views::kFlexBehaviorKey, + tab_container_flex_spec); + + SetLayoutManager(std::make_unique<views::FlexLayout>()) + ->SetOrientation(views::LayoutOrientation::kHorizontal); +} + +CompoundTabContainer::~CompoundTabContainer() = default; + +void CompoundTabContainer::SetAvailableWidthCallback( + base::RepeatingCallback<int()> available_width_callback) { + // The pinned container lays out independently of its available width because + // it doesn't have variable-width tabs. It doesn't matter what we give it here + // - it will call its callback but ultimately end up effectively ignoring the + // result deep in TabStripLayoutHelper (because all of its tabs are pinned). + pinned_tab_container_->SetAvailableWidthCallback( + base::BindRepeating([]() { return 0; })); + unpinned_tab_container_->SetAvailableWidthCallback(base::BindRepeating( + &CompoundTabContainer::GetAvailableWidthForUnpinnedTabContainer, + base::Unretained(this), available_width_callback)); + available_width_callback_ = available_width_callback; +} + +Tab* CompoundTabContainer::AddTab(std::unique_ptr<Tab> tab, + int model_index, + TabPinned pinned) { + if (pinned == TabPinned::kPinned) { + CHECK_LE(model_index, NumPinnedTabs()); + return pinned_tab_container_->AddTab(std::move(tab), model_index, pinned); + } + CHECK_GE(model_index, NumPinnedTabs()); + return unpinned_tab_container_->AddTab(std::move(tab), + model_index - NumPinnedTabs(), pinned); +} + +void CompoundTabContainer::MoveTab(int from_model_index, int to_model_index) { + // TODO(crbug.com/1346023): Impl + NOTREACHED(); +} + +void CompoundTabContainer::RemoveTab(int index, bool was_active) { + CHECK(controller_->IsValidModelIndex(index)); + if (index < NumPinnedTabs()) { + pinned_tab_container_->RemoveTab(index, was_active); + } else { + unpinned_tab_container_->RemoveTab(index - NumPinnedTabs(), was_active); + } +} + +void CompoundTabContainer::SetTabPinned(int model_index, TabPinned pinned) { + if (pinned == TabPinned::kPinned) { + CHECK_EQ(model_index, NumPinnedTabs()); + std::unique_ptr<Tab> tab = unpinned_tab_container_->TransferTabOut(0); + pinned_tab_container_->AddTab(std::move(tab), model_index, pinned); + } else { + CHECK_EQ(model_index, NumPinnedTabs() - 1); + std::unique_ptr<Tab> tab = + pinned_tab_container_->TransferTabOut(model_index); + unpinned_tab_container_->AddTab(std::move(tab), 0, pinned); + } + + Layout(); +} + +void CompoundTabContainer::SetActiveTab( + absl::optional<size_t> prev_active_index, + absl::optional<size_t> new_active_index) { + absl::optional<size_t> prev_pinned_active_index; + absl::optional<size_t> new_pinned_active_index; + absl::optional<size_t> prev_unpinned_active_index; + absl::optional<size_t> new_unpinned_active_index; + if (prev_active_index.has_value()) { + if (prev_active_index < static_cast<size_t>(NumPinnedTabs())) { + prev_pinned_active_index = prev_active_index; + } else { + prev_unpinned_active_index = prev_active_index.value() - NumPinnedTabs(); + } + } + if (new_active_index.has_value()) { + if (new_active_index < static_cast<size_t>(NumPinnedTabs())) { + new_pinned_active_index = new_active_index; + } else { + new_unpinned_active_index = new_active_index.value() - NumPinnedTabs(); + } + } + + pinned_tab_container_->SetActiveTab(prev_pinned_active_index, + new_pinned_active_index); + unpinned_tab_container_->SetActiveTab(prev_unpinned_active_index, + new_unpinned_active_index); +} + +std::unique_ptr<Tab> CompoundTabContainer::TransferTabOut(int model_index) { + NOTREACHED(); + return nullptr; +} + +void CompoundTabContainer::StoppedDraggingView(TabSlotView* view) { + NOTREACHED(); +} + +void CompoundTabContainer::ScrollTabToVisible(int model_index) { + // TODO(crbug.com/1346023): Implement. I guess. +} + +void CompoundTabContainer::ScrollTabContainerByOffset(int offset) { + // TODO(crbug.com/1346023): ditto +} + +void CompoundTabContainer::OnGroupCreated(const tab_groups::TabGroupId& group) { + // TODO(crbug.com/1346023): Impl + NOTREACHED(); +} + +void CompoundTabContainer::OnGroupEditorOpened( + const tab_groups::TabGroupId& group) { + // TODO(crbug.com/1346023): Impl + NOTREACHED(); +} + +void CompoundTabContainer::OnGroupMoved(const tab_groups::TabGroupId& group) { + NOTREACHED(); +} + +void CompoundTabContainer::OnGroupContentsChanged( + const tab_groups::TabGroupId& group) { + // TODO(crbug.com/1346023): Impl + NOTREACHED(); +} + +void CompoundTabContainer::OnGroupClosed(const tab_groups::TabGroupId& group) { + // TODO(crbug.com/1346023): Impl + NOTREACHED(); +} + +void CompoundTabContainer::UpdateTabGroupVisuals( + tab_groups::TabGroupId group_id) { + // TODO(crbug.com/1346023): Impl + NOTREACHED(); +} + +void CompoundTabContainer::NotifyTabGroupEditorBubbleOpened() { + // TODO(crbug.com/1346023): Impl + NOTREACHED(); +} + +void CompoundTabContainer::NotifyTabGroupEditorBubbleClosed() { + // TODO(crbug.com/1346023): Impl + NOTREACHED(); +} + +int CompoundTabContainer::GetModelIndexOf(const TabSlotView* slot_view) const { + int pinned_index = pinned_tab_container_->GetModelIndexOf(slot_view); + if (pinned_index != TabStripModel::kNoTab) // TODO(crbug.com/1346023): Maybe + // optional instead. + return pinned_index; + return unpinned_tab_container_->GetModelIndexOf(slot_view) + NumPinnedTabs(); +} + +Tab* CompoundTabContainer::GetTabAtModelIndex(int index) const { + CHECK(controller_->IsValidModelIndex(index)); + if (index < NumPinnedTabs()) + return pinned_tab_container_->GetTabAtModelIndex(index); + return unpinned_tab_container_->GetTabAtModelIndex(index - NumPinnedTabs()); +} + +int CompoundTabContainer::GetTabCount() const { + return pinned_tab_container_->GetTabCount() + + unpinned_tab_container_->GetTabCount(); +} + +int CompoundTabContainer::GetModelIndexOfFirstNonClosingTab(Tab* tab) const { + NOTREACHED(); + // TODO(crbug.com/1346023): Impl + // If the tab is pinned, ask pinned container + // If that returns kNoTab, ask unpinned container for the first nonclosing tab + // Otherwise, just forward to unpinned container + return TabStripModel::kNoTab; +} + +void CompoundTabContainer::UpdateHoverCard( + Tab* tab, + TabSlotController::HoverCardUpdateType update_type) { + // TODO(crbug.com/1346023): probably hover card controller ownership is wrong +} + +void CompoundTabContainer::HandleLongTap(ui::GestureEvent* event) { + // TODO(crbug.com/1346023): Impl + NOTREACHED(); +} + +bool CompoundTabContainer::IsRectInWindowCaption(const gfx::Rect& rect) { + gfx::RectF rect_in_child_coords(rect); + ConvertRectToTarget(this, base::to_address(pinned_tab_container_), + &rect_in_child_coords); + if (!pinned_tab_container_->IsRectInWindowCaption( + ToEnclosingRect(rect_in_child_coords))) { + return false; + } + + ConvertRectToTarget(base::to_address(pinned_tab_container_), + base::to_address(unpinned_tab_container_), + &rect_in_child_coords); + return unpinned_tab_container_->IsRectInWindowCaption( + ToEnclosingRect(rect_in_child_coords)); +} + +void CompoundTabContainer::OnTabSlotAnimationProgressed(TabSlotView* view) { + NOTREACHED(); +} + +void CompoundTabContainer::OnTabCloseAnimationCompleted(Tab* tab) { + NOTREACHED(); +} + +void CompoundTabContainer::StartBasicAnimation() { + // TODO(crbug.com/1346023): Implement this, or better, remove callers. +} + +void CompoundTabContainer::InvalidateIdealBounds() { + // TODO(crbug.com/1346023): Impl + NOTREACHED(); +} + +bool CompoundTabContainer::IsAnimating() const { + return pinned_tab_container_->IsAnimating() || + unpinned_tab_container_->IsAnimating(); +} + +void CompoundTabContainer::CancelAnimation() { + // TODO(crbug.com/1346023): Impl +} + +void CompoundTabContainer::CompleteAnimationAndLayout() { + // TODO(crbug.com/1346023): Impl +} + +int CompoundTabContainer::GetAvailableWidthForTabContainer() const { + // Falls back to views::View::GetAvailableSize() when + // |available_width_callback_| is not defined, e.g. when tab scrolling is + // disabled. + return available_width_callback_ + ? available_width_callback_.Run() + : parent()->GetAvailableSize(this).width().value(); +} + +void CompoundTabContainer::EnterTabClosingMode( + absl::optional<int> override_width, + CloseTabSource source) { + // TODO(crbug.com/1346023): Impl + NOTREACHED(); +} +void CompoundTabContainer::ExitTabClosingMode() { + // TODO(crbug.com/1346023): Impl + NOTREACHED(); +} + +void CompoundTabContainer::SetTabSlotVisibility() { + // TODO(crbug.com/1346023): Impl +} + +bool CompoundTabContainer::InTabClose() { + // Only unpinned TabContainer can be in tab closing mode. + return unpinned_tab_container_->InTabClose(); +} + +std::map<tab_groups::TabGroupId, std::unique_ptr<TabGroupViews>>& +CompoundTabContainer::GetGroupViews() { + // Only the unpinned container can have groups. + return unpinned_tab_container_->GetGroupViews(); +} + +int CompoundTabContainer::GetActiveTabWidth() const { + // Only the unpinned container has variable-width tabs. + return unpinned_tab_container_->GetActiveTabWidth(); +} + +int CompoundTabContainer::GetInactiveTabWidth() const { + // Only the unpinned container has variable-width tabs. + return unpinned_tab_container_->GetInactiveTabWidth(); +} + +gfx::Rect CompoundTabContainer::GetIdealBounds(int model_index) const { + // TODO(crbug.com/1346023): Impl + NOTREACHED(); + return gfx::Rect(); +} + +gfx::Rect CompoundTabContainer::GetIdealBounds( + tab_groups::TabGroupId group) const { + // TODO(crbug.com/1346023): Impl + NOTREACHED(); + return gfx::Rect(); +} + +void CompoundTabContainer::Layout() { + // TODO(crub.com/1346023): Probably need something special in here for drag at + // end of tabstrip scenarios. + views::View::Layout(); +} + +void CompoundTabContainer::PaintChildren(const views::PaintInfo& paint_info) { + // TODO(crbug.com/1346023): paint in the right order depending on tab paint + // order. + views::View::PaintChildren(paint_info); +} + +gfx::Size CompoundTabContainer::GetMinimumSize() const { + // TODO(crub.com/1346023): Probably need something special in here for drag at + // end of tabstrip scenarios. + return views::View::GetMinimumSize(); +} + +gfx::Size CompoundTabContainer::CalculatePreferredSize() const { + // TODO(crub.com/1346023): Probably need something special in here for drag at + // end of tabstrip scenarios. + return views::View::CalculatePreferredSize(); +} + +BrowserRootView::DropIndex CompoundTabContainer::GetDropIndex( + const ui::DropTargetEvent& event) { + NOTREACHED(); + return BrowserRootView::DropIndex(); +} + +BrowserRootView::DropTarget* CompoundTabContainer::GetDropTarget( + gfx::Point loc_in_local_coords) { + return GetTabContainerAt(loc_in_local_coords); +} + +views::View* CompoundTabContainer::GetViewForDrop() { + NOTREACHED(); + return nullptr; +} + +void CompoundTabContainer::HandleDragUpdate( + const absl::optional<BrowserRootView::DropIndex>& index) { + NOTREACHED(); +} + +void CompoundTabContainer::HandleDragExited() { + NOTREACHED(); +} + +int CompoundTabContainer::NumPinnedTabs() const { + return pinned_tab_container_->GetTabCount(); +} + +TabContainer* CompoundTabContainer::GetTabContainerAt( + gfx::Point point_in_local_coords) { + if (pinned_tab_container_->bounds().Contains(point_in_local_coords)) + return base::to_address(pinned_tab_container_); + if (unpinned_tab_container_->bounds().Contains(point_in_local_coords)) + return base::to_address(unpinned_tab_container_); + NOTREACHED() << "point_in_local_coords " << point_in_local_coords.ToString() + << " is not in pinned at: " + << pinned_tab_container_->bounds().ToString() + << " or unpinned at: " + << unpinned_tab_container_->bounds().ToString(); + return nullptr; +} + +int CompoundTabContainer::GetAvailableWidthForUnpinnedTabContainer( + base::RepeatingCallback<int()> available_width_callback) { + // The unpinned container gets the width the pinned container doesn't want. + // TODO(crbug.com/1346023): Pinned container's preferred width might be a) + // not correct during animations and b) expensive to call, maybe triggering + // TabStrip relayout sometimes. Could be the cause of the lag spike issue. + return available_width_callback.Run() - + pinned_tab_container_->CalculatePreferredSize().width(); +} + +BEGIN_METADATA(CompoundTabContainer, views::View) +END_METADATA
diff --git a/chrome/browser/ui/views/tabs/compound_tab_container.h b/chrome/browser/ui/views/tabs/compound_tab_container.h new file mode 100644 index 0000000..a866e48 --- /dev/null +++ b/chrome/browser/ui/views/tabs/compound_tab_container.h
@@ -0,0 +1,126 @@ +// Copyright 2022 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. + +#ifndef CHROME_BROWSER_UI_VIEWS_TABS_COMPOUND_TAB_CONTAINER_H_ +#define CHROME_BROWSER_UI_VIEWS_TABS_COMPOUND_TAB_CONTAINER_H_ + +#include <memory> +#include "base/memory/raw_ptr.h" +#include "chrome/browser/ui/views/tabs/tab_container.h" +#include "chrome/browser/ui/views/tabs/tab_container_controller.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/gfx/geometry/point.h" + +class TabHoverCardController; +class TabDragContextBase; + +// Composes two TabContainers into one, keeping the pinned tabs in one container +// and the unpinned tabs in the other. +class CompoundTabContainer : public TabContainer { + public: + METADATA_HEADER(CompoundTabContainer); + + CompoundTabContainer(raw_ref<TabContainerController> controller, + TabHoverCardController* hover_card_controller, + TabDragContextBase* drag_context, + TabSlotController& tab_slot_controller, + views::View* scroll_contents_view); + ~CompoundTabContainer() override; + + // TabContainer: + void SetAvailableWidthCallback( + base::RepeatingCallback<int()> available_width_callback) override; + Tab* AddTab(std::unique_ptr<Tab> tab, + int model_index, + TabPinned pinned) override; + void MoveTab(int from_model_index, int to_model_index) override; + void RemoveTab(int index, bool was_active) override; + void SetTabPinned(int model_index, TabPinned pinned) override; + void SetActiveTab(absl::optional<size_t> prev_active_index, + absl::optional<size_t> new_active_index) override; + std::unique_ptr<Tab> TransferTabOut(int model_index) override; + void StoppedDraggingView(TabSlotView* view) override; + void ScrollTabToVisible(int model_index) override; + void ScrollTabContainerByOffset(int offset) override; + void OnGroupCreated(const tab_groups::TabGroupId& group) override; + void OnGroupEditorOpened(const tab_groups::TabGroupId& group) override; + void OnGroupMoved(const tab_groups::TabGroupId& group) override; + void OnGroupContentsChanged(const tab_groups::TabGroupId& group) override; + void OnGroupClosed(const tab_groups::TabGroupId& group) override; + void UpdateTabGroupVisuals(tab_groups::TabGroupId group_id) override; + void NotifyTabGroupEditorBubbleOpened() override; + void NotifyTabGroupEditorBubbleClosed() override; + int GetModelIndexOf(const TabSlotView* slot_view) const override; + Tab* GetTabAtModelIndex(int index) const override; + int GetTabCount() const override; + int GetModelIndexOfFirstNonClosingTab(Tab* tab) const override; + void UpdateHoverCard( + Tab* tab, + TabSlotController::HoverCardUpdateType update_type) override; + void HandleLongTap(ui::GestureEvent* event) override; + bool IsRectInWindowCaption(const gfx::Rect& rect) override; + void OnTabSlotAnimationProgressed(TabSlotView* view) override; + void OnTabCloseAnimationCompleted(Tab* tab) override; + void StartBasicAnimation() override; + void InvalidateIdealBounds() override; + bool IsAnimating() const override; + void CancelAnimation() override; + void CompleteAnimationAndLayout() override; + int GetAvailableWidthForTabContainer() const override; + void EnterTabClosingMode(absl::optional<int> override_width, + CloseTabSource source) override; + void ExitTabClosingMode() override; + void SetTabSlotVisibility() override; + bool InTabClose() override; + std::map<tab_groups::TabGroupId, std::unique_ptr<TabGroupViews>>& + GetGroupViews() override; + int GetActiveTabWidth() const override; + int GetInactiveTabWidth() const override; + gfx::Rect GetIdealBounds(int model_index) const override; + gfx::Rect GetIdealBounds(tab_groups::TabGroupId group) const override; + + // views::View + void Layout() override; + void PaintChildren(const views::PaintInfo& paint_info) override; + gfx::Size GetMinimumSize() const override; + gfx::Size CalculatePreferredSize() const override; + + // BrowserRootView::DropTarget: + BrowserRootView::DropIndex GetDropIndex( + const ui::DropTargetEvent& event) override; + BrowserRootView::DropTarget* GetDropTarget( + gfx::Point loc_in_local_coords) override; + views::View* GetViewForDrop() override; + void HandleDragUpdate( + const absl::optional<BrowserRootView::DropIndex>& index) override; + void HandleDragExited() override; + + private: + int NumPinnedTabs() const; + + TabContainer* GetTabContainerAt(gfx::Point point_in_local_coords); + + int GetAvailableWidthForUnpinnedTabContainer( + base::RepeatingCallback<int()> available_width_callback); + + const raw_ref<TabContainerController> controller_; + + // Adapts `pinned_tab_container_`'s interactions with the model to account for + // it only holding pinned tabs. + const std::unique_ptr<TabContainerController> + pinned_tab_container_controller_; + // The TabContainer that holds the pinned tabs. + const raw_ref<TabContainer> pinned_tab_container_; + + // Adapts `unpinned_tab_container_`'s interactions with the model to account + // for it only holding unpinned tabs. + const std::unique_ptr<TabContainerController> + unpinned_tab_container_controller_; + // The TabContainer that holds the unpinned tabs. + const raw_ref<TabContainer> unpinned_tab_container_; + + base::RepeatingCallback<int()> available_width_callback_; +}; + +#endif // CHROME_BROWSER_UI_VIEWS_TABS_COMPOUND_TAB_CONTAINER_H_
diff --git a/chrome/browser/ui/views/tabs/compound_tab_container_unittest.cc b/chrome/browser/ui/views/tabs/compound_tab_container_unittest.cc new file mode 100644 index 0000000..f90d978 --- /dev/null +++ b/chrome/browser/ui/views/tabs/compound_tab_container_unittest.cc
@@ -0,0 +1,203 @@ +// Copyright 2022 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 "chrome/browser/ui/views/tabs/compound_tab_container.h" + +#include <memory> +#include "base/memory/raw_ref.h" +#include "chrome/browser/ui/layout_constants.h" +#include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h" +#include "chrome/browser/ui/views/tabs/fake_tab_slot_controller.h" +#include "chrome/browser/ui/views/tabs/tab_drag_context.h" +#include "chrome/test/views/chrome_views_test_base.h" +#include "ui/views/view_utils.h" +#include "ui/views/widget/widget.h" + +namespace { + +class FakeTabDragContext : public TabDragContextBase { + public: + FakeTabDragContext() = default; + ~FakeTabDragContext() override = default; + + void UpdateAnimationTarget(TabSlotView* tab_slot_view, + const gfx::Rect& target_bounds) override {} + bool IsDragSessionActive() const override { return false; } + bool IsEndingDrag() const override { return false; } + void FinishEndingDrag() override {} + int GetTabDragAreaWidth() const override { return width(); } +}; + +class FakeTabContainerController final : public TabContainerController { + public: + explicit FakeTabContainerController(TabStripController& tab_strip_controller) + : tab_strip_controller_(tab_strip_controller) {} + ~FakeTabContainerController() override = default; + + bool IsValidModelIndex(int index) const override { + return tab_strip_controller_->IsValidIndex(index); + } + + int GetActiveIndex() const override { + return tab_strip_controller_->GetActiveIndex(); + } + + int NumPinnedTabsInModel() const override { + for (size_t i = 0; + i < static_cast<size_t>(tab_strip_controller_->GetCount()); ++i) { + if (!tab_strip_controller_->IsTabPinned(static_cast<int>(i))) + return static_cast<int>(i); + } + + // All tabs are pinned. + return tab_strip_controller_->GetCount(); + } + + void OnDropIndexUpdate(int index, bool drop_before) override { + tab_strip_controller_->OnDropIndexUpdate(index, drop_before); + } + + bool IsGroupCollapsed(const tab_groups::TabGroupId& group) const override { + return tab_strip_controller_->IsGroupCollapsed(group); + } + + absl::optional<int> GetFirstTabInGroup( + const tab_groups::TabGroupId& group) const override { + return tab_strip_controller_->GetFirstTabInGroup(group); + } + + gfx::Range ListTabsInGroup( + const tab_groups::TabGroupId& group) const override { + return tab_strip_controller_->ListTabsInGroup(group); + } + + bool CanExtendDragHandle() const override { + return !tab_strip_controller_->IsFrameCondensed() && + !tab_strip_controller_->EverHasVisibleBackgroundTabShapes(); + } + + private: + const raw_ref<TabStripController> tab_strip_controller_; +}; +} // namespace + +class CompoundTabContainerTest : public ChromeViewsTestBase { + public: + CompoundTabContainerTest() = default; + CompoundTabContainerTest(const CompoundTabContainerTest&) = delete; + CompoundTabContainerTest& operator=(const CompoundTabContainerTest&) = delete; + ~CompoundTabContainerTest() override = default; + + void SetUp() override { + ChromeViewsTestBase::SetUp(); + + tab_strip_controller_ = std::make_unique<FakeBaseTabStripController>(); + tab_container_controller_ = std::make_unique<FakeTabContainerController>( + *(tab_strip_controller_.get())); + tab_slot_controller_ = + std::make_unique<FakeTabSlotController>(tab_strip_controller_.get()); + + std::unique_ptr<TabDragContextBase> drag_context = + std::make_unique<FakeTabDragContext>(); + std::unique_ptr<TabContainer> tab_container = + std::make_unique<CompoundTabContainer>( + raw_ref<TabContainerController>(*(tab_container_controller_.get())), + nullptr /*hover_card_controller*/, drag_context.get(), + *(tab_slot_controller_.get()), nullptr /*scroll_contents_view*/); + tab_container->SetAvailableWidthCallback(base::BindRepeating( + [](CompoundTabContainerTest* test) { + return test->tab_container_width_; + }, + this)); + + widget_ = CreateTestWidget(); + tab_container_ = + widget_->GetRootView()->AddChildView(std::move(tab_container)); + drag_context_ = + widget_->GetRootView()->AddChildView(std::move(drag_context)); + SetTabContainerWidth(1000); + + tab_slot_controller_->set_tab_container(tab_container_); + } + + void TearDown() override { + drag_context_ = nullptr; + tab_container_ = nullptr; + widget_.reset(); + tab_slot_controller_.reset(); + tab_container_controller_.reset(); + tab_strip_controller_.reset(); + + ChromeViewsTestBase::TearDown(); + } + + protected: + Tab* AddTab(int model_index, + absl::optional<tab_groups::TabGroupId> group = absl::nullopt, + TabActive active = TabActive::kInactive, + TabPinned pinned = TabPinned::kUnpinned) { + Tab* tab = tab_container_->AddTab( + std::make_unique<Tab>(tab_slot_controller_.get()), model_index, pinned); + tab_strip_controller_->AddTab(model_index, active == TabActive::kActive); + + if (active == TabActive::kActive) + tab_slot_controller_->set_active_tab(tab); + + if (group) { + NOTREACHED(); // TODO(crbug.com/1346017): copy/reuse more stuff from + // TabContainerTest + AddTabToGroup(model_index, group.value()); + } + + return tab; + } + + void AddTabToGroup(int model_index, tab_groups::TabGroupId group) { + tab_container_->GetTabAtModelIndex(model_index)->set_group(group); + tab_strip_controller_->AddTabToGroup(model_index, group); + + auto& group_views = tab_container_->GetGroupViews(); + if (group_views.find(group) == group_views.end()) + tab_container_->OnGroupCreated(group); + + tab_container_->OnGroupMoved(group); + } + + void SetTabContainerWidth(int width) { + tab_container_width_ = width; + gfx::Size size(tab_container_width_, GetLayoutConstant(TAB_HEIGHT)); + widget_->SetSize(size); + drag_context_->SetSize(size); + tab_container_->SetSize(size); + } + + std::unique_ptr<FakeBaseTabStripController> tab_strip_controller_; + std::unique_ptr<FakeTabContainerController> tab_container_controller_; + std::unique_ptr<FakeTabSlotController> tab_slot_controller_; + raw_ptr<TabDragContextBase> drag_context_; + raw_ptr<TabContainer> tab_container_; + std::unique_ptr<views::Widget> widget_; + + int tab_container_width_ = 0; +}; + +TEST_F(CompoundTabContainerTest, PinnedTabReparents) { + // Start with one tab, initially pinned. + Tab* const tab = + AddTab(0, absl::nullopt, TabActive::kInactive, TabPinned::kPinned); + TabContainer* const pinned_container = + views::AsViewClass<TabContainer>(tab->parent()); + ASSERT_NE(pinned_container, nullptr); + + // Unpin the tab and it should move to a new TabContainer. + tab_container_->SetTabPinned(0, TabPinned::kUnpinned); + TabContainer* const unpinned_container = + views::AsViewClass<TabContainer>(tab->parent()); + ASSERT_NE(unpinned_container, nullptr); + EXPECT_NE(pinned_container, unpinned_container); + + // Re-pin the tab and it should move back. + tab_container_->SetTabPinned(0, TabPinned::kPinned); + EXPECT_EQ(tab->parent(), pinned_container); +}
diff --git a/chrome/browser/ui/views/tabs/tab_container.h b/chrome/browser/ui/views/tabs/tab_container.h index 4c83fe7c..cc7c3da4 100644 --- a/chrome/browser/ui/views/tabs/tab_container.h +++ b/chrome/browser/ui/views/tabs/tab_container.h
@@ -46,6 +46,14 @@ virtual void SetActiveTab(absl::optional<size_t> prev_active_index, absl::optional<size_t> new_active_index) = 0; + // Transfer the tab at `model_index` our of this container so it can be + // parented elsewhere. Unlike RemoveTab, this method does not close the tab, + // but it does remove it from the layout viewmodel. + // TODO(crbug.com/1346023): Find a better name for this once the full suite of + // ownership-transferring methods is in place. + [[nodiscard]] virtual std::unique_ptr<Tab> TransferTabOut( + int model_index) = 0; + // `view` is no longer being dragged. This TabContainer takes ownership of it // in the view hierarchy. virtual void StoppedDraggingView(TabSlotView* view) = 0;
diff --git a/chrome/browser/ui/views/tabs/tab_container_controller.h b/chrome/browser/ui/views/tabs/tab_container_controller.h index 70e178ad..79bfd7b 100644 --- a/chrome/browser/ui/views/tabs/tab_container_controller.h +++ b/chrome/browser/ui/views/tabs/tab_container_controller.h
@@ -25,6 +25,11 @@ // Returns the index of the active tab. virtual int GetActiveIndex() const = 0; + // Returns the number of pinned tabs in the model. Note that this can be + // different from the number of pinned tabs in the TabStrip view (and its + // associated classes) when a tab is being opened, closed, pinned or unpinned. + virtual int NumPinnedTabsInModel() const = 0; + // Notifies controller of a drop index update. virtual void OnDropIndexUpdate(int index, bool drop_before) = 0;
diff --git a/chrome/browser/ui/views/tabs/tab_container_impl.cc b/chrome/browser/ui/views/tabs/tab_container_impl.cc index 1a4c164e..93641be5 100644 --- a/chrome/browser/ui/views/tabs/tab_container_impl.cc +++ b/chrome/browser/ui/views/tabs/tab_container_impl.cc
@@ -284,6 +284,13 @@ layout_helper_->SetActiveTab(prev_active_index, new_active_index); } +std::unique_ptr<Tab> TabContainerImpl::TransferTabOut(int model_index) { + Tab* tab = GetTabAtModelIndex(model_index); + RemoveTabFromViewModel(model_index); + // TODO(1346023): Properly animate the other tabs. + return RemoveChildViewT(tab); +} + void TabContainerImpl::StoppedDraggingView(TabSlotView* view) { AddChildView(view); Tab* tab = views::AsViewClass<Tab>(view);
diff --git a/chrome/browser/ui/views/tabs/tab_container_impl.h b/chrome/browser/ui/views/tabs/tab_container_impl.h index 408a2a4..7ac6d4f 100644 --- a/chrome/browser/ui/views/tabs/tab_container_impl.h +++ b/chrome/browser/ui/views/tabs/tab_container_impl.h
@@ -60,6 +60,7 @@ void SetActiveTab(absl::optional<size_t> prev_active_index, absl::optional<size_t> new_active_index) override; + std::unique_ptr<Tab> TransferTabOut(int model_index) override; void StoppedDraggingView(TabSlotView* view) override; void ScrollTabToVisible(int model_index) override;
diff --git a/chrome/browser/ui/views/tabs/tab_container_unittest.cc b/chrome/browser/ui/views/tabs/tab_container_unittest.cc index f130c6a..9c2ceb2d 100644 --- a/chrome/browser/ui/views/tabs/tab_container_unittest.cc +++ b/chrome/browser/ui/views/tabs/tab_container_unittest.cc
@@ -61,6 +61,17 @@ return tab_strip_controller_->GetActiveIndex(); } + int NumPinnedTabsInModel() const override { + for (size_t i = 0; + i < static_cast<size_t>(tab_strip_controller_->GetCount()); ++i) { + if (!tab_strip_controller_->IsTabPinned(static_cast<int>(i))) + return static_cast<int>(i); + } + + // All tabs are pinned. + return tab_strip_controller_->GetCount(); + } + void OnDropIndexUpdate(int index, bool drop_before) override { tab_strip_controller_->OnDropIndexUpdate(index, drop_before); }
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index f1aee4a..377c9b1 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -74,6 +74,7 @@ #include "components/tab_groups/tab_group_color.h" #include "components/tab_groups/tab_group_id.h" #include "components/tab_groups/tab_group_visual_data.h" +#include "compound_tab_container.h" #include "third_party/skia/include/core/SkColorFilter.h" #include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/pathops/SkPathOps.h" @@ -129,6 +130,19 @@ : ui::mojom::DragEventSource::kMouse; } +std::unique_ptr<TabContainer> MakeTabContainer( + TabStrip* tab_strip, + TabHoverCardController* hover_card_controller, + TabDragContext* drag_context) { + if (base::FeatureList::IsEnabled(features::kSplitTabStrip)) { + return std::make_unique<CompoundTabContainer>( + raw_ref<TabContainerController>(*tab_strip), hover_card_controller, + drag_context, *tab_strip, tab_strip); + } + return std::make_unique<TabContainerImpl>( + *tab_strip, hover_card_controller, drag_context, *tab_strip, tab_strip); +} + } // namespace /////////////////////////////////////////////////////////////////////////////// @@ -873,13 +887,11 @@ : controller_(std::move(controller)), hover_card_controller_(std::make_unique<TabHoverCardController>(this)), drag_context_(*AddChildView(std::make_unique<TabDragContextImpl>(this))), - tab_container_(*AddChildViewAt( - std::make_unique<TabContainerImpl>(*this, - hover_card_controller_.get(), - &*drag_context_, - *this, - this), - 0)) { + tab_container_( + *AddChildViewAt(MakeTabContainer(this, + hover_card_controller_.get(), + base::to_address(drag_context_)), + 0)) { // TODO(pbos): This is probably incorrect, the background of individual tabs // depend on their selected state. This should probably be pushed down into // tabs. @@ -1358,6 +1370,16 @@ return controller_->GetActiveIndex(); } +int TabStrip::NumPinnedTabsInModel() const { + for (size_t i = 0; i < static_cast<size_t>(controller_->GetCount()); ++i) { + if (!controller_->IsTabPinned(static_cast<int>(i))) + return static_cast<int>(i); + } + + // All tabs are pinned. + return controller_->GetCount(); +} + void TabStrip::OnDropIndexUpdate(int index, bool drop_before) { controller_->OnDropIndexUpdate(index, drop_before); }
diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h index 048ef045..68d3ca3 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.h +++ b/chrome/browser/ui/views/tabs/tab_strip.h
@@ -244,6 +244,7 @@ // TabContainerController: bool IsValidModelIndex(int index) const override; int GetActiveIndex() const override; + int NumPinnedTabsInModel() const override; void OnDropIndexUpdate(int index, bool drop_before) override; absl::optional<int> GetFirstTabInGroup( const tab_groups::TabGroupId& group) const override;
diff --git a/chrome/browser/ui/views/translate/partial_translate_bubble_view.cc b/chrome/browser/ui/views/translate/partial_translate_bubble_view.cc index ac05125a..705f66d 100644 --- a/chrome/browser/ui/views/translate/partial_translate_bubble_view.cc +++ b/chrome/browser/ui/views/translate/partial_translate_bubble_view.cc
@@ -629,7 +629,7 @@ // Title row. auto title_row = std::make_unique<views::View>(); title_row->SetLayoutManager(std::make_unique<views::FlexLayout>()); - int error_message_id = IDS_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE_TITLE; + int error_message_id = IDS_PARTIAL_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE_TITLE; auto error_message_label = std::make_unique<views::Label>( l10n_util::GetStringUTF16(error_message_id), views::style::CONTEXT_DIALOG_TITLE, views::style::STYLE_PRIMARY);
diff --git a/chrome/browser/ui/views/web_apps/web_app_detailed_install_dialog.cc b/chrome/browser/ui/views/web_apps/web_app_detailed_install_dialog.cc index bd60b45..57c8bc45b 100644 --- a/chrome/browser/ui/views/web_apps/web_app_detailed_install_dialog.cc +++ b/chrome/browser/ui/views/web_apps/web_app_detailed_install_dialog.cc
@@ -42,6 +42,7 @@ #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/image/image_skia.h" +#include "ui/gfx/text_elider.h" #include "ui/views/animation/bounds_animator.h" #include "ui/views/animation/ink_drop.h" #include "ui/views/background.h" @@ -303,7 +304,9 @@ auto title = install_info->title; auto start_url_host = install_info->start_url.host(); - auto description = install_info->description; + const std::u16string description = gfx::TruncateString( + install_info->description, webapps::kMaximumDescriptionLength, + gfx::CHARACTER_BREAK); auto delegate = std::make_unique<web_app::WebAppDetailedInstallDialogDelegate>( @@ -315,7 +318,10 @@ .SetIcon(ui::ImageModel::FromImageSkia(icon_image)) .SetTitle(title) .SetSubtitle(base::UTF8ToUTF16(start_url_host)) - .AddParagraph(ui::DialogModelLabel(description)) + .AddParagraph( + ui::DialogModelLabel(description).set_is_secondary(), + l10n_util::GetStringUTF16( + IDS_WEB_APP_DETAILED_INSTALL_DIALOG_DESCRIPTION_TITLE)) .AddOkButton( base::BindOnce( &web_app::WebAppDetailedInstallDialogDelegate::OnAccept,
diff --git a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest.cc b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest.cc index b8147e1..a9dc43be 100644 --- a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest.cc +++ b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest.cc
@@ -116,6 +116,12 @@ helper_.CheckWindowControlsOverlay(Site::kWco, IsOn::kOn); } +IN_PROC_BROWSER_TEST_F(WebAppIntegration, SwitchIncognitoProfile) { + helper_.SwitchIncognitoProfile(); + helper_.NavigateBrowser(Site::kStandalone); + helper_.CheckCreateShortcutNotShown(); +} + // Generated tests: IN_PROC_BROWSER_TEST_F(
diff --git a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_mac_win_linux.cc b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_mac_win_linux.cc index f3e9915..1001caf 100644 --- a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_mac_win_linux.cc +++ b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_mac_win_linux.cc
@@ -74,7 +74,7 @@ } IN_PROC_BROWSER_TEST_F(WebAppIntegration, CheckLaunchFileExpectDialog) { - helper_.InstallOmniboxIcon(InstallableSite::kFileHandler); + helper_.InstallMenuOption(InstallableSite::kFileHandler); helper_.ClosePwa(); helper_.LaunchFileExpectDialog(Site::kFileHandler, FilesOptions::kOneTextFile, AllowDenyOptions::kAllow,
diff --git a/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.cc b/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.cc index 4b0c49b..ceb20192b 100644 --- a/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.cc +++ b/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.cc
@@ -962,6 +962,85 @@ AfterStateChangeAction(); } +void WebAppIntegrationTestDriver::LaunchFileExpectDialog( + Site site, + FilesOptions files_options, + AllowDenyOptions allow_deny, + AskAgainOptions ask_again) { + BeforeStateChangeAction(__FUNCTION__); + AppId app_id = GetAppIdBySiteMode(site); + views::NamedWidgetShownWaiter waiter(views::test::AnyWidgetTestPasskey{}, + "FileHandlerLaunchDialogView"); + FileHandlerLaunchDialogView::SetDefaultRememberSelectionForTesting( + ask_again == AskAgainOptions::kRemember); + std::vector<base::FilePath> file_paths = GetTestFilePaths(files_options); + + StartupBrowserCreator browser_creator; + base::CommandLine command_line(base::CommandLine::NO_PROGRAM); + command_line.AppendSwitchASCII(switches::kAppId, app_id); + for (auto file_path : file_paths) { + command_line.AppendArgPath(file_path); + } + browser_creator.Start(command_line, profile()->GetPath(), + {profile(), StartupProfileMode::kBrowserWindow}, {}); + BrowserAddedWaiter browser_added_waiter; + + // Check the file handling dialog shows up. + views::Widget* widget = waiter.WaitIfNeededAndGet(); + ASSERT_TRUE(widget != nullptr); + + views::test::WidgetDestroyedWaiter destroyed_waiter(widget); + views::Widget::ClosedReason close_reason; + if (allow_deny == AllowDenyOptions::kDeny) { + close_reason = views::Widget::ClosedReason::kCancelButtonClicked; + if (ask_again == AskAgainOptions::kRemember) { + site_remember_deny_open_file.emplace(site); + } + } else { + close_reason = views::Widget::ClosedReason::kAcceptButtonClicked; + } + // File handling dialog should be destroyed after choosing the action. + widget->CloseWithReason(close_reason); + destroyed_waiter.Wait(); + + if (allow_deny == AllowDenyOptions::kAllow) { + browser_added_waiter.Wait(); + app_browser_ = browser_added_waiter.browser_added(); + ActivateBrowserAndWait(app_browser_); + EXPECT_EQ(app_browser()->app_controller()->app_id(), app_id); + } + AfterStateChangeAction(); +} + +void WebAppIntegrationTestDriver::LaunchFileExpectNoDialog( + Site site, + FilesOptions files_options) { + BeforeStateChangeAction(__FUNCTION__); + AppId app_id = GetAppIdBySiteMode(site); + std::vector<base::FilePath> file_paths = GetTestFilePaths(files_options); + BrowserAddedWaiter browser_added_waiter; + base::RunLoop run_loop; + + web_app::startup::SetStartupDoneCallbackForTesting(run_loop.QuitClosure()); + StartupBrowserCreator browser_creator; + base::CommandLine command_line(base::CommandLine::NO_PROGRAM); + command_line.AppendSwitchASCII(switches::kAppId, app_id); + for (auto file_path : file_paths) { + command_line.AppendArgPath(file_path); + } + browser_creator.Start(command_line, profile()->GetPath(), + {profile(), StartupProfileMode::kBrowserWindow}, {}); + run_loop.Run(); + + // if the web app doesn't deny to open the file, wait for the app window. + if (!base::Contains(site_remember_deny_open_file, site)) { + app_browser_ = browser_added_waiter.browser_added(); + ActivateBrowserAndWait(app_browser_); + EXPECT_EQ(app_browser()->app_controller()->app_id(), app_id); + } + AfterStateChangeAction(); +} + void WebAppIntegrationTestDriver::LaunchFromChromeApps(Site site) { if (!BeforeStateChangeAction(__FUNCTION__)) return; @@ -1428,6 +1507,16 @@ AfterStateChangeAction(); } +void WebAppIntegrationTestDriver::SwitchIncognitoProfile() { + BeforeStateChangeAction(__FUNCTION__); + content::WebContentsAddedObserver nav_observer; + CHECK(chrome::ExecuteCommand(browser(), IDC_NEW_INCOGNITO_WINDOW)); + ASSERT_EQ(1U, BrowserList::GetIncognitoBrowserCount()); + nav_observer.GetWebContents(); + active_browser_ = BrowserList::GetInstance()->GetLastActive(); + AfterStateChangeAction(); +} + void WebAppIntegrationTestDriver::SwitchProfileClients(ProfileClient client) { if (!BeforeStateChangeAction(__FUNCTION__)) return; @@ -1846,84 +1935,16 @@ AfterStateCheckAction(); } -void WebAppIntegrationTestDriver::LaunchFileExpectDialog( - Site site, - FilesOptions files_options, - AllowDenyOptions allow_deny, - AskAgainOptions ask_again) { - BeforeStateChangeAction(__FUNCTION__); - AppId app_id = GetAppIdBySiteMode(site); - views::NamedWidgetShownWaiter waiter(views::test::AnyWidgetTestPasskey{}, - "FileHandlerLaunchDialogView"); - FileHandlerLaunchDialogView::SetDefaultRememberSelectionForTesting( - ask_again == AskAgainOptions::kRemember); - std::vector<base::FilePath> file_paths = GetTestFilePaths(files_options); - - StartupBrowserCreator browser_creator; - base::CommandLine command_line(base::CommandLine::NO_PROGRAM); - command_line.AppendSwitchASCII(switches::kAppId, app_id); - for (auto file_path : file_paths) { - command_line.AppendArgPath(file_path); - } - browser_creator.Start(command_line, profile()->GetPath(), - {profile(), StartupProfileMode::kBrowserWindow}, {}); - BrowserAddedWaiter browser_added_waiter; - - // Check the file handling dialog shows up. - views::Widget* widget = waiter.WaitIfNeededAndGet(); - ASSERT_TRUE(widget != nullptr); - - views::test::WidgetDestroyedWaiter destroyed_waiter(widget); - views::Widget::ClosedReason close_reason; - if (allow_deny == AllowDenyOptions::kDeny) { - close_reason = views::Widget::ClosedReason::kCancelButtonClicked; - if (ask_again == AskAgainOptions::kRemember) { - site_remember_deny_open_file.emplace(site); - } - } else { - close_reason = views::Widget::ClosedReason::kAcceptButtonClicked; - } - // File handling dialog should be destroyed after choosing the action. - widget->CloseWithReason(close_reason); - destroyed_waiter.Wait(); - - if (allow_deny == AllowDenyOptions::kAllow) { - browser_added_waiter.Wait(); - app_browser_ = browser_added_waiter.browser_added(); - ActivateBrowserAndWait(app_browser_); - EXPECT_EQ(app_browser()->app_controller()->app_id(), app_id); - } - AfterStateChangeAction(); +void WebAppIntegrationTestDriver::CheckCreateShortcutNotShown() { + BeforeStateCheckAction(__FUNCTION__); + EXPECT_EQ(GetAppMenuCommandState(IDC_CREATE_SHORTCUT, browser()), kDisabled); + AfterStateCheckAction(); } -void WebAppIntegrationTestDriver::LaunchFileExpectNoDialog( - Site site, - FilesOptions files_options) { - BeforeStateChangeAction(__FUNCTION__); - AppId app_id = GetAppIdBySiteMode(site); - std::vector<base::FilePath> file_paths = GetTestFilePaths(files_options); - BrowserAddedWaiter browser_added_waiter; - base::RunLoop run_loop; - - web_app::startup::SetStartupDoneCallbackForTesting(run_loop.QuitClosure()); - StartupBrowserCreator browser_creator; - base::CommandLine command_line(base::CommandLine::NO_PROGRAM); - command_line.AppendSwitchASCII(switches::kAppId, app_id); - for (auto file_path : file_paths) { - command_line.AppendArgPath(file_path); - } - browser_creator.Start(command_line, profile()->GetPath(), - {profile(), StartupProfileMode::kBrowserWindow}, {}); - run_loop.Run(); - - // if the web app doesn't deny to open the file, wait for the app window. - if (!base::Contains(site_remember_deny_open_file, site)) { - app_browser_ = browser_added_waiter.browser_added(); - ActivateBrowserAndWait(app_browser_); - EXPECT_EQ(app_browser()->app_controller()->app_id(), app_id); - } - - AfterStateChangeAction(); +void WebAppIntegrationTestDriver::CheckCreateShortcutShown() { + BeforeStateCheckAction(__FUNCTION__); + EXPECT_EQ(GetAppMenuCommandState(IDC_CREATE_SHORTCUT, browser()), kEnabled); + AfterStateCheckAction(); } void WebAppIntegrationTestDriver::CheckWindowModeIsNotVisibleInAppSettings( @@ -2699,9 +2720,7 @@ NavigationMode mode) { DCHECK(browser()); content::WebContents* web_contents = GetCurrentTab(browser()); - auto* app_banner_manager = - webapps::TestAppBannerManagerDesktop::FromWebContents(web_contents); - + bool is_incognito = web_contents->GetBrowserContext()->IsOffTheRecord(); if (mode == NavigationMode::kNewTab) { ASSERT_TRUE(ui_test_utils::NavigateToURLWithDisposition( browser(), GURL(url), WindowOpenDisposition::NEW_FOREGROUND_TAB, @@ -2710,7 +2729,11 @@ } else { ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); } - app_banner_manager->WaitForInstallableCheck(); + if (!is_incognito) { + auto* app_banner_manager = + webapps::TestAppBannerManagerDesktop::FromWebContents(web_contents); + app_banner_manager->WaitForInstallableCheck(); + } } Browser* WebAppIntegrationTestDriver::GetAppBrowserForSite(
diff --git a/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.h b/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.h index a79c5e58..f1b4e39 100644 --- a/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.h +++ b/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.h
@@ -231,6 +231,11 @@ void ApplyRunOnOsLoginPolicyRunWindowed(Site site); void DeletePlatformShortcut(Site site); void RemoveRunOnOsLoginPolicy(Site site); + void LaunchFileExpectDialog(Site site, + FilesOptions files_options, + AllowDenyOptions allow_deny, + AskAgainOptions ask_again); + void LaunchFileExpectNoDialog(Site site, FilesOptions files_options); void LaunchFromChromeApps(Site site); void LaunchFromLaunchIcon(Site site); void LaunchFromMenuOption(Site site); @@ -248,6 +253,7 @@ void OpenInChrome(); void SetOpenInTab(Site site); void SetOpenInWindow(Site site); + void SwitchIncognitoProfile(); void SwitchProfileClients(ProfileClient client); void SyncTurnOff(); void SyncTurnOn(); @@ -267,11 +273,8 @@ void CheckAppNotInList(Site site); void CheckAppIcon(Site site, Color color); void CheckAppTitle(Site site, Title title); - void LaunchFileExpectDialog(Site site, - FilesOptions files_options, - AllowDenyOptions allow_deny, - AskAgainOptions ask_again); - void LaunchFileExpectNoDialog(Site site, FilesOptions files_options); + void CheckCreateShortcutNotShown(); + void CheckCreateShortcutShown(); void CheckWindowModeIsNotVisibleInAppSettings(Site site); void CheckInstallable(); void CheckInstallIconShown();
diff --git a/chrome/browser/ui/web_applications/web_app_ui_manager_impl.cc b/chrome/browser/ui/web_applications/web_app_ui_manager_impl.cc index f6478dd..518862c 100644 --- a/chrome/browser/ui/web_applications/web_app_ui_manager_impl.cc +++ b/chrome/browser/ui/web_applications/web_app_ui_manager_impl.cc
@@ -56,7 +56,6 @@ #if BUILDFLAG(IS_WIN) #include "base/process/process.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/ui/browser_list.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" #include "components/keep_alive_registry/keep_alive_types.h" #include "components/keep_alive_registry/scoped_keep_alive.h"
diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc index d6138afa8..414e121 100644 --- a/chrome/browser/ui/webui/about_ui.cc +++ b/chrome/browser/ui/webui/about_ui.cc
@@ -86,7 +86,6 @@ #if BUILDFLAG(IS_CHROMEOS) #include "chrome/common/webui_url_constants.h" -#include "ui/base/l10n/l10n_util.h" #endif // BUILDFLAG(IS_CHROMEOS) using content::BrowserThread;
diff --git a/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.cc b/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.cc index 2e34740c..a4d767c 100644 --- a/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.cc +++ b/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.cc
@@ -144,9 +144,9 @@ } ui::ModalType AccessCodeCastDialog::GetDialogModalType() const { - // If there are no web_contents_, that means that the dialog was launched - // from the system tray, so therefore it shuold be a system dialog. - return web_contents_ ? ui::MODAL_TYPE_NONE : ui::MODAL_TYPE_SYSTEM; + // Make our dialog have no modality, so it will always close if another + // window is focused. + return ui::MODAL_TYPE_NONE; } std::u16string AccessCodeCastDialog::GetDialogTitle() const {
diff --git a/chrome/browser/ui/webui/browser_command/browser_command_handler_unittest.cc b/chrome/browser/ui/webui/browser_command/browser_command_handler_unittest.cc index 2d5d95e..362768e 100644 --- a/chrome/browser/ui/webui/browser_command/browser_command_handler_unittest.cc +++ b/chrome/browser/ui/webui/browser_command/browser_command_handler_unittest.cc
@@ -456,13 +456,16 @@ // The StartTabGroupTutorial command should start the tab group tutorial. if // there are no tab groups in the tabstrip - command_handler_->SetBrowserHasTabGroups(false); - ClickInfoPtr info = ClickInfo::New(); - EXPECT_CALL(service, StartTutorial(kTabGroupTutorialId, kTestContext1, - testing::_, testing::_)) - .WillOnce(testing::Return(true)); - EXPECT_CALL(service, LogStartedFromWhatsNewPage(kTabGroupTutorialId, true)); - EXPECT_TRUE(ExecuteCommand(Command::kStartTabGroupTutorial, std::move(info))); + { + command_handler_->SetBrowserHasTabGroups(false); + ClickInfoPtr info = ClickInfo::New(); + EXPECT_CALL(service, StartTutorial(kTabGroupTutorialId, kTestContext1, + testing::_, testing::_)) + .WillOnce(testing::Return(true)); + EXPECT_CALL(service, LogStartedFromWhatsNewPage(kTabGroupTutorialId, true)); + EXPECT_TRUE( + ExecuteCommand(Command::kStartTabGroupTutorial, std::move(info))); + } // The StartTabGroupTutorial command should start the "existing tab groups" // tab group tutorial. if there are tab groups in the tabstrip
diff --git a/chrome/browser/ui/webui/chrome_web_contents_handler.cc b/chrome/browser/ui/webui/chrome_web_contents_handler.cc index 813cbbe5..781741c 100644 --- a/chrome/browser/ui/webui/chrome_web_contents_handler.cc +++ b/chrome/browser/ui/webui/chrome_web_contents_handler.cc
@@ -16,6 +16,7 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "content/public/browser/file_select_listener.h" #include "content/public/browser/web_contents.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" using content::BrowserContext; using content::OpenURLParams; @@ -85,7 +86,7 @@ std::unique_ptr<WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture) { if (!context) return; @@ -107,7 +108,7 @@ NavigateParams params(browser, std::move(new_contents)); params.source_contents = source; params.disposition = disposition; - params.window_bounds = initial_rect; + params.window_bounds = window_features.bounds; params.window_action = NavigateParams::SHOW_WINDOW; params.user_gesture = user_gesture; Navigate(¶ms);
diff --git a/chrome/browser/ui/webui/chrome_web_contents_handler.h b/chrome/browser/ui/webui/chrome_web_contents_handler.h index ffcb4289..b5c8988 100644 --- a/chrome/browser/ui/webui/chrome_web_contents_handler.h +++ b/chrome/browser/ui/webui/chrome_web_contents_handler.h
@@ -27,7 +27,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture) override; void RunFileChooser(content::RenderFrameHost* render_frame_host, scoped_refptr<content::FileSelectListener> listener,
diff --git a/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.cc index 49becfea..c7f057e 100644 --- a/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.cc +++ b/chrome/browser/ui/webui/chromeos/cellular_setup/mobile_setup_ui.cc
@@ -8,8 +8,6 @@ #include <memory> #include <string> - -#include <string> #include <vector> #include "base/bind.h"
diff --git a/chrome/browser/ui/webui/history_clusters/history_clusters_handler_unittest.cc b/chrome/browser/ui/webui/history_clusters/history_clusters_handler_unittest.cc index 87dad71c..3f1f622 100644 --- a/chrome/browser/ui/webui/history_clusters/history_clusters_handler_unittest.cc +++ b/chrome/browser/ui/webui/history_clusters/history_clusters_handler_unittest.cc
@@ -11,7 +11,6 @@ #include "base/test/bind.h" #include "base/time/time.h" #include "chrome/browser/search_engines/template_url_service_factory.h" -#include "chrome/browser/ui/webui/history_clusters/history_clusters_handler.h" #include "chrome/test/base/testing_profile.h" #include "components/history/core/browser/history_types.h" #include "components/history/core/browser/url_row.h"
diff --git a/chrome/browser/ui/webui/settings/settings_security_key_handler.cc b/chrome/browser/ui/webui/settings/settings_security_key_handler.cc index a36a6fd..119fec1 100644 --- a/chrome/browser/ui/webui/settings/settings_security_key_handler.cc +++ b/chrome/browser/ui/webui/settings/settings_security_key_handler.cc
@@ -17,7 +17,6 @@ #include "build/build_config.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" -#include "chrome/browser/ui/webui/settings/settings_security_key_handler.h" #include "chrome/browser/webauthn/cablev2_devices.h" #include "chrome/browser/webauthn/local_credential_management.h" #include "chrome/grit/generated_resources.h"
diff --git a/chrome/browser/ui/webui/settings/settings_ui.cc b/chrome/browser/ui/webui/settings/settings_ui.cc index ff86247..5b51935 100644 --- a/chrome/browser/ui/webui/settings/settings_ui.cc +++ b/chrome/browser/ui/webui/settings/settings_ui.cc
@@ -11,7 +11,6 @@ #include <utility> #include <vector> -#include "ash/constants/ash_features.h" #include "base/feature_list.h" #include "base/memory/ptr_util.h" #include "build/branding_buildflags.h"
diff --git a/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc index b129f4c7..536a49e 100644 --- a/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc
@@ -37,7 +37,6 @@ #include "ash/constants/ash_features.h" #include "chrome/browser/ash/crosapi/browser_util.h" #include "chrome/browser/nearby_sharing/common/nearby_share_features.h" -#include "chrome/common/url_constants.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/chrome/browser/ui/webui/signin/turn_sync_on_helper_browsertest.cc b/chrome/browser/ui/webui/signin/turn_sync_on_helper_browsertest.cc new file mode 100644 index 0000000..023b7b7 --- /dev/null +++ b/chrome/browser/ui/webui/signin/turn_sync_on_helper_browsertest.cc
@@ -0,0 +1,225 @@ +// Copyright 2022 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 <vector> + +#include "base/memory/ptr_util.h" +#include "base/memory/weak_ptr.h" +#include "base/run_loop.h" +#include "build/buildflag.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/signin_browser_test_base.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/webui/signin/turn_sync_on_helper.h" +#include "components/signin/public/identity_manager/account_info.h" +#include "components/signin/public/identity_manager/identity_manager.h" +#include "components/signin/public/identity_manager/identity_test_utils.h" +#include "content/public/test/browser_test.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace { + +class Delegate : public TurnSyncOnHelper::Delegate { + public: + enum class BlockingStep { + kNone, + kMergeData, + kEnterpriseManagement, + kSyncConfirmation, + kSyncDisabled, + }; + + struct Choices { + absl::optional<signin::SigninChoice> merge_data_choice = + signin::SIGNIN_CHOICE_CONTINUE; + absl::optional<signin::SigninChoice> enterprise_management_choice = + signin::SIGNIN_CHOICE_CONTINUE; + absl::optional<LoginUIService::SyncConfirmationUIClosedResult> + sync_optin_choice = LoginUIService::SYNC_WITH_DEFAULT_SETTINGS; + absl::optional<LoginUIService::SyncConfirmationUIClosedResult> + sync_disabled_choice = absl::nullopt; + }; + + using SyncConfirmationCallback = + base::OnceCallback<void(LoginUIService::SyncConfirmationUIClosedResult)>; + using CallbackVariant = + absl::variant<signin::SigninChoiceCallback, SyncConfirmationCallback>; + + explicit Delegate(Choices choices) : choices_(choices) {} + ~Delegate() override = default; + + // TurnSyncOnHelper::Delegate: + void ShowLoginError(const SigninUIError& error) override { NOTREACHED(); } + void ShowMergeSyncDataConfirmation( + const std::string& previous_email, + const std::string& new_email, + signin::SigninChoiceCallback callback) override { + AdvanceFlowOrCapture(BlockingStep::kMergeData, std::move(callback)); + } + void ShowEnterpriseAccountConfirmation( + const AccountInfo& account_info, + signin::SigninChoiceCallback callback) override { + AdvanceFlowOrCapture(BlockingStep::kEnterpriseManagement, + std::move(callback)); + } + void ShowSyncConfirmation(SyncConfirmationCallback callback) override { + AdvanceFlowOrCapture(BlockingStep::kSyncConfirmation, std::move(callback)); + } + void ShowSyncDisabledConfirmation( + bool is_managed_account, + SyncConfirmationCallback callback) override { + AdvanceFlowOrCapture(BlockingStep::kSyncDisabled, std::move(callback)); + } + void ShowSyncSettings() override { NOTREACHED(); } + void SwitchToProfile(Profile* new_profile) override { NOTREACHED(); } + + BlockingStep blocking_step() const { return blocking_step_; } + + base::WeakPtr<Delegate> GetWeakPtr() { + return weak_ptr_factory_.GetWeakPtr(); + } + + // Call this function when the delegate is blocked, with new `choices` that + // should now unblock it. + void UpdateChoicesAndAdvanceFlow(Choices choices) { + auto blocking_step = blocking_step_; + ASSERT_NE(BlockingStep::kNone, blocking_step) + << "UpdateChoicesAndAdvanceFlow() expects to be called while the " + "delegate is blocked."; + choices_ = choices; + blocking_step_ = BlockingStep::kNone; + + switch (blocking_step) { + case BlockingStep::kNone: + NOTREACHED(); + break; + case BlockingStep::kMergeData: + ASSERT_TRUE(choices_.merge_data_choice.has_value()); + std::move(absl::get<signin::SigninChoiceCallback>(blocking_callback_)) + .Run(*choices_.merge_data_choice); + break; + case BlockingStep::kEnterpriseManagement: + ASSERT_TRUE(choices_.enterprise_management_choice.has_value()); + std::move(absl::get<signin::SigninChoiceCallback>(blocking_callback_)) + .Run(*choices_.enterprise_management_choice); + break; + case BlockingStep::kSyncConfirmation: + ASSERT_TRUE(choices_.sync_optin_choice.has_value()); + std::move(absl::get<SyncConfirmationCallback>(blocking_callback_)) + .Run(*choices_.sync_optin_choice); + break; + case BlockingStep::kSyncDisabled: + ASSERT_TRUE(choices_.sync_disabled_choice.has_value()); + std::move(absl::get<SyncConfirmationCallback>(blocking_callback_)) + .Run(*choices_.sync_disabled_choice); + break; + } + } + + private: + void AdvanceFlowOrCapture(BlockingStep step, CallbackVariant callback) { + switch (step) { + case BlockingStep::kNone: + NOTREACHED(); + break; + case BlockingStep::kMergeData: + if (!choices_.merge_data_choice.has_value()) + break; + std::move(absl::get<signin::SigninChoiceCallback>(callback)) + .Run(*choices_.merge_data_choice); + return; + case BlockingStep::kEnterpriseManagement: + if (!choices_.enterprise_management_choice.has_value()) + break; + std::move(absl::get<signin::SigninChoiceCallback>(callback)) + .Run(*choices_.enterprise_management_choice); + return; + case BlockingStep::kSyncConfirmation: + if (!choices_.sync_optin_choice.has_value()) + break; + std::move(absl::get<SyncConfirmationCallback>(callback)) + .Run(*choices_.sync_optin_choice); + return; + case BlockingStep::kSyncDisabled: + if (!choices_.sync_disabled_choice.has_value()) + break; + std::move(absl::get<SyncConfirmationCallback>(callback)) + .Run(*choices_.sync_disabled_choice); + return; + } + + blocking_step_ = step; + blocking_callback_ = std::move(callback); + } + + Choices choices_; + + BlockingStep blocking_step_ = BlockingStep::kNone; + CallbackVariant blocking_callback_; + + base::WeakPtrFactory<Delegate> weak_ptr_factory_{this}; +}; + +} // namespace + +class TurnSyncOnHelperBrowserTest : public SigninBrowserTestBase {}; + +#if BUILDFLAG(IS_CHROMEOS_LACROS) +// TODO(https://crbug.com/1344165): Support resetting the primary account. +#define MAYBE_PrimaryAccountResetAfterSyncOptInFlowAborted \ + DISABLED_PrimaryAccountResetAfterSyncOptInFlowAborted +#else +#define MAYBE_PrimaryAccountResetAfterSyncOptInFlowAborted \ + PrimaryAccountResetAfterSyncOptInFlowAborted +#endif +// Tests that aborting a Sync opt-in flow started with a secondary account +// reverts the primary account to the initial one. +IN_PROC_BROWSER_TEST_F(TurnSyncOnHelperBrowserTest, + MAYBE_PrimaryAccountResetAfterSyncOptInFlowAborted) { + Profile* profile = browser()->profile(); + auto accounts_info = + SetAccounts({"primary@gmail.com", "secondary@gmail.com"}); + auto primary_account_id = accounts_info[0].account_id; + auto secondary_account_id = accounts_info[1].account_id; + + ASSERT_EQ(signin::ConsentLevel::kSignin, + signin::GetPrimaryAccountConsentLevel(identity_manager())); + ASSERT_EQ(primary_account_id, identity_manager()->GetPrimaryAccountId( + signin::ConsentLevel::kSignin)); + + Delegate::Choices choices = {.sync_optin_choice = absl::nullopt}; + auto owned_delegate = std::make_unique<Delegate>(choices); + base::WeakPtr<Delegate> delegate = owned_delegate->GetWeakPtr(); + base::RunLoop run_loop; + new TurnSyncOnHelper( + profile, signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN, + signin_metrics::PromoAction::PROMO_ACTION_NO_SIGNIN_PROMO, + signin_metrics::Reason::kUnknownReason, secondary_account_id, + TurnSyncOnHelper::SigninAbortedMode::KEEP_ACCOUNT, + std::move(owned_delegate), run_loop.QuitClosure()); + + EXPECT_EQ(Delegate::BlockingStep::kSyncConfirmation, + delegate->blocking_step()); + EXPECT_EQ(signin::ConsentLevel::kSync, + signin::GetPrimaryAccountConsentLevel(identity_manager())); + EXPECT_EQ(secondary_account_id, identity_manager()->GetPrimaryAccountId( + signin::ConsentLevel::kSignin)); + + choices.sync_optin_choice = LoginUIService::ABORT_SYNC; + delegate->UpdateChoicesAndAdvanceFlow(choices); + + // The flow should complete and destroy the delegate and TurnSyncOnHelper. + EXPECT_FALSE(delegate); + run_loop.Run(); + + // Account consistency (via `SigninManager`) should kick in via a posted task + // and reset the PrimaryAccount. + base::RunLoop().RunUntilIdle(); + + EXPECT_EQ(signin::ConsentLevel::kSignin, + signin::GetPrimaryAccountConsentLevel(identity_manager())); + EXPECT_EQ(primary_account_id, identity_manager()->GetPrimaryAccountId( + signin::ConsentLevel::kSignin)); +}
diff --git a/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc b/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc index 2001607c..ea5ab953 100644 --- a/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc +++ b/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc
@@ -20,6 +20,7 @@ #include "content/public/test/web_contents_tester.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" #include "ui/gfx/geometry/rect.h" #include "url/gurl.h" @@ -93,7 +94,8 @@ WebContentsTester::CreateTestWebContents(profile(), nullptr); test_web_contents_delegate_->AddNewContents( nullptr, std::move(contents), GURL(), - WindowOpenDisposition::NEW_FOREGROUND_TAB, gfx::Rect(), false, nullptr); + WindowOpenDisposition::NEW_FOREGROUND_TAB, blink::mojom::WindowFeatures(), + false, nullptr); // This should create a new foreground tab in the existing browser. EXPECT_EQ(1, browser()->tab_strip_model()->count()); EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); @@ -111,7 +113,7 @@ ui::PAGE_TRANSITION_LINK, false)); test_web_contents_delegate_->AddNewContents( nullptr, nullptr, url, WindowOpenDisposition::NEW_FOREGROUND_TAB, - gfx::Rect(), false, nullptr); + blink::mojom::WindowFeatures(), false, nullptr); EXPECT_EQ(0, browser()->tab_strip_model()->count()); EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); }
diff --git a/chrome/browser/web_applications/BUILD.gn b/chrome/browser/web_applications/BUILD.gn index 05d3fe2..256562e7 100644 --- a/chrome/browser/web_applications/BUILD.gn +++ b/chrome/browser/web_applications/BUILD.gn
@@ -53,8 +53,8 @@ "file_utils_wrapper.h", "install_bounce_metric.cc", "install_bounce_metric.h", - "isolated_web_apps/install_isolated_app_from_command_line_flag.cc", - "isolated_web_apps/install_isolated_app_from_command_line_flag.h", + "isolated_web_apps/install_isolated_app_from_command_line.cc", + "isolated_web_apps/install_isolated_app_from_command_line.h", "isolation_prefs_utils.cc", "isolation_prefs_utils.h", "locks/app_lock.cc", @@ -514,7 +514,7 @@ "external_install_options_unittest.cc", "externally_managed_app_manager_impl_unittest.cc", "externally_managed_app_manager_unittest.cc", - "isolated_web_apps/install_isolated_app_from_command_line_flag_unittest.cc", + "isolated_web_apps/install_isolated_app_from_command_line_unittest.cc", "isolation_prefs_utils_unittest.cc", "manifest_update_task_unittest.cc", "os_integration/os_integration_manager_unittest.cc",
diff --git a/chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line_flag.cc b/chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line.cc similarity index 91% rename from chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line_flag.cc rename to chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line.cc index 3a40272..9b4cc0b 100644 --- a/chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line_flag.cc +++ b/chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line_flag.h" +#include "chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line.h" #include <memory> #include <string> @@ -81,7 +81,7 @@ base::SplitResult::SPLIT_WANT_NONEMPTY); } -void InstallAppFromCommandLine( +void MaybeInstallAppFromCommandLine( const base::CommandLine& command_line, base::RepeatingCallback<void(base::StringPiece url)> install_application_from_url) { @@ -90,10 +90,10 @@ } } -void InstallAppFromCommandLine(const base::CommandLine& command_line, - Profile& profile) { - InstallAppFromCommandLine(command_line, - CreateProductionInstallApplicationFromUrl(profile)); +void MaybeInstallAppFromCommandLine(const base::CommandLine& command_line, + Profile& profile) { + MaybeInstallAppFromCommandLine( + command_line, CreateProductionInstallApplicationFromUrl(profile)); } } // namespace web_app
diff --git a/chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line_flag.h b/chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line.h similarity index 70% rename from chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line_flag.h rename to chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line.h index 1440482..d3413351 100644 --- a/chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line_flag.h +++ b/chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_WEB_APPLICATIONS_ISOLATED_WEB_APPS_INSTALL_ISOLATED_APP_FROM_COMMAND_LINE_FLAG_H_ -#define CHROME_BROWSER_WEB_APPLICATIONS_ISOLATED_WEB_APPS_INSTALL_ISOLATED_APP_FROM_COMMAND_LINE_FLAG_H_ +#ifndef CHROME_BROWSER_WEB_APPLICATIONS_ISOLATED_WEB_APPS_INSTALL_ISOLATED_APP_FROM_COMMAND_LINE_H_ +#define CHROME_BROWSER_WEB_APPLICATIONS_ISOLATED_WEB_APPS_INSTALL_ISOLATED_APP_FROM_COMMAND_LINE_H_ #include <string> #include <vector> @@ -19,9 +19,9 @@ std::vector<std::string> GetAppsToInstallFromCommandLine( const base::CommandLine& command_line); -void InstallAppFromCommandLine(const base::CommandLine& command_line, - Profile& profile); +void MaybeInstallAppFromCommandLine(const base::CommandLine& command_line, + Profile& profile); } // namespace web_app -#endif // CHROME_BROWSER_WEB_APPLICATIONS_ISOLATED_WEB_APPS_INSTALL_ISOLATED_APP_FROM_COMMAND_LINE_FLAG_H_ +#endif // CHROME_BROWSER_WEB_APPLICATIONS_ISOLATED_WEB_APPS_INSTALL_ISOLATED_APP_FROM_COMMAND_LINE_H_
diff --git a/chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line_flag_unittest.cc b/chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line_unittest.cc similarity index 98% rename from chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line_flag_unittest.cc rename to chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line_unittest.cc index 86b5e29..03848364 100644 --- a/chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line_flag_unittest.cc +++ b/chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line_flag.h" +#include "chrome/browser/web_applications/isolated_web_apps/install_isolated_app_from_command_line.h" #include <string> #include <vector>
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index 0faf85f..da2d969 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc
@@ -559,26 +559,27 @@ base::Value::Dict value; value.Set( "content", - absl::visit( - base::Overloaded{ - [](const WebApp::IsolationData::InstalledBundle& bundle) { - base::Value::Dict content; - content.SetByDottedPath("installed_bundle.path", bundle.path); - return content; - }, - [](const WebApp::IsolationData::DevModeBundle& bundle) { - base::Value::Dict content; - content.SetByDottedPath("dev_mode_bundle.path", bundle.path); - return content; - }, - [](const WebApp::IsolationData::DevModeProxy& proxy) { - base::Value::Dict content; - content.SetByDottedPath("dev_mode_proxy.proxy_url", - proxy.proxy_url); - return content; - }, - }, - content)); + absl::visit(base::Overloaded{ + [](const WebApp::IsolationData::InstalledBundle& bundle) { + base::Value::Dict content_dict; + content_dict.SetByDottedPath("installed_bundle.path", + bundle.path); + return content_dict; + }, + [](const WebApp::IsolationData::DevModeBundle& bundle) { + base::Value::Dict content_dict; + content_dict.SetByDottedPath("dev_mode_bundle.path", + bundle.path); + return content_dict; + }, + [](const WebApp::IsolationData::DevModeProxy& proxy) { + base::Value::Dict content_dict; + content_dict.SetByDottedPath("dev_mode_proxy.proxy_url", + proxy.proxy_url); + return content_dict; + }, + }, + content)); return base::Value(std::move(value)); }
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index be78b53..8ce09d9 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1661428458-36b1c3e1f19082ebe3c36dccc7975c4d058522e8.profdata +chrome-linux-main-1661450197-76108fb38390485e9bbaa9e184c79f97378633cd.profdata
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index 021f43d..7a8bf04 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1661428458-ce280f925349fbc79bf216ab7fe81d44e06f9f37.profdata +chrome-mac-arm-main-1661450197-fb6b901f4fadf1e266563faa93478c68d60aecf6.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 0f50a9c..8f639b88 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1661428458-da3ec051db3857bae55fcdc227dc2d50881cbba3.profdata +chrome-mac-main-1661450197-4fbcdf85ff560e77ddd02711f9e0ea6df0c24a61.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 1844748..f3679d7 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1661439478-10d286446d6cb29eeeabc5a47c3b11e9cd5af5f5.profdata +chrome-win64-main-1661461170-63f0a398da884cfbd84cc722bdd5870dc165cd34.profdata
diff --git a/chrome/common/extensions/manifest_handlers/settings_overrides_handler.cc b/chrome/common/extensions/manifest_handlers/settings_overrides_handler.cc index bb41f19..2b66c06 100644 --- a/chrome/common/extensions/manifest_handlers/settings_overrides_handler.cc +++ b/chrome/common/extensions/manifest_handlers/settings_overrides_handler.cc
@@ -30,18 +30,18 @@ namespace extensions { namespace { -std::unique_ptr<GURL> CreateManifestURL(const std::string& url) { - std::unique_ptr<GURL> manifest_url(new GURL(url)); +absl::optional<GURL> CreateManifestURL(const std::string& url) { + absl::optional<GURL> manifest_url(absl::in_place, url); if (!manifest_url->is_valid() || !manifest_url->SchemeIsHTTPOrHTTPS()) - return nullptr; + return absl::nullopt; return manifest_url; } -std::unique_ptr<GURL> ParseHomepage(const ChromeSettingsOverrides& overrides, - std::u16string* error) { +absl::optional<GURL> ParseHomepage(const ChromeSettingsOverrides& overrides, + std::u16string* error) { if (!overrides.homepage) - return nullptr; - std::unique_ptr<GURL> manifest_url = CreateManifestURL(*overrides.homepage); + return absl::nullopt; + absl::optional<GURL> manifest_url = CreateManifestURL(*overrides.homepage); if (!manifest_url) { *error = extensions::ErrorUtils::FormatErrorMessageUTF16( manifest_errors::kInvalidHomepageOverrideURL, *overrides.homepage); @@ -58,31 +58,30 @@ for (std::vector<std::string>::const_iterator i = overrides.startup_pages->begin(); i != overrides.startup_pages->end(); ++i) { - std::unique_ptr<GURL> manifest_url = CreateManifestURL(*i); + absl::optional<GURL> manifest_url = CreateManifestURL(*i); if (!manifest_url) { *error = extensions::ErrorUtils::FormatErrorMessageUTF16( manifest_errors::kInvalidStartupOverrideURL, *i); } else { - urls.push_back(GURL()); - urls.back().Swap(manifest_url.get()); + urls.push_back(std::move(*manifest_url)); } } return urls; } -std::unique_ptr<ChromeSettingsOverrides::SearchProvider> ParseSearchEngine( +absl::optional<ChromeSettingsOverrides::SearchProvider> ParseSearchEngine( ChromeSettingsOverrides* overrides, std::u16string* error) { if (!overrides->search_provider) - return nullptr; + return absl::nullopt; if (!CreateManifestURL(overrides->search_provider->search_url)) { *error = extensions::ErrorUtils::FormatErrorMessageUTF16( manifest_errors::kInvalidSearchEngineURL, overrides->search_provider->search_url); - return nullptr; + return absl::nullopt; } if (overrides->search_provider->prepopulated_id) - return std::move(overrides->search_provider); + return std::move(*overrides->search_provider); auto get_missing_key_error = [](const char* missing_key) { return extensions::ErrorUtils::FormatErrorMessageUTF16( @@ -91,27 +90,27 @@ if (!overrides->search_provider->name) { *error = get_missing_key_error("name"); - return nullptr; + return absl::nullopt; } if (!overrides->search_provider->keyword) { *error = get_missing_key_error("keyword"); - return nullptr; + return absl::nullopt; } if (!overrides->search_provider->encoding) { *error = get_missing_key_error("encoding"); - return nullptr; + return absl::nullopt; } if (!overrides->search_provider->favicon_url) { *error = get_missing_key_error("favicon_url"); - return nullptr; + return absl::nullopt; } if (!CreateManifestURL(*overrides->search_provider->favicon_url)) { *error = extensions::ErrorUtils::FormatErrorMessageUTF16( manifest_errors::kInvalidSearchEngineURL, *overrides->search_provider->favicon_url); - return nullptr; + return absl::nullopt; } - return std::move(overrides->search_provider); + return std::move(*overrides->search_provider); } std::string FormatUrlForDisplay(const GURL& url) {
diff --git a/chrome/common/extensions/manifest_handlers/settings_overrides_handler.h b/chrome/common/extensions/manifest_handlers/settings_overrides_handler.h index 7514668d..0366ad4 100644 --- a/chrome/common/extensions/manifest_handlers/settings_overrides_handler.h +++ b/chrome/common/extensions/manifest_handlers/settings_overrides_handler.h
@@ -5,11 +5,10 @@ #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_SETTINGS_OVERRIDES_HANDLER_H_ #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_SETTINGS_OVERRIDES_HANDLER_H_ -#include <memory> - #include "chrome/common/extensions/api/manifest_types.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_handler.h" +#include "third_party/abseil-cpp/absl/types/optional.h" namespace extensions { @@ -32,9 +31,9 @@ static const SettingsOverrides* Get(const Extension* extension); - std::unique_ptr<api::manifest_types::ChromeSettingsOverrides::SearchProvider> + absl::optional<api::manifest_types::ChromeSettingsOverrides::SearchProvider> search_engine; - std::unique_ptr<GURL> homepage; + absl::optional<GURL> homepage; std::vector<GURL> startup_pages; };
diff --git a/chrome/common/extensions/manifest_handlers/settings_overrides_handler_unittest.cc b/chrome/common/extensions/manifest_handlers/settings_overrides_handler_unittest.cc index 12f8bae..90d584c 100644 --- a/chrome/common/extensions/manifest_handlers/settings_overrides_handler_unittest.cc +++ b/chrome/common/extensions/manifest_handlers/settings_overrides_handler_unittest.cc
@@ -164,8 +164,7 @@ ASSERT_TRUE(settings_override); ASSERT_TRUE(settings_override->search_engine); EXPECT_TRUE(settings_override->search_engine->is_default); - const ChromeSettingsOverrides::SearchProvider* search_engine = - settings_override->search_engine.get(); + const auto& search_engine = settings_override->search_engine; EXPECT_EQ("first", *search_engine->name); EXPECT_EQ("firstkey", *search_engine->keyword); EXPECT_EQ("http://www.foo.com/s?q={searchTerms}", search_engine->search_url); @@ -199,8 +198,7 @@ ASSERT_TRUE(settings_override); ASSERT_TRUE(settings_override->search_engine); EXPECT_TRUE(settings_override->search_engine->is_default); - const ChromeSettingsOverrides::SearchProvider* search_engine = - settings_override->search_engine.get(); + const auto& search_engine = settings_override->search_engine; ASSERT_TRUE(search_engine->prepopulated_id); EXPECT_EQ("http://www.foo.com/s?q={searchTerms}", search_engine->search_url); EXPECT_EQ(3, *search_engine->prepopulated_id);
diff --git a/chrome/common/profiler/thread_profiler_configuration.cc b/chrome/common/profiler/thread_profiler_configuration.cc index d06c4f33..2b506cee 100644 --- a/chrome/common/profiler/thread_profiler_configuration.cc +++ b/chrome/common/profiler/thread_profiler_configuration.cc
@@ -207,6 +207,8 @@ platform_configuration.GetEnableRates(release_channel); CHECK_EQ(0, relative_populations.experiment % 2); + DCHECK_EQ(100, + relative_populations.enabled + relative_populations.experiment); return ChooseVariationGroup({ {kProfileEnabled, relative_populations.enabled}, {kProfileControl, relative_populations.experiment / 2},
diff --git a/chrome/common/profiler/thread_profiler_platform_configuration.cc b/chrome/common/profiler/thread_profiler_platform_configuration.cc index e6fef94..3be5ae86 100644 --- a/chrome/common/profiler/thread_profiler_platform_configuration.cc +++ b/chrome/common/profiler/thread_profiler_platform_configuration.cc
@@ -132,8 +132,9 @@ DCHECK(*release_channel == version_info::Channel::CANARY || *release_channel == version_info::Channel::DEV); - // Use a 50/50 experiment to maximize signal in the relevant metrics. - return RelativePopulations{0, 50}; + // Put all users in 50/50 experiment groups to maximize signal in the relevant + // metrics. + return RelativePopulations{0, 100}; } double AndroidPlatformConfiguration::GetChildProcessEnableFraction(
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 601f53e..b8a3ca9 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -2059,6 +2059,8 @@ "../browser/signin/e2e_tests/live_test.cc", "../browser/signin/e2e_tests/live_test.h", "../browser/signin/remove_local_account_browsertest.cc", + "../browser/signin/signin_browser_test_base.cc", + "../browser/signin/signin_browser_test_base.h", "../browser/site_isolation/chrome_site_per_process_browsertest.cc", "../browser/site_isolation/chrome_site_per_process_test.cc", "../browser/site_isolation/chrome_site_per_process_test.h", @@ -4375,6 +4377,7 @@ # Tests for non mobile and non CrOS (includes Linux, Win, Mac). "../browser/extensions/api/image_writer_private/image_writer_utility_client_browsertest.cc", "../browser/profiles/profile_statistics_browsertest.cc", + "../browser/ui/webui/signin/turn_sync_on_helper_browsertest.cc", ] if (!is_chromeos_lacros) { @@ -8676,6 +8679,7 @@ "../browser/ui/views/side_panel/user_note/user_note_ui_coordinator_unittest.cc", "../browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views_unittest.cc", "../browser/ui/views/tabs/color_picker_view_unittest.cc", + "../browser/ui/views/tabs/compound_tab_container_unittest.cc", "../browser/ui/views/tabs/fake_base_tab_strip_controller.cc", "../browser/ui/views/tabs/fake_base_tab_strip_controller.h", "../browser/ui/views/tabs/fake_tab_slot_controller.cc",
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 0d728bc..84bffec 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc
@@ -150,15 +150,14 @@ // and this will catch that case. auto* contents = dialog->web_contents(); bool found_disabled_for_testing = false; - contents->GetPrimaryMainFrame()->ForEachRenderFrameHost(base::BindRepeating( - [](bool* found_disabled_for_testing, content::RenderFrameHost* frame) { + contents->GetPrimaryMainFrame()->ForEachRenderFrameHostWithAction( + [&found_disabled_for_testing](content::RenderFrameHost* frame) { if (frame->IsBeforeUnloadHangMonitorDisabledForTesting()) { - *found_disabled_for_testing = true; + found_disabled_for_testing = true; return content::RenderFrameHost::FrameIterationAction::kStop; } return content::RenderFrameHost::FrameIterationAction::kContinue; - }, - &found_disabled_for_testing)); + }); ASSERT_TRUE(found_disabled_for_testing) << "If waiting for a beforeunload dialog, the beforeunload timer "
diff --git a/chrome/test/chromedriver/chrome/chrome_impl.cc b/chrome/test/chromedriver/chrome/chrome_impl.cc index 4a963a4..6801f6a 100644 --- a/chrome/test/chromedriver/chrome/chrome_impl.cc +++ b/chrome/test/chromedriver/chrome/chrome_impl.cc
@@ -676,7 +676,7 @@ base::TimeTicks deadline = base::TimeTicks::Now() + base::Seconds(20); while (base::TimeTicks::Now() < deadline) { WebViewsInfo views_info; - Status status = GetWebViewsInfo(&views_info); + status = GetWebViewsInfo(&views_info); if (status.code() == kChromeNotReachable) return Status(kOk); if (status.code() == kDisconnected) // The closed target has gone
diff --git a/chrome/test/chromedriver/session_commands.cc b/chrome/test/chromedriver/session_commands.cc index 2e84853..b5106e64 100644 --- a/chrome/test/chromedriver/session_commands.cc +++ b/chrome/test/chromedriver/session_commands.cc
@@ -361,7 +361,7 @@ if (session->webSocketUrl) { WebView* web_view = nullptr; - Status status = session->GetTargetWindow(&web_view); + status = session->GetTargetWindow(&web_view); if (status.IsError()) return status; ChromeImpl* chrome = static_cast<ChromeImpl*>(session->chrome.get());
diff --git a/chrome/test/data/webui/chromeos/personalization_app/user_preview_element_test.ts b/chrome/test/data/webui/chromeos/personalization_app/user_preview_element_test.ts index 8a43350..40d3a5a 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/user_preview_element_test.ts +++ b/chrome/test/data/webui/chromeos/personalization_app/user_preview_element_test.ts
@@ -114,6 +114,29 @@ 'blob url is shown for external image'); }); + test('displays placeholder image if user image is unavailable', async () => { + userPreviewElement = initElement(UserPreview, {path: Paths.ROOT}); + await waitAfterNextRender(userPreviewElement!); + + const avatarImage = userPreviewElement!.shadowRoot!.getElementById( + 'avatar') as HTMLImageElement; + assertEquals( + 'chrome://theme/IDR_PROFILE_AVATAR_PLACEHOLDER_LARGE', avatarImage.src, + 'placeholder image is shown if user image is unavailable'); + }); + + test('displays placeholder image if user image is invalid', async () => { + personalizationStore.data.user.image = {invalidImage: {}}; + userPreviewElement = initElement(UserPreview, {path: Paths.ROOT}); + await waitAfterNextRender(userPreviewElement!); + + const avatarImage = userPreviewElement!.shadowRoot!.getElementById( + 'avatar') as HTMLImageElement; + assertEquals( + 'chrome://theme/IDR_PROFILE_AVATAR_PLACEHOLDER_LARGE', avatarImage.src, + 'placeholder image is shown for invalid user image'); + }); + test('displays non-clickable user image on user subpage', async () => { personalizationStore.data.user.image = userProvider.image; userPreviewElement = initElement(UserPreview, {path: Paths.USER});
diff --git a/chrome/test/data/webui/chromeos/print_management/print_management_test.js b/chrome/test/data/webui/chromeos/print_management/print_management_test.js index c689915..c84828f 100644 --- a/chrome/test/data/webui/chromeos/print_management/print_management_test.js +++ b/chrome/test/data/webui/chromeos/print_management/print_management_test.js
@@ -11,6 +11,23 @@ import {flushTasks} from 'chrome://test/test_util.js'; /** + * Returns the match for |selector| in |element|'s shadow DOM. + * @param {element} Element + * @param {selector} string + * @return {!Element | null} + */ +function querySelector(element, selector) { + if (!element) { + return null; + } + if (!element.shadowRoot) { + return null; + } + + return element.shadowRoot.querySelector(selector); +} + +/** * Converts a JS string to mojo_base::mojom::String16 object. * @param {string} str * @return {!object} @@ -144,7 +161,7 @@ * @return {!Array<!HTMLElement>} */ function getHistoryPrintJobEntries(page) { - const entryList = page.$$('#entryList'); + const entryList = querySelector(page, '#entryList'); return Array.from( entryList.querySelectorAll('print-job-entry:not([hidden])')); } @@ -154,8 +171,8 @@ * @return {!Array<!HTMLElement>} */ function getOngoingPrintJobEntries(page) { - assertTrue(page.$$('#ongoingEmptyState').hidden); - const entryList = page.$$('#ongoingList'); + assertTrue(querySelector(page, '#ongoingEmptyState').hidden); + const entryList = querySelector(page, '#ongoingList'); return Array.from( entryList.querySelectorAll('print-job-entry:not([hidden])')); } @@ -418,7 +435,8 @@ jobEntryElement, mojoApi, shouldAttemptCancel, expectedHistoryList) { mojoApi.setShouldAttemptCancel(shouldAttemptCancel); - const cancelButton = jobEntryElement.$$('#cancelPrintJobButton'); + const cancelButton = + querySelector(jobEntryElement, '#cancelPrintJobButton'); cancelButton.click(); return mojoApi.whenCalled('cancelPrintJob').then(() => { // Create copy of |jobEntryElement.jobEntry| to modify. @@ -455,7 +473,7 @@ return mojoApi_.whenCalled('getPrintJobHistoryExpirationPeriod'); }) .then(() => { - const historyInfoTooltip = page.$$('paper-tooltip'); + const historyInfoTooltip = querySelector(page, 'paper-tooltip'); assertEquals(expectedText, historyInfoTooltip.textContent.trim()); }); }); @@ -483,7 +501,7 @@ return mojoApi_.whenCalled('getPrintJobHistoryExpirationPeriod'); }) .then(() => { - const historyInfoTooltip = page.$$('paper-tooltip'); + const historyInfoTooltip = querySelector(page, 'paper-tooltip'); assertEquals(expectedText, historyInfoTooltip.textContent.trim()); }); }); @@ -512,7 +530,7 @@ return mojoApi_.whenCalled('getPrintJobHistoryExpirationPeriod'); }) .then(() => { - const historyInfoTooltip = page.$$('paper-tooltip'); + const historyInfoTooltip = querySelector(page, 'paper-tooltip'); assertEquals(expectedText, historyInfoTooltip.textContent.trim()); }); }); @@ -539,7 +557,7 @@ return mojoApi_.whenCalled('getPrintJobHistoryExpirationPeriod'); }) .then(() => { - const historyInfoTooltip = page.$$('paper-tooltip'); + const historyInfoTooltip = querySelector(page, 'paper-tooltip'); assertEquals(expectedText, historyInfoTooltip.textContent.trim()); }); }); @@ -584,8 +602,8 @@ }) .then(() => { flush(); - assertTrue(page.$$('#clearAllButton').disabled); - assertTrue(!page.$$('#policyIcon')); + assertTrue(querySelector(page, '#clearAllButton').disabled); + assertTrue(!querySelector(page, '#policyIcon')); }); }); @@ -604,8 +622,8 @@ }) .then(() => { flush(); - assertTrue(page.$$('#clearAllButton').disabled); - assertTrue(!!page.$$('#policyIcon')); + assertTrue(querySelector(page, '#clearAllButton').disabled); + assertTrue(!!querySelector(page, '#policyIcon')); }); }); @@ -639,25 +657,26 @@ verifyPrintJobs(expectedArr, getHistoryPrintJobEntries(page)); // Click the clear all button. - const button = page.$$('#clearAllButton'); + const button = querySelector(page, '#clearAllButton'); button.click(); flush(); // Verify that the confirmation dialog shows up and click on the // confirmation button. - const dialog = page.$$('#clearHistoryDialog'); + const dialog = querySelector(page, '#clearHistoryDialog'); assertTrue(!!dialog); - assertTrue(!dialog.$$('.action-button').disabled); - dialog.$$('.action-button').click(); - assertTrue(dialog.$$('.action-button').disabled); + const dialogActionButton = querySelector(dialog, '.action-button'); + assertTrue(!dialogActionButton.disabled); + dialogActionButton.click(); + assertTrue(dialogActionButton.disabled); return mojoApi_.whenCalled('deleteAllPrintJobs'); }) .then(() => { flush(); // After clearing the history list, expect that the history list and // header are no longer - assertTrue(!page.$$('#entryList')); - assertTrue(!page.$$('#historyHeaderContainer')); - assertTrue(page.$$('#clearAllButton').disabled); + assertTrue(!querySelector(page, '#entryList')); + assertTrue(!querySelector(page, '#historyHeaderContainer')); + assertTrue(querySelector(page, '#clearAllButton').disabled); }); }); @@ -696,9 +715,9 @@ flush(); // After clearing the history list, expect that the history list and // header are no longer - assertTrue(!page.$$('#entryList')); - assertTrue(!page.$$('#historyHeaderContainer')); - assertTrue(page.$$('#clearAllButton').disabled); + assertTrue(!querySelector(page, '#entryList')); + assertTrue(!querySelector(page, '#historyHeaderContainer')); + assertTrue(querySelector(page, '#clearAllButton').disabled); }); }); @@ -711,7 +730,7 @@ flush(); // Header should be not be rendered since no there are no completed // print jobs in the history. - assertTrue(!page.$$('#historyHeaderContainer')); + assertTrue(!querySelector(page, '#historyHeaderContainer')); }); }); @@ -887,8 +906,8 @@ flush(); // Assert that ongoing list is empty and the empty state message is // not hidden. - assertTrue(!page.$$('#ongoingList')); - assertTrue(!page.$$('#ongoingEmptyState').hidden); + assertTrue(!querySelector(page, '#ongoingList')); + assertTrue(!querySelector(page, '#ongoingEmptyState').hidden); }); }); @@ -926,7 +945,7 @@ flush(); // Verify that there are no ongoing print jobs and history list is // populated. - assertTrue(!page.$$('#ongoingList')); + assertTrue(!querySelector(page, '#ongoingList')); verifyPrintJobs(expectedHistoryList, getHistoryPrintJobEntries(page)); }); }); @@ -967,7 +986,7 @@ // Verify that there are no ongoing print jobs and history list is // populated. // TODO(crbug/1093527): Show error message to user after UX guidance. - assertTrue(!page.$$('#ongoingList')); + assertTrue(!querySelector(page, '#ongoingList')); verifyPrintJobs(expectedHistoryList, getHistoryPrintJobEntries(page)); }); }); @@ -1006,7 +1025,8 @@ function updateAndVerifyCompletionStatus(element, newStatus, expectedStatus) { element.set('jobEntry.completedInfo.completionStatus', newStatus); assertEquals( - expectedStatus, element.$$('#completionStatus').textContent.trim()); + expectedStatus, + querySelector(element, '#completionStatus').textContent.trim()); } test('initializeJobEntry', () => { @@ -1024,13 +1044,16 @@ // Assert the title, creation time, and status are displayed correctly. assertEquals( - expectedTitle, jobEntryTestElement.$$('#jobTitle').textContent.trim()); + expectedTitle, + querySelector(jobEntryTestElement, '#jobTitle').textContent.trim()); assertEquals( 'Printed', - jobEntryTestElement.$$('#completionStatus').textContent.trim()); + querySelector(jobEntryTestElement, '#completionStatus') + .textContent.trim()); // Verify correct icon is shown. assertEquals( - 'print-management:file-pdf', jobEntryTestElement.$$('#fileIcon').icon); + 'print-management:file-pdf', + querySelector(jobEntryTestElement, '#fileIcon').icon); // Change date and assert it shows the correct date (Feb 5, 2020); jobEntryTestElement.set('jobEntry.creationTime', { @@ -1038,7 +1061,7 @@ }); assertEquals( 'Feb 5, 2020', - jobEntryTestElement.$$('#creationTime').textContent.trim()); + querySelector(jobEntryTestElement, '#creationTime').textContent.trim()); }); test('initializeFailedJobEntry', () => { @@ -1055,16 +1078,19 @@ // Assert the title, creation time, and status are displayed correctly. assertEquals( - expectedTitle, jobEntryTestElement.$$('#jobTitle').textContent.trim()); + expectedTitle, + querySelector(jobEntryTestElement, '#jobTitle').textContent.trim()); assertEquals( 'Failed - Out of paper', - jobEntryTestElement.$$('#completionStatus').textContent.trim()); + querySelector(jobEntryTestElement, '#completionStatus') + .textContent.trim()); // Verify correct icon is shown. assertEquals( - 'print-management:file-word', jobEntryTestElement.$$('#fileIcon').icon); + 'print-management:file-word', + querySelector(jobEntryTestElement, '#fileIcon').icon); assertEquals( 'Feb 5, 2020', - jobEntryTestElement.$$('#creationTime').textContent.trim()); + querySelector(jobEntryTestElement, '#creationTime').textContent.trim()); }); test('initializeOngoingJobEntry', () => { @@ -1082,15 +1108,18 @@ // Assert the title, creation time, and status are displayed correctly. assertEquals( - expectedTitle, jobEntryTestElement.$$('#jobTitle').textContent.trim()); + expectedTitle, + querySelector(jobEntryTestElement, '#jobTitle').textContent.trim()); assertEquals( 'Feb 5, 2020', - jobEntryTestElement.$$('#creationTime').textContent.trim()); + querySelector(jobEntryTestElement, '#creationTime').textContent.trim()); assertEquals( - '1/4', jobEntryTestElement.$$('#numericalProgress').textContent.trim()); + '1/4', + querySelector(jobEntryTestElement, '#numericalProgress') + .textContent.trim()); assertEquals( 'print-management:file-generic', - jobEntryTestElement.$$('#fileIcon').icon); + querySelector(jobEntryTestElement, '#fileIcon').icon); }); test('initializeStoppedOngoingJobEntry', () => { @@ -1109,16 +1138,17 @@ // Assert the title, creation time, and status are displayed correctly. assertEquals( - expectedTitle, jobEntryTestElement.$$('#jobTitle').textContent.trim()); + expectedTitle, + querySelector(jobEntryTestElement, '#jobTitle').textContent.trim()); assertEquals( 'Feb 5, 2020', - jobEntryTestElement.$$('#creationTime').textContent.trim()); + querySelector(jobEntryTestElement, '#creationTime').textContent.trim()); assertEquals( 'Stopped - Out of paper', - jobEntryTestElement.$$('#ongoingError').textContent.trim()); + querySelector(jobEntryTestElement, '#ongoingError').textContent.trim()); assertEquals( 'print-management:file-generic', - jobEntryTestElement.$$('#fileIcon').icon); + querySelector(jobEntryTestElement, '#fileIcon').icon); }); test('ensureGoogleFileIconIsShown', () => { @@ -1133,7 +1163,8 @@ flush(); assertEquals( - 'print-management:file-gdoc', jobEntryTestElement.$$('#fileIcon').icon); + 'print-management:file-gdoc', + querySelector(jobEntryTestElement, '#fileIcon').icon); }); test('ensureGenericFileIconIsShown', () => { @@ -1149,7 +1180,7 @@ assertEquals( 'print-management:file-generic', - jobEntryTestElement.$$('#fileIcon').icon); + querySelector(jobEntryTestElement, '#fileIcon').icon); }); test('ensureFileIconClassMatchesFileIcon', () => {
diff --git a/chrome/updater/app/server/win/com_classes_legacy.cc b/chrome/updater/app/server/win/com_classes_legacy.cc index 7763704..12d0deb 100644 --- a/chrome/updater/app/server/win/com_classes_legacy.cc +++ b/chrome/updater/app/server/win/com_classes_legacy.cc
@@ -955,13 +955,22 @@ } STDMETHODIMP PolicyStatusImpl::refreshPolicies() { + // Capture `this` object throughout the policy fetch to have an outstanding + // self reference of the COM object, otherwise the server could shutdown if + // the caller releases its interface pointer when this function returns. + using PolicyStatusImplPtr = Microsoft::WRL::ComPtr<PolicyStatusImpl>; AppServerSingletonInstance()->main_task_runner()->PostTask( FROM_HERE, - base::BindOnce(&DeviceManagementTask::RunFetchPolicy, - base::MakeRefCounted<DeviceManagementTask>( - AppServerSingletonInstance()->config(), - AppServerSingletonInstance()->main_task_runner()), - base::DoNothing())); + base::BindOnce( + [](PolicyStatusImplPtr this_obj) { + auto device_management_task = + base::MakeRefCounted<DeviceManagementTask>( + AppServerSingletonInstance()->config(), + AppServerSingletonInstance()->main_task_runner()); + device_management_task->RunFetchPolicy(base::BindOnce( + [](PolicyStatusImplPtr /*this_obj*/) {}, this_obj)); + }, + PolicyStatusImplPtr(this))); return S_OK; }
diff --git a/chrome/updater/app/server/win/server.cc b/chrome/updater/app/server/win/server.cc index 6f8e8d9..5393cc4 100644 --- a/chrome/updater/app/server/win/server.cc +++ b/chrome/updater/app/server/win/server.cc
@@ -17,6 +17,7 @@ #include "base/check.h" #include "base/command_line.h" #include "base/files/file_path.h" +#include "base/files/scoped_temp_dir.h" #include "base/logging.h" #include "base/memory/ref_counted.h" #include "base/path_service.h" @@ -27,7 +28,6 @@ #include "base/win/atl.h" #include "base/win/registry.h" #include "base/win/windows_types.h" -#include "chrome/installer/util/self_cleaning_temp_dir.h" #include "chrome/installer/util/work_item_list.h" #include "chrome/updater/app/server/win/com_classes.h" #include "chrome/updater/app/server/win/com_classes_legacy.h" @@ -83,28 +83,6 @@ return true; } -bool CreateSecureTempDir(UpdaterScope scope, - installer::SelfCleaningTempDir& temp_path) { - base::FilePath temp_dir; - if (!base::PathService::Get(scope == UpdaterScope::kSystem - ? int{base::DIR_PROGRAM_FILES} - : base::DIR_TEMP, - &temp_dir)) { - return false; - } - - temp_dir = temp_dir.AppendASCII(COMPANY_SHORTNAME_STRING) - .AppendASCII(PRODUCT_FULLNAME_STRING); - - if (!temp_path.Initialize(temp_dir, L"UPDATER_TEMP_DIR")) { - PLOG(ERROR) << "Could not create temporary path."; - return false; - } - - VLOG(2) << "Created temp path " << temp_path.path().value(); - return true; -} - HRESULT AddAllowedAce(HANDLE object, SE_OBJECT_TYPE object_type, const CSid& sid, @@ -281,16 +259,15 @@ const base::FilePath updater_path = versioned_directory->Append(GetExecutableRelativePath()); - installer::SelfCleaningTempDir temp_dir; - if (!CreateSecureTempDir(updater_scope(), temp_dir)) { - return false; - } - if (updater_scope() == UpdaterScope::kSystem && !CreateClientStateMedium()) { return false; } - if (!SwapGoogleUpdate(updater_scope(), updater_path, temp_dir.path(), + absl::optional<base::ScopedTempDir> temp_dir = CreateSecureTempDir(); + if (!temp_dir) + return false; + + if (!SwapGoogleUpdate(updater_scope(), updater_path, temp_dir->GetPath(), UpdaterScopeToHKeyRoot(updater_scope()), list.get())) { return false; }
diff --git a/chrome/updater/policy/service.h b/chrome/updater/policy/service.h index c0885d9..fd4e512 100644 --- a/chrome/updater/policy/service.h +++ b/chrome/updater/policy/service.h
@@ -61,7 +61,7 @@ // The PolicyService returns policies for enterprise managed machines from the // source with the highest priority where the policy available. -class PolicyService : public base::RefCounted<PolicyService> { +class PolicyService : public base::RefCountedThreadSafe<PolicyService> { public: using PolicyManagerVector = std::vector<std::unique_ptr<PolicyManagerInterface>>; @@ -118,7 +118,7 @@ virtual ~PolicyService(); private: - friend class base::RefCounted<PolicyService>; + friend class base::RefCountedThreadSafe<PolicyService>; // List of policy providers in descending order of priority. All managed // providers should be ahead of non-managed providers.
diff --git a/chrome/updater/test/integration_tests_win.cc b/chrome/updater/test/integration_tests_win.cc index cdf566c..f7366af 100644 --- a/chrome/updater/test/integration_tests_win.cc +++ b/chrome/updater/test/integration_tests_win.cc
@@ -1220,7 +1220,6 @@ EXPECT_TRUE(persisted_data->GetBrandCode(kNoPVAppId).empty()); EXPECT_TRUE(persisted_data->GetFingerprint(kNoPVAppId).empty()); - const std::string kChromeAppId = "{8A69D345-D564-463C-AFF1-A69D9E530F96}"; EXPECT_EQ(persisted_data->GetProductVersion(kChromeAppId), base::Version("99.0.0.1")); EXPECT_EQ(persisted_data->GetAP(kChromeAppId), "TestAP");
diff --git a/chrome/updater/win/installer/installer.cc b/chrome/updater/win/installer/installer.cc index 58d99b0..6925c48 100644 --- a/chrome/updater/win/installer/installer.cc +++ b/chrome/updater/win/installer/installer.cc
@@ -13,23 +13,9 @@ #include "chrome/updater/win/installer/installer.h" -#include "base/memory/raw_ptr.h" - -// #define needed to link in RtlGenRandom(), a.k.a. SystemFunction036. See the -// "Community Additions" comment on MSDN here: -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa387694.aspx -#define SystemFunction036 NTAPI SystemFunction036 -#include <NTSecAPI.h> -#undef SystemFunction036 - -#include <sddl.h> #include <shellapi.h> #include <shlobj.h> -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include <initializer_list> #include <string> // TODO(crbug.com/1128529): remove the dependencies on //base/ to reduce the @@ -42,7 +28,6 @@ #include "base/path_service.h" #include "base/strings/sys_string_conversions.h" #include "chrome/installer/util/lzma_util.h" -#include "chrome/installer/util/self_cleaning_temp_dir.h" #include "chrome/installer/util/util_constants.h" #include "chrome/updater/constants.h" #include "chrome/updater/updater_branding.h" @@ -52,6 +37,7 @@ #include "chrome/updater/win/installer/pe_resource.h" #include "chrome/updater/win/tag_extractor.h" #include "chrome/updater/win/win_util.h" +#include "third_party/abseil-cpp/absl/types/optional.h" namespace updater { @@ -59,52 +45,6 @@ namespace { -// If the process is running with Admin privileges, a secure unpack location -// under %ProgramFiles% (a directory that only admins can write to by default) -// is used. -bool CreateSecureTempDir(installer::SelfCleaningTempDir& temp_path) { - base::FilePath temp_dir; - if (!base::PathService::Get( - ::IsUserAnAdmin() ? int{base::DIR_PROGRAM_FILES} : base::DIR_TEMP, - &temp_dir)) { - return false; - } - - temp_dir = temp_dir.AppendASCII(COMPANY_SHORTNAME_STRING) - .AppendASCII(PRODUCT_FULLNAME_STRING); - - if (!temp_path.Initialize(temp_dir, L"UPDATER_TEMP_DIR")) { - PLOG(ERROR) << "Could not create temporary path."; - return false; - } - - VLOG(2) << "Created temp path " << temp_path.path().value(); - return true; -} - -// Initializes |temp_path| to "Temp" within the target directory, and -// |unpack_path| to a random directory beginning with "source" within -// |temp_path|. Returns false on error. -bool CreateTemporaryAndUnpackDirectories( - installer::SelfCleaningTempDir& temp_path, - base::FilePath* unpack_path) { - DCHECK(unpack_path); - - // Because there is no UpdaterScope yet, ::IsUserAnAdmin() is used to - // determine whether the process is running with Admin privileges. - if (!CreateSecureTempDir(temp_path)) { - return false; - } - - if (!base::CreateTemporaryDirInDir(temp_path.path(), L"source", - unpack_path)) { - PLOG(ERROR) << "Could not create temporary path for unpacked archive."; - return false; - } - - return true; -} - // Returns the tag if the tag can be extracted. The tag is read from the // program file image used to create this process. Google is using UTF8 tags but // other embedders could use UTF16. The UTF16 tag not only uses a different @@ -316,174 +256,6 @@ return RunProcessAndWait(setup_exe.get(), cmd_line.get()); } -// Returns true if the supplied path supports ACLs. -bool IsAclSupportedForPath(const wchar_t* path) { - PathString volume; - DWORD flags = 0; - return ::GetVolumePathName(path, volume.get(), - static_cast<DWORD>(volume.capacity())) && - ::GetVolumeInformation(volume.get(), nullptr, 0, nullptr, nullptr, - &flags, nullptr, 0) && - (flags & FILE_PERSISTENT_ACLS); -} - -// Retrieves the SID of the default owner for objects created by this user -// token (accounting for different behavior under UAC elevation, etc.). -// NOTE: On success the |sid| parameter must be freed with LocalFree(). -bool GetCurrentOwnerSid(wchar_t** sid) { - HANDLE token; - if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token)) - return false; - - DWORD size = 0; - bool result = false; - // We get the TokenOwner rather than the TokenUser because e.g. under UAC - // elevation we want the admin to own the directory rather than the user. - ::GetTokenInformation(token, TokenOwner, nullptr, 0, &size); - if (size && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - if (TOKEN_OWNER* owner = - reinterpret_cast<TOKEN_OWNER*>(::LocalAlloc(LPTR, size))) { - if (::GetTokenInformation(token, TokenOwner, owner, size, &size)) - result = !!::ConvertSidToStringSid(owner->Owner, sid); - ::LocalFree(owner); - } - } - ::CloseHandle(token); - return result; -} - -// Populates |sd| suitable for use when creating directories within |path| with -// ACLs allowing access to only the current owner, admin, and system. -// NOTE: On success the |sd| parameter must be freed with LocalFree(). -bool SetSecurityDescriptor(const wchar_t* path, PSECURITY_DESCRIPTOR* sd) { - *sd = nullptr; - // We succeed without doing anything if ACLs aren't supported. - if (!IsAclSupportedForPath(path)) - return true; - - wchar_t* sid = nullptr; - if (!GetCurrentOwnerSid(&sid)) - return false; - - // The largest SID is under 200 characters, so 300 should give enough slack. - StackString<300> sddl; - bool result = sddl.append( - L"D:PAI" // Protected, auto-inherited DACL. - L"(A;;FA;;;BA)" // Admin: Full control. - L"(A;OIIOCI;GA;;;BA)" - L"(A;;FA;;;SY)" // System: Full control. - L"(A;OIIOCI;GA;;;SY)" - L"(A;OIIOCI;GA;;;CO)" // Owner: Full control. - L"(A;;FA;;;") && - sddl.append(sid) && sddl.append(L")"); - if (result) { - result = !!::ConvertStringSecurityDescriptorToSecurityDescriptor( - sddl.get(), SDDL_REVISION_1, sd, nullptr); - } - - ::LocalFree(sid); - return result; -} - -// Creates a temporary directory under |base_path| and returns the full path -// of created directory in |work_dir|. If successful return true, otherwise -// false. When successful, the returned |work_dir| will always have a trailing -// backslash and this function requires that |base_path| always includes a -// trailing backslash as well. -// We do not use GetTempFileName here to avoid running into AV software that -// might hold on to the temp file as soon as we create it and then we can't -// delete it and create a directory in its place. So, we use our own mechanism -// for creating a directory with a hopefully-unique name. In the case of a -// collision, we retry a few times with a new name before failing. -bool CreateWorkDir(const wchar_t* base_path, - PathString* work_dir, - ProcessExitResult* exit_code) { - *exit_code = ProcessExitResult(PATH_STRING_OVERFLOW); - if (!work_dir->assign(base_path) || !work_dir->append(kTempPrefix)) - return false; - - // Store the location where we'll append the id. - size_t end = work_dir->length(); - - // Check if we'll have enough buffer space to continue. - // The name of the directory will use up 11 chars and then we need to append - // the trailing backslash and a terminator. We've already added the prefix - // to the buffer, so let's just make sure we've got enough space for the rest. - if ((work_dir->capacity() - end) < (_countof("fffff.tmp") + 1)) - return false; - - // Add an ACL if supported by the filesystem. Otherwise system-level installs - // are potentially vulnerable to file squatting attacks. - SECURITY_ATTRIBUTES sa = {}; - sa.nLength = sizeof(SECURITY_ATTRIBUTES); - if (!SetSecurityDescriptor(base_path, &sa.lpSecurityDescriptor)) { - *exit_code = - ProcessExitResult(UNABLE_TO_SET_DIRECTORY_ACL, ::GetLastError()); - return false; - } - - unsigned int id; - *exit_code = ProcessExitResult(UNABLE_TO_GET_WORK_DIRECTORY); - for (int max_attempts = 10; max_attempts; --max_attempts) { - ::RtlGenRandom(&id, sizeof(id)); // Try a different name. - - // This converts 'id' to a string in the format "78563412" on windows - // because of little endianness, but we don't care since it's just - // a name. Since we checked capaity at the front end, we don't need to - // duplicate it here. - HexEncode(&id, sizeof(id), work_dir->get() + end, - work_dir->capacity() - end); - - // We only want the first 5 digits to remain within the 8.3 file name - // format (compliant with previous implementation). - work_dir->truncate_at(end + 5); - - // for consistency with the previous implementation which relied on - // GetTempFileName, we append the .tmp extension. - work_dir->append(L".tmp"); - - if (::CreateDirectory(work_dir->get(), - sa.lpSecurityDescriptor ? &sa : nullptr)) { - // Yay! Now let's just append the backslash and we're done. - work_dir->append(L"\\"); - *exit_code = ProcessExitResult(SUCCESS_EXIT_CODE); - break; - } - } - - if (sa.lpSecurityDescriptor) - LocalFree(sa.lpSecurityDescriptor); - return exit_code->IsSuccess(); -} - -// Creates and returns a temporary directory in |work_dir| that can be used to -// extract updater payload. |work_dir| ends with a path separator. -bool GetWorkDir(HMODULE module, - PathString* work_dir, - ProcessExitResult* exit_code) { - PathString base_path; - // Use the current module directory as a secure base path. - DWORD len = ::GetModuleFileName(module, base_path.get(), - static_cast<DWORD>(base_path.capacity())); - if (len >= base_path.capacity() || !len) - return false; // Can't even get current directory? Return an error. - - wchar_t* name = GetNameFromPathExt(base_path.get(), len); - if (name == base_path.get()) - return false; // There was no directory in the string! Bail out. - - *name = L'\0'; - - *exit_code = ProcessExitResult(SUCCESS_EXIT_CODE); - return CreateWorkDir(base_path.get(), work_dir, exit_code); -} - -// Returns true for ".." and "." directories. -bool IsCurrentOrParentDirectory(const wchar_t* dir) { - return dir && dir[0] == L'.' && - (dir[1] == L'\0' || (dir[1] == L'.' && dir[2] == L'\0')); -} - ProcessExitResult HandleRunElevated(const base::CommandLine& command_line) { DCHECK(!::IsUserAnAdmin()); DCHECK(!command_line.HasSwitch(kCmdLinePrefersUser)); @@ -554,13 +326,14 @@ // First get a path where we can extract the resource payload, which is // a compressed LZMA archive of a single file. - base::ScopedTempDir base_path_owner; - PathString base_path; - if (!GetWorkDir(module, &base_path, &exit_code)) - return exit_code; - if (!base_path_owner.Set(base::FilePath(base_path.get()))) { - ::DeleteFile(base_path.get()); + absl::optional<base::ScopedTempDir> base_path_owner = CreateSecureTempDir(); + if (!base_path_owner) return ProcessExitResult(static_cast<DWORD>(installer::TEMP_DIR_FAILED)); + + PathString base_path; + if (!base_path.assign( + base_path_owner->GetPath().AsEndingWithSeparator().value().c_str())) { + return ProcessExitResult(PATH_STRING_OVERFLOW); } PathString compressed_archive; @@ -568,11 +341,12 @@ &compressed_archive); // Create a temp folder where the archives are unpacked. - base::FilePath unpack_path; - installer::SelfCleaningTempDir temp_path; - if (!CreateTemporaryAndUnpackDirectories(temp_path, &unpack_path)) + absl::optional<base::ScopedTempDir> temp_path = CreateSecureTempDir(); + if (!temp_path) return ProcessExitResult(static_cast<DWORD>(installer::TEMP_DIR_FAILED)); + const base::FilePath unpack_path = temp_path->GetPath(); + // Unpack the compressed archive to extract the uncompressed archive file. UnPackStatus unpack_status = UnPackArchive(base::FilePath(compressed_archive.get()), unpack_path,
diff --git a/chrome/updater/win/installer/installer_constants.cc b/chrome/updater/win/installer/installer_constants.cc index 498172b..22e2835 100644 --- a/chrome/updater/win/installer/installer_constants.cc +++ b/chrome/updater/win/installer/installer_constants.cc
@@ -9,9 +9,6 @@ // The prefix of the updater archive resource. const wchar_t kUpdaterArchivePrefix[] = L"updater"; -// Temp directory prefix that this process creates. -const wchar_t kTempPrefix[] = L"UPDATER_TEMP_DIR"; - // 7zip archive. const wchar_t kLZMAResourceType[] = L"B7";
diff --git a/chrome/updater/win/installer/installer_constants.h b/chrome/updater/win/installer/installer_constants.h index fc0bf779..9bf429d3 100644 --- a/chrome/updater/win/installer/installer_constants.h +++ b/chrome/updater/win/installer/installer_constants.h
@@ -9,7 +9,6 @@ // Various filenames and prefixes. extern const wchar_t kUpdaterArchivePrefix[]; -extern const wchar_t kTempPrefix[]; // The resource types that would be unpacked from the mini installer. extern const wchar_t kLZMAResourceType[];
diff --git a/chrome/updater/win/setup/setup_util.cc b/chrome/updater/win/setup/setup_util.cc index cccd7c8..57ffbce 100644 --- a/chrome/updater/win/setup/setup_util.cc +++ b/chrome/updater/win/setup/setup_util.cc
@@ -385,27 +385,6 @@ void CheckComInterfaceTypeLib(UpdaterScope scope, bool is_internal) { for (const auto& iid : GetInterfaces(is_internal)) { - base::FilePath typelib_path; - CHECK(base::PathService::Get(base::DIR_EXE, &typelib_path)); - typelib_path = typelib_path.Append(GetExecutableRelativePath()) - .Append(GetComTypeLibResourceIndex(iid)); - - Microsoft::WRL::ComPtr<ITypeLib> type_lib; - if (HRESULT hr = ::LoadTypeLib(typelib_path.value().c_str(), &type_lib); - FAILED(hr)) { - LOG(ERROR) << __func__ << " ::LoadTypeLib failed: " << typelib_path - << ": " << std::hex << hr; - return; - } - - Microsoft::WRL::ComPtr<ITypeInfo> type_info; - if (HRESULT hr = type_lib->GetTypeInfoOfGuid(iid, &type_info); FAILED(hr)) { - LOG(ERROR) << __func__ << " ::GetTypeInfoOfGuid failed" - << ": " << std::hex << hr - << ": IID: " << base::win::WStringFromGUID(iid); - return; - } - const HKEY root = UpdaterScopeToHKeyRoot(scope); const std::wstring iid_reg_path = GetComIidRegistryPath(iid); const std::wstring typelib_reg_path = GetComTypeLibRegistryPath(iid); @@ -436,11 +415,23 @@ typelib_reg_path + L"\\1.0\\0\\win64"; for (const auto& path : {typelib_reg_path_win32, typelib_reg_path_win64}) { - CHECK_EQ( - base::win::RegKey(root, path.c_str(), KEY_READ).ReadValue(L"", &val), - ERROR_SUCCESS) + std::wstring typelib_path; + CHECK_EQ(base::win::RegKey(root, path.c_str(), KEY_READ) + .ReadValue(L"", &typelib_path), + ERROR_SUCCESS) << ": " << root << ": " << path << ": " << iid_string; - VLOG(1) << __func__ << ": " << path << ": " << val << ": " << iid_string; + + Microsoft::WRL::ComPtr<ITypeLib> type_lib; + HRESULT hr = ::LoadTypeLib(typelib_path.c_str(), &type_lib); + CHECK(SUCCEEDED(hr)) << " ::LoadTypeLib failed: " << typelib_path << ": " + << std::hex << hr; + + Microsoft::WRL::ComPtr<ITypeInfo> type_info; + hr = type_lib->GetTypeInfoOfGuid(iid, &type_info); + CHECK(SUCCEEDED(hr)) << " ::GetTypeInfoOfGuid failed" + << ": " << std::hex << hr + << ": Typelib path: " << typelib_path + << ": IID: " << iid_string; } } }
diff --git a/chrome/updater/win/win_util.cc b/chrome/updater/win/win_util.cc index 7647975..848ebce4 100644 --- a/chrome/updater/win/win_util.cc +++ b/chrome/updater/win/win_util.cc
@@ -872,4 +872,21 @@ return true; } +absl::optional<base::ScopedTempDir> CreateSecureTempDir() { + base::FilePath temp_dir; + if (!base::PathService::Get( + ::IsUserAnAdmin() ? base::DIR_PROGRAM_FILES : base::DIR_TEMP, + &temp_dir)) { + return absl::nullopt; + } + + base::ScopedTempDir temp_path; + if (!temp_path.CreateUniqueTempDirUnderPath( + temp_dir.AppendASCII(COMPANY_SHORTNAME_STRING))) { + return absl::nullopt; + } + + return temp_path; +} + } // namespace updater
diff --git a/chrome/updater/win/win_util.h b/chrome/updater/win/win_util.h index 2221c5a..dbd6ccb6 100644 --- a/chrome/updater/win/win_util.h +++ b/chrome/updater/win/win_util.h
@@ -13,6 +13,7 @@ #include "base/containers/span.h" #include "base/files/file_path.h" +#include "base/files/scoped_temp_dir.h" #include "base/hash/hash.h" #include "base/process/process_iterator.h" #include "base/scoped_generic.h" @@ -279,6 +280,10 @@ // and cannot be reversed. bool EnableProcessHeapMetadataProtection(); +// Creates a unique temporary directory. The directory is created under +// %ProgramFiles% if the caller is admin, so it is secure. +absl::optional<base::ScopedTempDir> CreateSecureTempDir(); + } // namespace updater #endif // CHROME_UPDATER_WIN_WIN_UTIL_H_
diff --git a/chrome/updater/win/win_util_unittest.cc b/chrome/updater/win/win_util_unittest.cc index 4788f79..a5a7dc4 100644 --- a/chrome/updater/win/win_util_unittest.cc +++ b/chrome/updater/win/win_util_unittest.cc
@@ -259,4 +259,16 @@ EXPECT_TRUE(EnableProcessHeapMetadataProtection()); } +TEST(WinUtil, CreateSecureTempDir) { + absl::optional<base::ScopedTempDir> temp_dir = CreateSecureTempDir(); + EXPECT_TRUE(temp_dir); + EXPECT_TRUE(temp_dir->IsValid()); + + base::FilePath program_files_dir; + EXPECT_TRUE( + base::PathService::Get(base::DIR_PROGRAM_FILES, &program_files_dir)); + EXPECT_EQ(program_files_dir.IsParent(temp_dir->GetPath()), + !!::IsUserAnAdmin()); +} + } // namespace updater
diff --git a/chromecast/browser/cast_media_blocker.cc b/chromecast/browser/cast_media_blocker.cc index 9121e7b7..b465573 100644 --- a/chromecast/browser/cast_media_blocker.cc +++ b/chromecast/browser/cast_media_blocker.cc
@@ -150,13 +150,10 @@ void CastMediaBlocker::UpdateBackgroundVideoPlaybackState() { if (!web_contents()) return; - web_contents()->ForEachRenderFrameHost(base::BindRepeating( - [](CastMediaBlocker* cast_media_blocker, - content::RenderFrameHost* frame) { - cast_media_blocker->UpdateRenderFrameBackgroundVideoPlaybackState( - frame); - }, - this)); + web_contents()->ForEachRenderFrameHost( + [this](content::RenderFrameHost* frame) { + UpdateRenderFrameBackgroundVideoPlaybackState(frame); + }); } void CastMediaBlocker::UpdateRenderFrameBackgroundVideoPlaybackState(
diff --git a/chromeos/ash/components/network/metrics/connection_results.cc b/chromeos/ash/components/network/metrics/connection_results.cc index a12b9d2e..e39d47c 100644 --- a/chromeos/ash/components/network/metrics/connection_results.cc +++ b/chromeos/ash/components/network/metrics/connection_results.cc
@@ -127,6 +127,8 @@ return ShillConnectResult::kErrorEapLocalTlsFailed; else if (error_name == shill::kErrorEapRemoteTlsFailed) return ShillConnectResult::kErrorEapRemoteTlsFailed; + else if (error_name == shill::kErrorResultWepNotSupported) + return ShillConnectResult::kErrorResultWepNotSupported; return ShillConnectResult::kUnknown; }
diff --git a/chromeos/ash/components/network/metrics/connection_results.h b/chromeos/ash/components/network/metrics/connection_results.h index 4e68f9d..be3dd804 100644 --- a/chromeos/ash/components/network/metrics/connection_results.h +++ b/chromeos/ash/components/network/metrics/connection_results.h
@@ -82,8 +82,9 @@ kErrorEapAuthenticationFailed = 54, kErrorEapLocalTlsFailed = 55, kErrorEapRemoteTlsFailed = 56, + kErrorResultWepNotSupported = 57, - kMaxValue = kErrorEapRemoteTlsFailed, + kMaxValue = kErrorResultWepNotSupported, }; // This enum is used to track user-initiated connection results from
diff --git a/chromeos/ui/frame/multitask_menu/multitask_button.cc b/chromeos/ui/frame/multitask_menu/multitask_button.cc index 1b7c0742..4a4c98e9 100644 --- a/chromeos/ui/frame/multitask_menu/multitask_button.cc +++ b/chromeos/ui/frame/multitask_menu/multitask_button.cc
@@ -16,17 +16,22 @@ namespace { // Round rect pattern indicate the Full/Float window bounds. -// TODO(shidi): Update when implement portrait mode. -constexpr gfx::Rect kFloatPatternBounds(72, 24, 32, 44); -constexpr gfx::Rect kFullPatternBounds(4, 4, 100, 64); +constexpr gfx::Rect kFloatPatternLandscapeBounds(72, 24, 32, 44); +constexpr gfx::Rect kFloatPatternPortraitBounds(36, 60, 32, 44); +constexpr gfx::Rect kFullPatternLandscapeBounds(4, 4, 100, 64); +constexpr gfx::Rect kFullPatternPortraitBounds(4, 4, 64, 100); } // namespace MultitaskBaseButton::MultitaskBaseButton(PressedCallback callback, Type type, + bool is_portrait_mode, const std::u16string& name) - : views::Button(std::move(callback)), type_(type) { - SetPreferredSize(kMultitaskButtonSize); + : views::Button(std::move(callback)), + type_(type), + is_portrait_mode_(is_portrait_mode) { + SetPreferredSize(is_portrait_mode_ ? kMultitaskButtonPortraitSize + : kMultitaskButtonLandscapeSize); views::InkDrop::Get(this)->SetMode(views::InkDropHost::InkDropMode::ON); views::InkDrop::Get(this)->SetBaseColor(kMultitaskButtonDefaultColor); SetInstallFocusRingOnFocus(true); @@ -72,9 +77,15 @@ fill_flags.setColor(fill_color); canvas->DrawRoundRect(GetLocalBounds(), kMultitaskBaseButtonBorderRadius, fill_flags); + gfx::Rect bounds; + if (is_portrait_mode_) { + bounds = type_ == Type::kFloat ? kFloatPatternPortraitBounds + : kFullPatternPortraitBounds; + } else { + bounds = type_ == Type::kFloat ? kFloatPatternLandscapeBounds + : kFullPatternLandscapeBounds; + } - gfx::Rect bounds = - type_ == Type::kFloat ? kFloatPatternBounds : kFullPatternBounds; canvas->DrawRoundRect(bounds, kButtonCornerRadius, pattern_flags); }
diff --git a/chromeos/ui/frame/multitask_menu/multitask_button.h b/chromeos/ui/frame/multitask_menu/multitask_button.h index fdbb78e..e51a989 100644 --- a/chromeos/ui/frame/multitask_menu/multitask_button.h +++ b/chromeos/ui/frame/multitask_menu/multitask_button.h
@@ -23,6 +23,7 @@ MultitaskBaseButton(PressedCallback callback, Type type, + bool is_portrait_mode, const std::u16string& name); MultitaskBaseButton(const MultitaskBaseButton&) = delete; @@ -35,6 +36,9 @@ private: const Type type_; + // The display orientation. This determines whether button is in + // landscape/portrait mode. + const bool is_portrait_mode_; }; } // namespace chromeos
diff --git a/chromeos/ui/frame/multitask_menu/multitask_menu.cc b/chromeos/ui/frame/multitask_menu/multitask_menu.cc index d58e0a8..7b3e181 100644 --- a/chromeos/ui/frame/multitask_menu/multitask_menu.cc +++ b/chromeos/ui/frame/multitask_menu/multitask_menu.cc
@@ -7,9 +7,11 @@ #include <memory> #include "base/check.h" +#include "chromeos/ui/base/display_util.h" #include "chromeos/ui/frame/multitask_menu/float_controller_base.h" #include "chromeos/ui/frame/multitask_menu/multitask_menu_view.h" #include "ui/base/metadata/metadata_impl_macros.h" +#include "ui/display/screen.h" #include "ui/display/tablet_state.h" #include "ui/views/layout/table_layout.h" @@ -19,8 +21,6 @@ constexpr int kMultitaskMenuBubbleCornerRadius = 8; constexpr int kRowPadding = 16; -constexpr int KMultitaskMenuWidth = 270; -constexpr int kMultitaskMenuHeight = 248; } // namespace @@ -30,6 +30,7 @@ set_corner_radius(kMultitaskMenuBubbleCornerRadius); set_close_on_deactivate(true); set_internal_name("MultitaskMenuBubbleWidget"); + set_margins(gfx::Insets()); set_parent_window(parent_window); SetAnchorView(anchor); @@ -37,7 +38,7 @@ // window has no space for `MultitaskMenu` to arrow at `TOP_CENTER`. SetArrow(views::BubbleBorder::Arrow::TOP_CENTER); SetButtons(ui::DIALOG_BUTTON_NONE); - SetPreferredSize(gfx::Size(KMultitaskMenuWidth, kMultitaskMenuHeight)); + SetUseDefaultFillLayout(true); // Must be initialized after setting bounds. @@ -79,6 +80,21 @@ HideBubble(); } +void MultitaskMenu::OnDisplayMetricsChanged(const display::Display& display, + uint32_t changed_metrics) { + // Ignore changes to displays that aren't showing the menu. + if (display.id() != + display::Screen::GetScreen() + ->GetDisplayNearestView(GetWidget()->GetNativeWindow()) + .id()) { + return; + } + // TODO(shidi): Will do the rotate transition on a separate cl. Close the + // bubble at rotation for now. + if (changed_metrics & (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_ROTATION)) + HideBubble(); +} + void MultitaskMenu::ShowBubble() { DCHECK(parent_window()); bubble_widget_ = views::BubbleDialogDelegateView::CreateBubble(this);
diff --git a/chromeos/ui/frame/multitask_menu/multitask_menu.h b/chromeos/ui/frame/multitask_menu/multitask_menu.h index f9157ce..e761630 100644 --- a/chromeos/ui/frame/multitask_menu/multitask_menu.h +++ b/chromeos/ui/frame/multitask_menu/multitask_menu.h
@@ -39,6 +39,8 @@ void OnWidgetDestroying(views::Widget* widget) override; // display::DisplayObserver: + void OnDisplayMetricsChanged(const display::Display& display, + uint32_t changed_metrics) override; void OnDisplayTabletStateChanged(display::TabletState state) override; // Displays the MultitaskMenu.
diff --git a/chromeos/ui/frame/multitask_menu/multitask_menu_constants.h b/chromeos/ui/frame/multitask_menu/multitask_menu_constants.h index 872e432..f26d1c6 100644 --- a/chromeos/ui/frame/multitask_menu/multitask_menu_constants.h +++ b/chromeos/ui/frame/multitask_menu/multitask_menu_constants.h
@@ -11,7 +11,8 @@ namespace chromeos { -constexpr gfx::Size kMultitaskButtonSize(108, 72); +constexpr gfx::Size kMultitaskButtonLandscapeSize(108, 72); +constexpr gfx::Size kMultitaskButtonPortraitSize(72, 108); constexpr gfx::Insets kMultitaskBaseButtonMargin(4); constexpr int kMultitaskBaseButtonBorderRadius = 7; constexpr int kButtonBorderSize = 1;
diff --git a/chromeos/ui/frame/multitask_menu/multitask_menu_view.cc b/chromeos/ui/frame/multitask_menu/multitask_menu_view.cc index d70a5c5f..ba397a4 100644 --- a/chromeos/ui/frame/multitask_menu/multitask_menu_view.cc +++ b/chromeos/ui/frame/multitask_menu/multitask_menu_view.cc
@@ -8,12 +8,14 @@ #include "base/callback_forward.h" #include "base/check.h" +#include "chromeos/ui/base/display_util.h" #include "chromeos/ui/frame/caption_buttons/snap_controller.h" #include "chromeos/ui/frame/multitask_menu/float_controller_base.h" #include "ui/aura/window.h" #include "ui/base/default_style.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" +#include "ui/display/screen.h" #include "ui/strings/grit/ui_strings.h" #include "ui/views/background.h" #include "ui/views/controls/label.h" @@ -25,6 +27,10 @@ constexpr int kCenterPadding = 4; constexpr int kLabelFontSize = 13; +constexpr int kMultitaskMenuLandscapeWidth = 270; +constexpr int kMultitaskMenuLandscapeHeight = 248; +constexpr int kMultitaskMenuPortraitWidth = 200; +constexpr int kMultitaskMenuPortraitHeight = 320; // Creates multitask button with label. std::unique_ptr<views::View> CreateButtonContainer( @@ -54,6 +60,16 @@ DCHECK(on_any_button_pressed_); SetUseDefaultFillLayout(true); + // The display orientation. This determines whether menu is in + // landscape/portrait mode. + const bool is_portrait_mode = !chromeos::IsDisplayLayoutHorizontal( + display::Screen::GetScreen()->GetDisplayNearestWindow(window)); + + SetPreferredSize(is_portrait_mode ? gfx::Size(kMultitaskMenuPortraitWidth, + kMultitaskMenuPortraitHeight) + : gfx::Size(kMultitaskMenuLandscapeWidth, + kMultitaskMenuLandscapeHeight)); + half_button_ = static_cast<SplitButtonView*>(AddChildView(CreateButtonContainer( std::make_unique<SplitButtonView>( @@ -63,7 +79,8 @@ SnapDirection::kPrimary), base::BindRepeating(&MultitaskMenuView::SplitButtonPressed, base::Unretained(this), - SnapDirection::kSecondary)), + SnapDirection::kSecondary), + is_portrait_mode), IDS_APP_ACCNAME_HALF))); // Partial button. @@ -76,7 +93,8 @@ SnapDirection::kPrimary), base::BindRepeating(&MultitaskMenuView::PartialButtonPressed, base::Unretained(this), - SnapDirection::kSecondary)), + SnapDirection::kSecondary), + is_portrait_mode), IDS_APP_ACCNAME_PARTIAL))); // Full screen button. @@ -85,7 +103,7 @@ std::make_unique<MultitaskBaseButton>( base::BindRepeating(&MultitaskMenuView::FullScreenButtonPressed, base::Unretained(this)), - MultitaskBaseButton::Type::kFull, + MultitaskBaseButton::Type::kFull, is_portrait_mode, l10n_util::GetStringUTF16(IDS_APP_ACCNAME_FULL)), IDS_APP_ACCNAME_FULL))); @@ -95,7 +113,7 @@ std::make_unique<MultitaskBaseButton>( base::BindRepeating(&MultitaskMenuView::FloatButtonPressed, base::Unretained(this)), - MultitaskBaseButton::Type::kFloat, + MultitaskBaseButton::Type::kFloat, is_portrait_mode, l10n_util::GetStringUTF16(IDS_APP_ACCNAME_FLOAT_ON_TOP)), IDS_APP_ACCNAME_FLOAT_ON_TOP))); }
diff --git a/chromeos/ui/frame/multitask_menu/split_button.cc b/chromeos/ui/frame/multitask_menu/split_button.cc index a9e7092..2b3d005 100644 --- a/chromeos/ui/frame/multitask_menu/split_button.cc +++ b/chromeos/ui/frame/multitask_menu/split_button.cc
@@ -20,8 +20,10 @@ constexpr int kMultitaskOneThirdButtonWidth = 38; constexpr int kMultitaskTwoThirdButtonWidth = 70; -constexpr gfx::Insets kPrimaryInsets = gfx::Insets::TLBR(4, 4, 4, 2); -constexpr gfx::Insets kSecondaryInsets = gfx::Insets::TLBR(4, 2, 4, 4); +constexpr gfx::Insets kPrimaryLandscapeInsets = gfx::Insets::TLBR(4, 4, 4, 2); +constexpr gfx::Insets kPrimaryPortraitInsets = gfx::Insets::TLBR(4, 4, 2, 4); +constexpr gfx::Insets kSecondaryLandscapeInsets = gfx::Insets::TLBR(4, 2, 4, 4); +constexpr gfx::Insets kSecondaryPortraitInsets = gfx::Insets::TLBR(2, 4, 4, 4); // TODO(shidi): Button name needs to be internationalized. const std::u16string kPrimaryButtonName = u"Split Primary"; @@ -68,20 +70,24 @@ SplitButtonView::SplitButtonView( SplitButton::SplitButtonType type, views::Button::PressedCallback primary_callback, - views::Button::PressedCallback secondary_callback) + views::Button::PressedCallback secondary_callback, + bool is_portrait_mode) : type_(type) { - SetPreferredSize(kMultitaskButtonSize); + SetOrientation(is_portrait_mode ? views::BoxLayout::Orientation::kVertical + : views::BoxLayout::Orientation::kHorizontal); + SetPreferredSize(is_portrait_mode ? kMultitaskButtonPortraitSize + : kMultitaskButtonLandscapeSize); auto primary_hover_callback = base::BindRepeating( &SplitButtonView::OnButtonHovered, base::Unretained(this)); auto secondary_hover_callback = base::BindRepeating( &SplitButtonView::OnButtonHovered, base::Unretained(this)); - primary_button_ = AddChildView( - std::make_unique<SplitButton>(primary_callback, primary_hover_callback, - kPrimaryButtonName, kPrimaryInsets)); + primary_button_ = AddChildView(std::make_unique<SplitButton>( + primary_callback, primary_hover_callback, kPrimaryButtonName, + is_portrait_mode ? kPrimaryPortraitInsets : kPrimaryLandscapeInsets)); secondary_button_ = AddChildView(std::make_unique<SplitButton>( secondary_callback, secondary_hover_callback, kSecondaryButtonName, - kSecondaryInsets)); + is_portrait_mode ? kSecondaryPortraitInsets : kSecondaryLandscapeInsets)); const int primary_width = type_ == SplitButton::SplitButtonType::kHalfButtons ? kMultitaskHalfButtonWidth @@ -92,9 +98,12 @@ : kMultitaskOneThirdButtonWidth; primary_button_->SetPreferredSize( - gfx::Size(primary_width, kMultitaskHalfButtonHeight)); + is_portrait_mode ? gfx::Size(kMultitaskHalfButtonHeight, primary_width) + : gfx::Size(primary_width, kMultitaskHalfButtonHeight)); secondary_button_->SetPreferredSize( - gfx::Size(secondary_width, kMultitaskHalfButtonHeight)); + is_portrait_mode + ? gfx::Size(kMultitaskHalfButtonHeight, secondary_width) + : gfx::Size(secondary_width, kMultitaskHalfButtonHeight)); } void SplitButtonView::OnButtonHovered() {
diff --git a/chromeos/ui/frame/multitask_menu/split_button.h b/chromeos/ui/frame/multitask_menu/split_button.h index effd0b8..f1757b85 100644 --- a/chromeos/ui/frame/multitask_menu/split_button.h +++ b/chromeos/ui/frame/multitask_menu/split_button.h
@@ -55,7 +55,8 @@ SplitButtonView(SplitButton::SplitButtonType type, views::Button::PressedCallback primary_callback, - views::Button::PressedCallback secondary_callback); + views::Button::PressedCallback secondary_callback, + bool is_portrait_mode); SplitButtonView(const SplitButtonView&) = delete; SplitButtonView& operator=(const SplitButtonView&) = delete;
diff --git a/chromeos/ui/wm/constants.h b/chromeos/ui/wm/constants.h index 3f14483..ab68e0a 100644 --- a/chromeos/ui/wm/constants.h +++ b/chromeos/ui/wm/constants.h
@@ -16,7 +16,7 @@ // The ideal dimensions of a floated window before factoring in its minimum size // (if any) is the available work area multiplied by these ratios. constexpr float kFloatedWindowTabletWidthRatio = 0.3333333f; -constexpr float kFloatedWindowTabletHeightRatio = 0.5f; +constexpr float kFloatedWindowTabletHeightRatio = 0.8f; // The thickness of the divider when it is not being dragged. COMPONENT_EXPORT(CHROMEOS_UI_WM)
diff --git a/components/autofill_assistant/browser/suppress_keyboard_raii.cc b/components/autofill_assistant/browser/suppress_keyboard_raii.cc index 104bdec..c4f96a0b 100644 --- a/components/autofill_assistant/browser/suppress_keyboard_raii.cc +++ b/components/autofill_assistant/browser/suppress_keyboard_raii.cc
@@ -37,7 +37,9 @@ void SuppressKeyboardRAII::SuppressKeyboard(bool suppress) { web_contents()->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating(&SuppressKeyboardForFrame, suppress)); + [suppress](content::RenderFrameHost* rfh) { + SuppressKeyboardForFrame(suppress, rfh); + }); } } // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/web/element.cc b/components/autofill_assistant/browser/web/element.cc index 526ca8a..5cad65a 100644 --- a/components/autofill_assistant/browser/web/element.cc +++ b/components/autofill_assistant/browser/web/element.cc
@@ -53,18 +53,14 @@ return web_contents->GetPrimaryMainFrame(); } content::RenderFrameHost* result = nullptr; - web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating( - [](const std::string& frame_id, content::RenderFrameHost** result, - content::RenderFrameHost* render_frame_host) { - if (render_frame_host->GetDevToolsFrameToken().ToString() == - frame_id) { - *result = render_frame_host; - return content::RenderFrameHost::FrameIterationAction::kStop; - } - return content::RenderFrameHost::FrameIterationAction::kContinue; - }, - frame_id, &result)); + web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHostWithAction( + [&frame_id, &result](content::RenderFrameHost* render_frame_host) { + if (render_frame_host->GetDevToolsFrameToken().ToString() == frame_id) { + result = render_frame_host; + return content::RenderFrameHost::FrameIterationAction::kStop; + } + return content::RenderFrameHost::FrameIterationAction::kContinue; + }); return result; }
diff --git a/components/autofill_assistant/browser/web/mock_autofill_assistant_agent.cc b/components/autofill_assistant/browser/web/mock_autofill_assistant_agent.cc index 93594192..6ca5ea5f4 100644 --- a/components/autofill_assistant/browser/web/mock_autofill_assistant_agent.cc +++ b/components/autofill_assistant/browser/web/mock_autofill_assistant_agent.cc
@@ -25,13 +25,13 @@ content::WebContents* web_contents, MockAutofillAssistantAgent* agent) { web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindLambdaForTesting([agent](content::RenderFrameHost* host) { + [agent](content::RenderFrameHost* host) { host->GetRemoteAssociatedInterfaces()->OverrideBinderForTesting( mojom::AutofillAssistantAgent::Name_, base::BindRepeating( &MockAutofillAssistantAgent::BindPendingReceiver, base::Unretained(agent))); - })); + }); } } // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/web/semantic_element_finder.cc b/components/autofill_assistant/browser/web/semantic_element_finder.cc index 8b60fef..6e18ffb 100644 --- a/components/autofill_assistant/browser/web/semantic_element_finder.cc +++ b/components/autofill_assistant/browser/web/semantic_element_finder.cc
@@ -26,11 +26,6 @@ namespace { -void AddHostToList(std::vector<content::GlobalRenderFrameHostId>& host_ids, - content::RenderFrameHost* host) { - host_ids.push_back(host->GetGlobalId()); -} - ElementFinderInfoProto::SemanticInferenceStatus NodeDataStatusToSemanticInferenceStatus( mojom::NodeDataStatus node_data_status) { @@ -138,7 +133,10 @@ content::RenderFrameHost* start_frame) { std::vector<content::GlobalRenderFrameHostId> host_ids; start_frame->ForEachRenderFrameHost( - base::BindRepeating(&AddHostToList, std::ref(host_ids))); + [&host_ids](content::RenderFrameHost* host) { + host_ids.push_back(host->GetGlobalId()); + }); + const auto run_on_frame = base::BarrierCallback<std::vector<GlobalBackendNodeId>>( host_ids.size(),
diff --git a/components/content_capture/browser/onscreen_content_provider.cc b/components/content_capture/browser/onscreen_content_provider.cc index b2da426..db8755d3 100644 --- a/components/content_capture/browser/onscreen_content_provider.cc +++ b/components/content_capture/browser/onscreen_content_provider.cc
@@ -26,21 +26,19 @@ content::WebContents* web_contents) : content::WebContentsObserver(web_contents), content::WebContentsUserData<OnscreenContentProvider>(*web_contents) { - web_contents->ForEachRenderFrameHost(base::BindRepeating( - [](OnscreenContentProvider* provider, - content::RenderFrameHost* render_frame_host) { + web_contents->ForEachRenderFrameHostWithAction( + [this](content::RenderFrameHost* render_frame_host) { // Don't cross into inner WebContents since we wouldn't be notified of // its changes. if (content::WebContents::FromRenderFrameHost(render_frame_host) != - provider->web_contents()) { + this->web_contents()) { return content::RenderFrameHost::FrameIterationAction::kSkipChildren; } if (render_frame_host->IsRenderFrameLive()) { - provider->RenderFrameCreated(render_frame_host); + RenderFrameCreated(render_frame_host); } return content::RenderFrameHost::FrameIterationAction::kContinue; - }, - this)); + }); } OnscreenContentProvider::~OnscreenContentProvider() = default;
diff --git a/components/exo/shell_surface_base.cc b/components/exo/shell_surface_base.cc index d81300cc..5c7825a 100644 --- a/components/exo/shell_surface_base.cc +++ b/components/exo/shell_surface_base.cc
@@ -655,14 +655,19 @@ } void ShellSurfaceBase::SetFloat() { - // TODO(crbug.com/1347534): This currently can unset float as well, but its - // necessary until configure request is ready otherwise the window will remain - // floated forever. - chromeos::FloatControllerBase::Get()->ToggleFloat(widget_->GetNativeWindow()); + aura::Window* window = widget_->GetNativeWindow(); + if (window->GetProperty(chromeos::kWindowStateTypeKey) != + chromeos::WindowStateType::kFloated) { + chromeos::FloatControllerBase::Get()->ToggleFloat(window); + } } void ShellSurfaceBase::UnsetFloat() { - chromeos::FloatControllerBase::Get()->ToggleFloat(widget_->GetNativeWindow()); + aura::Window* window = widget_->GetNativeWindow(); + if (window->GetProperty(chromeos::kWindowStateTypeKey) == + chromeos::WindowStateType::kFloated) { + chromeos::FloatControllerBase::Get()->ToggleFloat(window); + } } void ShellSurfaceBase::SetDisplay(int64_t display_id) {
diff --git a/components/exo/wayland/protocol/aura-shell.xml b/components/exo/wayland/protocol/aura-shell.xml index 0448fac..f37bde6 100644 --- a/components/exo/wayland/protocol/aura-shell.xml +++ b/components/exo/wayland/protocol/aura-shell.xml
@@ -790,6 +790,13 @@ and at the bottom in portrait mode. </description> </entry> + <entry name="floated" value="104" since="38"> + <description summary="window is floated on top"> + The window is floated on top of other windows. One floated window is + allowed per desk. Floating a window when there is already a floated + window on the same desk will unfloat the floated window. + </description> + </entry> </enum> <event name="origin_change" since="29">
diff --git a/components/exo/wayland/zaura_shell.cc b/components/exo/wayland/zaura_shell.cc index 6101984e..e1411e1 100644 --- a/components/exo/wayland/zaura_shell.cc +++ b/components/exo/wayland/zaura_shell.cc
@@ -794,6 +794,9 @@ if (state_type == chromeos::WindowStateType::kSecondarySnapped) AddState(&states, ZAURA_TOPLEVEL_STATE_SNAPPED_SECONDARY); + if (state_type == chromeos::WindowStateType::kFloated) + AddState(&states, ZAURA_TOPLEVEL_STATE_FLOATED); + if (state_type == chromeos::WindowStateType::kMinimized) AddState(&states, ZAURA_TOPLEVEL_STATE_MINIMIZED);
diff --git a/components/file_access/scoped_file_access_delegate_unittest.cc b/components/file_access/scoped_file_access_delegate_unittest.cc index 65bbdfe..9004642d 100644 --- a/components/file_access/scoped_file_access_delegate_unittest.cc +++ b/components/file_access/scoped_file_access_delegate_unittest.cc
@@ -16,7 +16,7 @@ const std::vector<base::FilePath>& files, const GURL& destination_url, base::OnceCallback<void(file_access::ScopedFileAccess)> callback) - override{}; + override {} }; int ScopedFileAccessDelegateTestInstance::instance_counter = 0; } // namespace file_access
diff --git a/components/guest_view/browser/test_guest_view_manager.cc b/components/guest_view/browser/test_guest_view_manager.cc index 55d4fa09..f42ab97 100644 --- a/components/guest_view/browser/test_guest_view_manager.cc +++ b/components/guest_view/browser/test_guest_view_manager.cc
@@ -77,6 +77,11 @@ } } +void TestGuestViewManager::WaitForFirstGuestDeleted() { + // Wait for the first guest that was created to be deleted. + guest_view_watchers_.front()->Wait(); +} + void TestGuestViewManager::WaitForLastGuestDeleted() { // Wait for the last guest that was created to be deleted. guest_view_watchers_.back()->Wait();
diff --git a/components/guest_view/browser/test_guest_view_manager.h b/components/guest_view/browser/test_guest_view_manager.h index 0466f30..1d3151ad 100644 --- a/components/guest_view/browser/test_guest_view_manager.h +++ b/components/guest_view/browser/test_guest_view_manager.h
@@ -30,7 +30,7 @@ ~TestGuestViewManager() override; void WaitForAllGuestsDeleted(); - + void WaitForFirstGuestDeleted(); void WaitForLastGuestDeleted(); // While the GuestViewBase directly represents a guest view, the
diff --git a/components/history/core/browser/history_backend_db_unittest.cc b/components/history/core/browser/history_backend_db_unittest.cc index 2e214edc..2c743655 100644 --- a/components/history/core/browser/history_backend_db_unittest.cc +++ b/components/history/core/browser/history_backend_db_unittest.cc
@@ -2839,6 +2839,15 @@ // pre-exists, so adding the NEXT migration doesn't require reverse engineering. // If you introduce a new migration, add a test for it above, and add a new // history.n.sql file for the new DB layout so that this test keeps passing. +// SQL schemas can change without migrations, so make sure to verify the +// history.n-1.sql is up-to-date by re-creating. The flow to create a migration +// n should be: +// 1) There should already exist history.n-1.sql. +// 2) Re-create history.n-1.sql to make sure it hasn't changed since it was +// created. +// 3) Add a migration test beginning with `CreateDBVersion(n-1)` and ending with +// `ASSERT_GE(HistoryDatabase::GetCurrentVersion(), n);` +// 4) Create history.n.sql. TEST_F(HistoryBackendDBTest, VerifyTestSQLFileForCurrentVersionAlreadyExists) { ASSERT_NO_FATAL_FAILURE( CreateDBVersion(HistoryDatabase::GetCurrentVersion()));
diff --git a/components/history/core/browser/visit_annotations_database.cc b/components/history/core/browser/visit_annotations_database.cc index e3ec1c2e..8587c9c 100644 --- a/components/history/core/browser/visit_annotations_database.cc +++ b/components/history/core/browser/visit_annotations_database.cc
@@ -273,6 +273,13 @@ return false; } + // Index for `cluster_keywords` table. + if (!GetDB().Execute( + "CREATE INDEX IF NOT EXISTS cluster_keywords_cluster_id_index ON " + "cluster_keywords(cluster_id)")) { + return false; + } + // Represents the one-to-many relationship of `ClusterVisit`s and its // duplicates: `DuplicateClusterVisit`s. if (!GetDB().Execute("CREATE TABLE IF NOT EXISTS cluster_visit_duplicates(" @@ -1011,39 +1018,13 @@ CreateClustersTable() && CreateClustersAndVisitsTableAndIndex(); } -bool VisitAnnotationsDatabase::CreateClustersTable() { - return GetDB().Execute( - "CREATE TABLE IF NOT EXISTS clusters(" - "cluster_id INTEGER PRIMARY KEY," - "should_show_on_prominent_ui_surfaces BOOLEAN NOT NULL," - "label VARCHAR NOT NULL," - "raw_label VARCHAR NOT NULL)"); -} - -bool VisitAnnotationsDatabase::CreateClustersAndVisitsTableAndIndex() { - return GetDB().Execute( - "CREATE TABLE IF NOT EXISTS clusters_and_visits(" - "cluster_id INTEGER NOT NULL," - "visit_id INTEGER NOT NULL," - "score NUMERIC NOT NULL," - "engagement_score NUMERIC NOT NULL," - "url_for_deduping LONGVARCHAR NOT NULL," - "normalized_url LONGVARCHAR NOT NULL," - "url_for_display LONGVARCHAR NOT NULL," - "PRIMARY KEY(cluster_id,visit_id))" - "WITHOUT ROWID") && - GetDB().Execute( - "CREATE INDEX IF NOT EXISTS clusters_for_visit ON " - "clusters_and_visits(visit_id)"); -} - bool VisitAnnotationsDatabase::MigrateAnnotationsAddColumnsForSync() { if (!GetDB().DoesTableExist("context_annotations")) { NOTREACHED() << " Context annotations table should exist before migration"; return false; } - // ConteXt annotation columns: + // Context annotation columns: if (!GetDB().DoesColumnExist("context_annotations", "browser_type")) { if (!GetDB().Execute( @@ -1098,7 +1079,7 @@ } } - // ConteNt annotation columns: + // Content annotation columns: if (!GetDB().DoesColumnExist("content_annotations", "page_language")) { if (!GetDB().Execute("ALTER TABLE content_annotations " @@ -1118,4 +1099,30 @@ return true; } +bool VisitAnnotationsDatabase::CreateClustersTable() { + return GetDB().Execute( + "CREATE TABLE IF NOT EXISTS clusters(" + "cluster_id INTEGER PRIMARY KEY," + "should_show_on_prominent_ui_surfaces BOOLEAN NOT NULL," + "label VARCHAR NOT NULL," + "raw_label VARCHAR NOT NULL)"); +} + +bool VisitAnnotationsDatabase::CreateClustersAndVisitsTableAndIndex() { + return GetDB().Execute( + "CREATE TABLE IF NOT EXISTS clusters_and_visits(" + "cluster_id INTEGER NOT NULL," + "visit_id INTEGER NOT NULL," + "score NUMERIC NOT NULL," + "engagement_score NUMERIC NOT NULL," + "url_for_deduping LONGVARCHAR NOT NULL," + "normalized_url LONGVARCHAR NOT NULL," + "url_for_display LONGVARCHAR NOT NULL," + "PRIMARY KEY(cluster_id,visit_id))" + "WITHOUT ROWID") && + GetDB().Execute( + "CREATE INDEX IF NOT EXISTS clusters_for_visit ON " + "clusters_and_visits(visit_id)"); +} + } // namespace history
diff --git a/components/history_clusters/core/config.cc b/components/history_clusters/core/config.cc index bc2730a..4fbca915 100644 --- a/components/history_clusters/core/config.cc +++ b/components/history_clusters/core/config.cc
@@ -91,12 +91,12 @@ omnibox_action_on_navigation_intents = base::GetFieldTrialParamByFeatureAsBool( - internal::kOmniboxAction, "omnibox_action_on_navigation_intents", + internal::kJourneys, "omnibox_action_on_navigation_intents", omnibox_action_on_navigation_intents); omnibox_action_navigation_intent_score_threshold = base::GetFieldTrialParamByFeatureAsInt( - internal::kOmniboxAction, + internal::kJourneys, "omnibox_action_on_navigation_intent_score_threshold", omnibox_action_navigation_intent_score_threshold); @@ -107,6 +107,12 @@ omnibox_history_cluster_provider = base::FeatureList::IsEnabled(internal::kOmniboxHistoryClusterProvider); + omnibox_history_cluster_provider_counterfactual = + base::GetFieldTrialParamByFeatureAsBool( + internal::kOmniboxHistoryClusterProvider, + "omnibox_history_cluster_provider_counterfactual", + omnibox_history_cluster_provider_counterfactual); + omnibox_history_cluster_provider_score = base::GetFieldTrialParamByFeatureAsInt( internal::kOmniboxHistoryClusterProvider,
diff --git a/components/history_clusters/core/config.h b/components/history_clusters/core/config.h index 5c8e015..a2231919 100644 --- a/components/history_clusters/core/config.h +++ b/components/history_clusters/core/config.h
@@ -119,6 +119,12 @@ // only have 1 enabled. bool omnibox_history_cluster_provider = false; + // If `omnibox_history_cluster_provider` is enabled, hides its suggestions but + // counterfactual logs when it has suggestions (though not necessarily shown + // suggestions). Does nothing if `omnibox_history_cluster_provider` is + // disabled. + bool omnibox_history_cluster_provider_counterfactual = false; + // The score the `HistoryClusterProvider` will assign to journey suggestions. // Meaningless if `omnibox_history_cluster_provider` is disabled. 900 seems to // work well in local tests. It's high enough to outscore search suggestions
diff --git a/components/js_injection/browser/js_communication_host.cc b/components/js_injection/browser/js_communication_host.cc index e171897..3a952f60 100644 --- a/components/js_injection/browser/js_communication_host.cc +++ b/components/js_injection/browser/js_communication_host.cc
@@ -5,6 +5,7 @@ #include "components/js_injection/browser/js_communication_host.h" #include "base/bind.h" +#include "base/functional/function_ref.h" #include "base/strings/utf_string_conversions.h" #include "components/js_injection/browser/js_to_browser_messaging.h" #include "components/js_injection/browser/web_message_host.h" @@ -32,22 +33,20 @@ // any inner WebContents. void ForEachRenderFrameHostWithinSameWebContents( content::RenderFrameHost* render_frame_host, - content::RenderFrameHost::FrameIterationAlwaysContinueCallback callback) { - render_frame_host->ForEachRenderFrameHost(base::BindRepeating( - [](const content::WebContents* starting_web_contents, - content::RenderFrameHost::FrameIterationAlwaysContinueCallback - callback, - content::RenderFrameHost* rfh) { + base::FunctionRef<void(content::RenderFrameHost*)> func_ref) { + render_frame_host->ForEachRenderFrameHostWithAction( + [starting_web_contents = + content::WebContents::FromRenderFrameHost(render_frame_host), + func_ref](content::RenderFrameHost* rfh) { // Don't cross into inner WebContents since we wouldn't be notified of // its changes. if (content::WebContents::FromRenderFrameHost(rfh) != starting_web_contents) { return content::RenderFrameHost::FrameIterationAction::kSkipChildren; } - callback.Run(rfh); + func_ref(rfh); return content::RenderFrameHost::FrameIterationAction::kContinue; - }, - content::WebContents::FromRenderFrameHost(render_frame_host), callback)); + }); } } // namespace @@ -116,9 +115,10 @@ ForEachRenderFrameHostWithinSameWebContents( web_contents()->GetPrimaryMainFrame(), - base::BindRepeating( - &JsCommunicationHost::NotifyFrameForAddDocumentStartJavaScript, - base::Unretained(this), &*scripts_.rbegin())); + [this](content::RenderFrameHost* render_frame_host) { + NotifyFrameForAddDocumentStartJavaScript(&*scripts_.rbegin(), + render_frame_host); + }); result.script_id = scripts_.rbegin()->script_id_; return result; } @@ -129,9 +129,10 @@ scripts_.erase(it); ForEachRenderFrameHostWithinSameWebContents( web_contents()->GetPrimaryMainFrame(), - base::BindRepeating( - &JsCommunicationHost::NotifyFrameForRemoveDocumentStartJavaScript, - base::Unretained(this), script_id)); + [this, script_id](content::RenderFrameHost* render_frame_host) { + NotifyFrameForRemoveDocumentStartJavaScript(script_id, + render_frame_host); + }); return true; } } @@ -159,9 +160,9 @@ ForEachRenderFrameHostWithinSameWebContents( web_contents()->GetPrimaryMainFrame(), - base::BindRepeating( - &JsCommunicationHost::NotifyFrameForWebMessageListener, - base::Unretained(this))); + [this](content::RenderFrameHost* render_frame_host) { + NotifyFrameForWebMessageListener(render_frame_host); + }); return std::u16string(); } @@ -173,9 +174,9 @@ js_objects_.erase(iterator); ForEachRenderFrameHostWithinSameWebContents( web_contents()->GetPrimaryMainFrame(), - base::BindRepeating( - &JsCommunicationHost::NotifyFrameForWebMessageListener, - base::Unretained(this))); + [this](content::RenderFrameHost* render_frame_host) { + NotifyFrameForWebMessageListener(render_frame_host); + }); break; } }
diff --git a/components/media_control/browser/media_blocker.cc b/components/media_control/browser/media_blocker.cc index 00da371..6d35cec 100644 --- a/components/media_control/browser/media_blocker.cc +++ b/components/media_control/browser/media_blocker.cc
@@ -43,15 +43,12 @@ if (!web_contents()) return; - web_contents()->ForEachRenderFrameHost(base::BindRepeating( - [](MediaBlocker* media_blocker, - content::RenderFrameHost* render_frame_host) { + web_contents()->ForEachRenderFrameHost( + [this](content::RenderFrameHost* render_frame_host) { if (render_frame_host->IsRenderFrameLive()) { - media_blocker->UpdateRenderFrameMediaLoadingBlockedState( - render_frame_host); + UpdateRenderFrameMediaLoadingBlockedState(render_frame_host); } - }, - this)); + }); } void MediaBlocker::UpdateRenderFrameMediaLoadingBlockedState(
diff --git a/components/offline_pages/content/background_loader/DEPS b/components/offline_pages/content/background_loader/DEPS index 974b340..9218b049 100644 --- a/components/offline_pages/content/background_loader/DEPS +++ b/components/offline_pages/content/background_loader/DEPS
@@ -4,4 +4,5 @@ "+content/public/common/window_container_type.mojom-shared.h", "+third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h", "+third_party/blink/public/mojom/mediastream/media_stream.mojom.h", + "+third_party/blink/public/mojom/window_features/window_features.mojom.h", ]
diff --git a/components/offline_pages/content/background_loader/background_loader_contents.cc b/components/offline_pages/content/background_loader/background_loader_contents.cc index 18671155..40e1d83 100644 --- a/components/offline_pages/content/background_loader/background_loader_contents.cc +++ b/components/offline_pages/content/background_loader/background_loader_contents.cc
@@ -94,7 +94,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) { // Pop-ups should be blocked;
diff --git a/components/offline_pages/content/background_loader/background_loader_contents.h b/components/offline_pages/content/background_loader/background_loader_contents.h index c6bd5c19..58c032f 100644 --- a/components/offline_pages/content/background_loader/background_loader_contents.h +++ b/components/offline_pages/content/background_loader/background_loader_contents.h
@@ -73,7 +73,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override;
diff --git a/components/offline_pages/content/background_loader/background_loader_contents_unittest.cc b/components/offline_pages/content/background_loader/background_loader_contents_unittest.cc index 01898850..85323954 100644 --- a/components/offline_pages/content/background_loader/background_loader_contents_unittest.cc +++ b/components/offline_pages/content/background_loader/background_loader_contents_unittest.cc
@@ -13,6 +13,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" #include "url/gurl.h" namespace background_loader { @@ -154,8 +155,8 @@ std::unique_ptr<content::WebContents>() /* new_contents */, GURL() /* target_url */, WindowOpenDisposition::CURRENT_TAB /* disposition */, - gfx::Rect() /* initial_rect */, false /* user_gesture */, - &blocked /* was_blocked */); + blink::mojom::WindowFeatures() /* window_features */, + false /* user_gesture */, &blocked /* was_blocked */); ASSERT_TRUE(blocked); }
diff --git a/components/omnibox/browser/history_cluster_provider.cc b/components/omnibox/browser/history_cluster_provider.cc index 0c0a9704..d01365a 100644 --- a/components/omnibox/browser/history_cluster_provider.cc +++ b/components/omnibox/browser/history_cluster_provider.cc
@@ -108,7 +108,12 @@ for (const auto& search_match : search_provider_->matches()) { if (client_->GetHistoryClustersService()->DoesQueryMatchAnyCluster( base::UTF16ToUTF8(search_match.contents))) { - matches_.push_back(CreateMatch(search_match.contents)); + client_->GetOmniboxTriggeredFeatureService()->FeatureTriggered( + OmniboxTriggeredFeatureService::Feature::kHistoryClusterSuggestion); + if (!history_clusters::GetConfig() + .omnibox_history_cluster_provider_counterfactual) { + matches_.push_back(CreateMatch(search_match.contents)); + } return true; } }
diff --git a/components/omnibox/browser/history_cluster_provider_unittest.cc b/components/omnibox/browser/history_cluster_provider_unittest.cc index 0daa541..95e9e93 100644 --- a/components/omnibox/browser/history_cluster_provider_unittest.cc +++ b/components/omnibox/browser/history_cluster_provider_unittest.cc
@@ -19,6 +19,7 @@ #include "components/omnibox/browser/autocomplete_provider_listener.h" #include "components/omnibox/browser/fake_autocomplete_provider.h" #include "components/omnibox/browser/fake_autocomplete_provider_client.h" +#include "components/omnibox/browser/omnibox_triggered_feature_service.h" #include "components/omnibox/browser/search_provider.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/testing_pref_service.h" @@ -272,7 +273,7 @@ EXPECT_THAT(on_provider_update_calls_, testing::ElementsAre(true)); } -TEST_F(HistoryClustersProviderTest, NoKeyworddMatches) { +TEST_F(HistoryClustersProviderTest, NoKeywordMatches) { // Test the case where none of the search matches match a keyword. AutocompleteInput input; @@ -391,3 +392,43 @@ ASSERT_EQ(provider_->matches().size(), 1u); EXPECT_THAT(on_provider_update_calls_, testing::ElementsAre(true)); } + +TEST_F(HistoryClustersProviderTest, Counterfactual) { + const auto verify_feature_triggered = [&](bool expected) { + auto* triggered_feature_service = + autocomplete_provider_client_->GetOmniboxTriggeredFeatureService(); + OmniboxTriggeredFeatureService::Features triggered_features; + triggered_feature_service->RecordToLogs(&triggered_features); + triggered_feature_service->ResetSession(); + if (expected) { + ASSERT_TRUE(!triggered_features.empty()); + EXPECT_EQ( + *triggered_features.begin(), + OmniboxTriggeredFeatureService::Feature::kHistoryClusterSuggestion); + } else + EXPECT_TRUE(triggered_features.empty()); + }; + + AutocompleteInput input; + input.set_omit_asynchronous_matches(false); + + // When there are no matches, should not log the feature triggered. + search_provider_->done_ = true; + provider_->Start(input, false); + EXPECT_TRUE(provider_->matches().empty()); + verify_feature_triggered(false); + + // When there are matches, should log the feature triggered. + search_provider_->matches_ = {CreateMatch(u"keyword")}; + provider_->Start(input, false); + EXPECT_FALSE(provider_->matches().empty()); + verify_feature_triggered(true); + + // When the CF param is true and there are matches, should (a) log the feature + // triggered and (b) hide the matches. + config_.omnibox_history_cluster_provider_counterfactual = true; + history_clusters::SetConfigForTesting(config_); + provider_->Start(input, false); + EXPECT_TRUE(provider_->matches().empty()); + verify_feature_triggered(true); +}
diff --git a/components/omnibox/browser/omnibox_triggered_feature_service.h b/components/omnibox/browser/omnibox_triggered_feature_service.h index 5e34ce6..8b5d948 100644 --- a/components/omnibox/browser/omnibox_triggered_feature_service.h +++ b/components/omnibox/browser/omnibox_triggered_feature_service.h
@@ -22,7 +22,8 @@ kBookmarkPaths = 1, kShortBookmarkSuggestionsByTotalInputLength = 2, kFuzzyUrlSuggestions = 3, - kMaxValue = kFuzzyUrlSuggestions, + kHistoryClusterSuggestion = 4, + kMaxValue = kHistoryClusterSuggestion, }; using Features = std::set<Feature>;
diff --git a/components/page_load_metrics/browser/observers/ad_metrics/ads_page_load_metrics_observer.cc b/components/page_load_metrics/browser/observers/ad_metrics/ads_page_load_metrics_observer.cc index a8f9dac..11abe8a 100644 --- a/components/page_load_metrics/browser/observers/ad_metrics/ads_page_load_metrics_observer.cc +++ b/components/page_load_metrics/browser/observers/ad_metrics/ads_page_load_metrics_observer.cc
@@ -1316,19 +1316,18 @@ // be available in the the unload handler. std::string report_message = GetHeavyAdReportMessage(*frame_data, action == HeavyAdAction::kUnload); - render_frame_host->ForEachRenderFrameHost(base::BindRepeating( - [](const std::string& report_message, const content::Page* page, - content::RenderFrameHost* frame) { + render_frame_host->ForEachRenderFrameHostWithAction( + [&report_message, + &page = render_frame_host->GetPage()](content::RenderFrameHost* frame) { // If `frame`'s page doesn't match the one we are associated with (for // fenced frames or portals) skip the subtree. - if (page != &frame->GetPage()) + if (&page != &frame->GetPage()) return content::RenderFrameHost::FrameIterationAction::kSkipChildren; - const char kReportId[] = "HeavyAdIntervention"; + static constexpr char kReportId[] = "HeavyAdIntervention"; if (frame->IsRenderFrameLive()) frame->SendInterventionReport(kReportId, report_message); return content::RenderFrameHost::FrameIterationAction::kContinue; - }, - report_message, &render_frame_host->GetPage())); + }); // Report intervention to the blocklist. if (auto* blocklist = GetHeavyAdBlocklist()) {
diff --git a/components/paint_preview/browser/paint_preview_client.cc b/components/paint_preview/browser/paint_preview_client.cc index 1aa9e54..a45dfc4 100644 --- a/components/paint_preview/browser/paint_preview_client.cc +++ b/components/paint_preview/browser/paint_preview_client.cc
@@ -95,14 +95,12 @@ base::flat_set<base::UnguessableToken> CreateAcceptedTokenList( content::RenderFrameHost* render_frame_host) { std::vector<base::UnguessableToken> tokens; - render_frame_host->ForEachRenderFrameHost(base::BindRepeating( - [](std::vector<base::UnguessableToken>* tokens, - content::RenderFrameHost* rfh) { + render_frame_host->ForEachRenderFrameHost( + [&tokens](content::RenderFrameHost* rfh) { auto maybe_token = rfh->GetEmbeddingToken(); if (maybe_token.has_value()) - tokens->push_back(maybe_token.value()); - }, - &tokens)); + tokens.push_back(maybe_token.value()); + }); return base::flat_set<base::UnguessableToken>(std::move(tokens)); }
diff --git a/components/performance_manager/performance_manager_tab_helper.cc b/components/performance_manager/performance_manager_tab_helper.cc index 69f04000..d10aad10 100644 --- a/components/performance_manager/performance_manager_tab_helper.cc +++ b/components/performance_manager/performance_manager_tab_helper.cc
@@ -88,11 +88,10 @@ #if DCHECK_IS_ON() DCHECK(!web_contents->GetPrimaryMainFrame()->IsRenderFrameLive()); size_t frame_count = 0; - web_contents->ForEachRenderFrameHost(base::BindRepeating( - [](size_t* frame_count, content::RenderFrameHost* render_frame_host) { - (*frame_count)++; - }, - &frame_count)); + web_contents->ForEachRenderFrameHost( + [&frame_count](content::RenderFrameHost* render_frame_host) { + ++frame_count; + }); DCHECK_EQ(1u, frame_count); #endif
diff --git a/components/permissions/permission_actions_history.cc b/components/permissions/permission_actions_history.cc index 42fc41d..a9fd53d5 100644 --- a/components/permissions/permission_actions_history.cc +++ b/components/permissions/permission_actions_history.cc
@@ -82,33 +82,34 @@ RequestType type, PermissionPromptDisposition prompt_disposition) { DictionaryPrefUpdate update(pref_service_, prefs::kPermissionActions); + base::Value::Dict& update_dict = update->GetDict(); const base::StringPiece permission_path(PermissionKeyForRequestType(type)); - if (!update->FindPathOfType(permission_path, base::Value::Type::LIST)) { - update->SetPath(permission_path, base::Value(base::Value::Type::LIST)); + if (!update_dict.FindListByDottedPath(permission_path)) { + update_dict.SetByDottedPath(permission_path, base::Value::List()); } - base::Value* permission_actions = - update->FindPathOfType(permission_path, base::Value::Type::LIST); + base::Value::List* permission_actions = + update_dict.FindListByDottedPath(permission_path); CHECK(permission_actions); // Discard permission actions older than |kPermissionActionMaxAge|. const base::Time cutoff = base::Time::Now() - kPermissionActionMaxAge; - permission_actions->EraseListValueIf([cutoff](const base::Value& entry) { - const absl::optional<base::Time> timestamp = - base::ValueToTime(entry.FindKey(kPermissionActionEntryTimestampKey)); + permission_actions->EraseIf([cutoff](const base::Value& entry) { + const absl::optional<base::Time> timestamp = base::ValueToTime( + entry.GetDict().Find(kPermissionActionEntryTimestampKey)); return !timestamp || *timestamp < cutoff; }); // Record the new permission action. - base::DictionaryValue new_action_attributes; - new_action_attributes.SetKey(kPermissionActionEntryTimestampKey, - base::TimeToValue(base::Time::Now())); - new_action_attributes.SetIntKey(kPermissionActionEntryActionKey, - static_cast<int>(action)); - new_action_attributes.SetIntKey(kPermissionActionEntryPromptDispositionKey, - static_cast<int>(prompt_disposition)); + base::Value::Dict new_action_attributes; + new_action_attributes.Set(kPermissionActionEntryTimestampKey, + base::TimeToValue(base::Time::Now())); + new_action_attributes.Set(kPermissionActionEntryActionKey, + static_cast<int>(action)); + new_action_attributes.Set(kPermissionActionEntryPromptDispositionKey, + static_cast<int>(prompt_disposition)); permission_actions->Append(std::move(new_action_attributes)); } @@ -122,11 +123,11 @@ DictionaryPrefUpdate update(pref_service_, prefs::kPermissionActions); - for (auto permission_entry : update->DictItems()) { - permission_entry.second.EraseListValueIf([delete_begin, - delete_end](const auto& entry) { - const absl::optional<base::Time> timestamp = - base::ValueToTime(entry.FindKey(kPermissionActionEntryTimestampKey)); + for (auto permission_entry : update->GetDict()) { + permission_entry.second.GetList().EraseIf([delete_begin, + delete_end](const auto& entry) { + const absl::optional<base::Time> timestamp = base::ValueToTime( + entry.GetDict().Find(kPermissionActionEntryTimestampKey)); return (!timestamp || (*timestamp >= delete_begin && *timestamp < delete_end)); }); @@ -140,17 +141,18 @@ PermissionActionsHistory::GetHistoryInternal(const base::Time& begin, const std::string& key, EntryFilter entry_filter) { - const base::Value* permission_actions = - pref_service_->GetDictionary(prefs::kPermissionActions)->FindListKey(key); + const base::Value::List* permission_actions = + pref_service_->GetValueDict(prefs::kPermissionActions).FindList(key); if (!permission_actions) return {}; std::vector<Entry> matching_actions; - for (const auto& entry : permission_actions->GetListDeprecated()) { + for (const auto& entry : *permission_actions) { + const base::Value::Dict& entry_dict = entry.GetDict(); const absl::optional<base::Time> timestamp = - base::ValueToTime(entry.FindKey(kPermissionActionEntryTimestampKey)); + base::ValueToTime(entry_dict.Find(kPermissionActionEntryTimestampKey)); if (timestamp < begin) continue; @@ -159,7 +161,7 @@ // If we want either the Loud or Quiet UI actions but don't have this // info due to legacy reasons we ignore the entry. const absl::optional<int> prompt_disposition_int = - entry.FindIntKey(kPermissionActionEntryPromptDispositionKey); + entry_dict.FindInt(kPermissionActionEntryPromptDispositionKey); if (!prompt_disposition_int) continue; @@ -177,7 +179,7 @@ } } const PermissionAction past_action = static_cast<PermissionAction>( - *(entry.FindIntKey(kPermissionActionEntryActionKey))); + *(entry_dict.FindInt(kPermissionActionEntryActionKey))); matching_actions.emplace_back( PermissionActionsHistory::Entry{past_action, timestamp.value()}); }
diff --git a/components/remote_cocoa/app_shim/BUILD.gn b/components/remote_cocoa/app_shim/BUILD.gn index 06246a1..d92d24e 100644 --- a/components/remote_cocoa/app_shim/BUILD.gn +++ b/components/remote_cocoa/app_shim/BUILD.gn
@@ -31,6 +31,9 @@ "color_panel_bridge.h", "color_panel_bridge.mm", "drag_drop_client.h", + "immersive_mode_controller.h", + "immersive_mode_controller.mm", + "immersive_mode_delegate_mac.h", "mouse_capture.h", "mouse_capture.mm", "mouse_capture_delegate.h",
diff --git a/components/remote_cocoa/app_shim/immersive_mode_controller.h b/components/remote_cocoa/app_shim/immersive_mode_controller.h new file mode 100644 index 0000000..c09c75c5 --- /dev/null +++ b/components/remote_cocoa/app_shim/immersive_mode_controller.h
@@ -0,0 +1,55 @@ +// Copyright 2022 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. + +#ifndef COMPONENTS_REMOTE_COCOA_APP_SHIM_IMMERSIVE_MODE_CONTROLLER_H_ +#define COMPONENTS_REMOTE_COCOA_APP_SHIM_IMMERSIVE_MODE_CONTROLLER_H_ + +#include <AppKit/AppKit.h> + +#include "base/mac/scoped_nsobject.h" +#include "components/remote_cocoa/app_shim/remote_cocoa_app_shim_export.h" + +@class ImmersiveModeMapper; +@class ImmersiveModeTitlebarViewController; + +namespace gfx { +class Rect; +} + +namespace remote_cocoa { + +// TODO(mek): This should not be exported and used outside of remote_cocoa. So +// figure out how to restructure code so callers outside of remote_cocoa can +// stop existing. +REMOTE_COCOA_APP_SHIM_EXPORT bool IsNSToolbarFullScreenWindow(NSWindow* window); + +class REMOTE_COCOA_APP_SHIM_EXPORT ImmersiveModeController { + public: + class Delegate { + public: + virtual void TopViewWillAppear() = 0; + virtual void TopViewDidAppear(NSView* content_view) = 0; + }; + + explicit ImmersiveModeController(Delegate* delegate, + NSWindow* browser_widget, + NSWindow* overlay_widget); + ~ImmersiveModeController(); + + void OnTopViewBoundsChanged(const gfx::Rect& bounds); + void SetAlwaysShowFullscreenToolbar(bool show); + + private: + Delegate* const delegate_; + NSWindow* const browser_widget_; + NSWindow* const overlay_widget_; + + base::scoped_nsobject<ImmersiveModeTitlebarViewController> + immersive_mode_titlebar_view_controller_; + base::scoped_nsobject<ImmersiveModeMapper> immersive_mode_mapper_; +}; + +} // namespace remote_cocoa + +#endif // COMPONENTS_REMOTE_COCOA_APP_SHIM_IMMERSIVE_MODE_CONTROLLER_H_ \ No newline at end of file
diff --git a/components/remote_cocoa/app_shim/immersive_mode_controller.mm b/components/remote_cocoa/app_shim/immersive_mode_controller.mm new file mode 100644 index 0000000..01f75da --- /dev/null +++ b/components/remote_cocoa/app_shim/immersive_mode_controller.mm
@@ -0,0 +1,178 @@ +// Copyright 2022 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 "components/remote_cocoa/app_shim/immersive_mode_controller.h" + +#include <AppKit/AppKit.h> + +#include "base/check.h" +#include "base/logging.h" +#include "base/mac/foundation_util.h" +#include "base/mac/scoped_block.h" +#include "components/remote_cocoa/app_shim/bridged_content_view.h" +#include "components/remote_cocoa/app_shim/immersive_mode_delegate_mac.h" + +// A stub NSWindowDelegate class that will be used to map the AppKit controlled +// NSWindow to the overlay view widget's NSWindow. The delegate will be used to +// help with input routing. +@interface ImmersiveModeMapper : NSObject <ImmersiveModeDelegate> +@property(assign) NSWindow* originalHostingWindow; +@end + +@implementation ImmersiveModeMapper +@synthesize originalHostingWindow = _originalHostingWindow; +@end + +// Host of the overlay view. +@interface ImmersiveModeTitlebarViewController + : NSTitlebarAccessoryViewController { + base::mac::ScopedBlock<void (^)()> _view_will_appear_block; + base::mac::ScopedBlock<void (^)()> _view_did_appear_block; +} +@end + +@implementation ImmersiveModeTitlebarViewController + +- (instancetype)initWithHandlers:(void (^)())viewWillAppearBlock + viewDidAppearBlock:(void (^)())viewDidAppearBlock { + if ((self = [super init])) { + _view_will_appear_block.reset([viewWillAppearBlock copy]); + _view_did_appear_block.reset([viewDidAppearBlock copy]); + } + return self; +} + +- (void)viewWillAppear { + [super viewWillAppear]; + _view_will_appear_block.get()(); + + // TODO(bur): Get the updated width from OnViewBoundsChanged + NSView* tab_view = self.view; + NSRect f = tab_view.frame; + f.size.width = 2400; + tab_view.frame = f; + for (NSView* view in tab_view.subviews) { + if ([view isKindOfClass:[BridgedContentView class]]) { + view.frame = tab_view.frame; + } + } +} + +- (void)viewDidAppear { + [super viewDidAppear]; + _view_did_appear_block.get()(); +} + +@end + +// An NSView that will set the ImmersiveModeDelegate on the AppKit created +// window that ends up hosting this view via the +// NSTitlebarAccessoryViewController API. +@interface ImmersiveModeView : NSView +- (instancetype)initWithImmersiveModeDelegate: + (id<ImmersiveModeDelegate>)delegate; +@end + +@implementation ImmersiveModeView { + ImmersiveModeMapper* _fullscreenDelegate; +} + +- (instancetype)initWithImmersiveModeDelegate: + (id<ImmersiveModeDelegate>)delegate { + self = [super init]; + if (self) { + _fullscreenDelegate = delegate; + } + return self; +} + +- (void)viewWillMoveToWindow:(NSWindow*)window { + if (remote_cocoa::IsNSToolbarFullScreenWindow(window)) { + // This window is created by AppKit. Make sure it doesn't have a delegate so + // we can use it for out own purposes. + DCHECK(!window.delegate); + window.delegate = _fullscreenDelegate; + } +} + +@end + +namespace remote_cocoa { + +bool IsNSToolbarFullScreenWindow(NSWindow* window) { + // TODO(bur): Investigate other approaches to detecting + // NSToolbarFullScreenWindow. This is a private class and the name could + // change. + return [window isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]; +} + +ImmersiveModeController::ImmersiveModeController(Delegate* delegate, + NSWindow* browser_widget, + NSWindow* overlay_widget) + : delegate_(delegate), + browser_widget_(browser_widget), + overlay_widget_(overlay_widget) { + // Create a new NSTitlebarAccessoryViewController that will host the + // overlay_view_. + NSView* contentView = overlay_widget_.contentView; + immersive_mode_titlebar_view_controller_.reset( + [[ImmersiveModeTitlebarViewController alloc] + initWithHandlers:^() { + delegate_->TopViewWillAppear(); + } + viewDidAppearBlock:^() { + delegate_->TopViewDidAppear(contentView); + }]); + + // Create a NSWindow delegate that will be used to map the AppKit created + // NSWindow to the overlay view widget's NSWindow. + immersive_mode_mapper_.reset([[ImmersiveModeMapper alloc] init]); + immersive_mode_mapper_.get().originalHostingWindow = overlay_widget_; + immersive_mode_titlebar_view_controller_.get().view = + [[ImmersiveModeView alloc] + initWithImmersiveModeDelegate:immersive_mode_mapper_.get()]; + + // Remove the content view from the overlay view widget's NSWindow. This + // view will be re-parented into the AppKit created NSWindow. + NSView* overlay_content_view = overlay_widget_.contentView; + [overlay_content_view removeFromSuperview]; + + // Add the overlay view to the accessory view controller and hand everything + // over to AppKit. + [immersive_mode_titlebar_view_controller_.get().view + addSubview:overlay_content_view]; + immersive_mode_titlebar_view_controller_.get().layoutAttribute = + NSLayoutAttributeBottom; + [browser_widget_ addTitlebarAccessoryViewController: + immersive_mode_titlebar_view_controller_]; +} + +ImmersiveModeController::~ImmersiveModeController() { + // Rollback the view shuffling from enablement. + NSView* overlay_content_view = + immersive_mode_titlebar_view_controller_.get().view.subviews.firstObject; + [overlay_content_view removeFromSuperview]; + overlay_widget_.contentView = overlay_content_view; + [immersive_mode_titlebar_view_controller_ removeFromParentViewController]; + [immersive_mode_titlebar_view_controller_.get().view release]; + immersive_mode_titlebar_view_controller_.reset(); + browser_widget_.styleMask |= NSWindowStyleMaskFullSizeContentView; +} + +void ImmersiveModeController::OnTopViewBoundsChanged(const gfx::Rect& bounds) { + immersive_mode_titlebar_view_controller_.get().view.frame = bounds.ToCGRect(); +} + +void ImmersiveModeController::SetAlwaysShowFullscreenToolbar(bool show) { + if (show) { + immersive_mode_titlebar_view_controller_.get().fullScreenMinHeight = + immersive_mode_titlebar_view_controller_.get().view.frame.size.height; + browser_widget_.styleMask &= ~NSWindowStyleMaskFullSizeContentView; + } else { + immersive_mode_titlebar_view_controller_.get().fullScreenMinHeight = 0; + browser_widget_.styleMask |= NSWindowStyleMaskFullSizeContentView; + } +} + +} // namespace remote_cocoa
diff --git a/components/remote_cocoa/app_shim/immersive_mode_delegate_mac.h b/components/remote_cocoa/app_shim/immersive_mode_delegate_mac.h new file mode 100644 index 0000000..1de4cd66 --- /dev/null +++ b/components/remote_cocoa/app_shim/immersive_mode_delegate_mac.h
@@ -0,0 +1,14 @@ +// Copyright 2022 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. + +#ifndef COMPONENTS_REMOTE_COCOA_APP_SHIM_IMMERSIVE_MODE_DELEGATE_MAC_H_ +#define COMPONENTS_REMOTE_COCOA_APP_SHIM_IMMERSIVE_MODE_DELEGATE_MAC_H_ + +#include <AppKit/AppKit.h> + +@protocol ImmersiveModeDelegate <NSWindowDelegate> +@property(readonly) NSWindow* originalHostingWindow; +@end + +#endif // COMPONENTS_REMOTE_COCOA_APP_SHIM_IMMERSIVE_MODE_DELEGATE_MAC_H_
diff --git a/components/safe_browsing/content/browser/threat_details.cc b/components/safe_browsing/content/browser/threat_details.cc index 84807a66..8def285e 100644 --- a/components/safe_browsing/content/browser/threat_details.cc +++ b/components/safe_browsing/content/browser/threat_details.cc
@@ -636,8 +636,9 @@ // TODO(mattm): In theory, if the user proceeds through the warning DOM // detail collection could be started once the page loads. web_contents_->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating(&ThreatDetails::RequestThreatDOMDetails, - GetWeakPtr())); + [this](content::RenderFrameHost* frame) { + RequestThreatDOMDetails(frame); + }); } }
diff --git a/components/segmentation_platform/internal/execution/processing/feature_processor_state.cc b/components/segmentation_platform/internal/execution/processing/feature_processor_state.cc index e8f149e..373c1a9 100644 --- a/components/segmentation_platform/internal/execution/processing/feature_processor_state.cc +++ b/components/segmentation_platform/internal/execution/processing/feature_processor_state.cc
@@ -30,7 +30,7 @@ FeatureProcessorState::~FeatureProcessorState() { DCHECK(callback_.is_null()); -}; +} void FeatureProcessorState::SetError(stats::FeatureProcessingError error) { stats::RecordFeatureProcessingError(segment_id_, error);
diff --git a/components/segmentation_platform/public/constants.cc b/components/segmentation_platform/public/constants.cc index b918a96..ad06c73 100644 --- a/components/segmentation_platform/public/constants.cc +++ b/components/segmentation_platform/public/constants.cc
@@ -30,6 +30,8 @@ return kContextualPageActionsUmaName; } else if (segmentation_key == kPowerUserKey) { return kPowerUserUmaName; + } else if (segmentation_key == kCrossDeviceUserKey) { + return kCrossDeviceUserUmaName; } else if (base::StartsWith(segmentation_key, "test_key")) { return "TestKey"; } @@ -66,6 +68,8 @@ return "ContextualPageActionPriceTracking"; case proto::SegmentId::POWER_USER_SEGMENT: return "PowerUserSegment"; + case proto::SegmentId::CROSS_DEVICE_USER_SEGMENT: + return "CrossDeviceUser"; default: // This case is reached when UNKNOWN segment is valid, in case of boolean // segment results.
diff --git a/components/segmentation_platform/public/constants.h b/components/segmentation_platform/public/constants.h index b121acd7..6562f6e 100644 --- a/components/segmentation_platform/public/constants.h +++ b/components/segmentation_platform/public/constants.h
@@ -49,6 +49,11 @@ const char kPowerUserKey[] = "power_user"; const char kPowerUserUmaName[] = "PowerUser"; +// The key is used to decide whether the user is active on multiple synced +// devices. +const char kCrossDeviceUserKey[] = "cross_device_user"; +const char kCrossDeviceUserUmaName[] = "CrossDeviceUser"; + // The key provide a list of segment IDs, separated by commas, whose ML model // execution results are allowed to be uploaded through UKM. const char kSegmentIdsAllowedForReportingKey[] =
diff --git a/components/segmentation_platform/public/proto/segmentation_platform.proto b/components/segmentation_platform/public/proto/segmentation_platform.proto index 11bf25d..0d28384 100644 --- a/components/segmentation_platform/public/proto/segmentation_platform.proto +++ b/components/segmentation_platform/public/proto/segmentation_platform.proto
@@ -67,4 +67,6 @@ // Determine power users of the browser app. POWER_USER_SEGMENT = 1000; + // Determine users active on multiple synced devices. + CROSS_DEVICE_USER_SEGMENT = 1001; };
diff --git a/components/signin/public/identity_manager/identity_test_environment.cc b/components/signin/public/identity_manager/identity_test_environment.cc index 7c4d172..9773e7a1 100644 --- a/components/signin/public/identity_manager/identity_test_environment.cc +++ b/components/signin/public/identity_manager/identity_test_environment.cc
@@ -38,6 +38,7 @@ #include "components/sync_preferences/testing_pref_service_syncable.h" #include "google_apis/gaia/oauth2_access_token_consumer.h" #include "services/network/test/test_url_loader_factory.h" +#include "testing/gtest/include/gtest/gtest.h" #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chromeos/ash/components/account_manager/account_manager_factory.h" @@ -457,6 +458,23 @@ identity_manager(), test_url_loader_factory(), email, gaia_id); } +std::vector<AccountInfo> +IdentityTestEnvironment::MakeAccountsAvailableWithCookies( + const std::vector<std::string>& emails) { + // Logging out existing accounts is not yet supported. + EXPECT_EQ(0u, identity_manager()->GetAccountsWithRefreshTokens().size()); + + std::vector<signin::CookieParamsForTest> cookie_accounts; + std::vector<AccountInfo> accounts_info; + for (auto email : emails) { + auto account_info = MakeAccountAvailable(email); + accounts_info.push_back(account_info); + cookie_accounts.push_back({account_info.email, account_info.gaia}); + } + SetCookieAccounts(cookie_accounts); + return accounts_info; +} + void IdentityTestEnvironment::SetRefreshTokenForAccount( const CoreAccountId& account_id) { return signin::SetRefreshTokenForAccount(identity_manager(), account_id);
diff --git a/components/signin/public/identity_manager/identity_test_environment.h b/components/signin/public/identity_manager/identity_test_environment.h index 3cf7224..d4c2469 100644 --- a/components/signin/public/identity_manager/identity_test_environment.h +++ b/components/signin/public/identity_manager/identity_test_environment.h
@@ -156,14 +156,27 @@ AccountInfo MakePrimaryAccountAvailable(const std::string& email, ConsentLevel consent_level); - // Combination of MakeAccountAvailable() and SetCookieAccounts() for a single - // account. It makes an account available for the given email address, and - // GAIA ID, setting the cookies and the refresh token that correspond uniquely - // to that email address. Blocks until the account is available. Returns the - // AccountInfo of the newly-available account. + // Combination of `MakeAccountAvailable()` and `SetCookieAccounts()` for a + // single account. It makes an account available for the given email address, + // and GAIA ID, setting the cookies and the refresh token that correspond + // uniquely to that email address. Blocks until the account is available. For + // multiple accounts, use `MakeAccountsAvailableWithCookies()` instead, as + // sequentially calling `SetCookieAccounts()` will not preserve previously set + // cookies. + // Returns the AccountInfo of the newly-available account. AccountInfo MakeAccountAvailableWithCookies(const std::string& email, const std::string& gaia_id); + // Combination of MakeAccountAvailable() and SetCookieAccounts() for a + // multiple accounts. It makes accounts available for the given email address, + // generates a GAIA ID, settings the cookies and refresh tokens that + // correspond to these email addresses. Blocks until the accounts are + // available. + // Returns the AccountInfo of the newly-available accounts, in the + // same order as the given `emails`. + std::vector<AccountInfo> MakeAccountsAvailableWithCookies( + const std::vector<std::string>& emails); + // Revokes sync consent from the primary account: the primary account is left // at ConsentLevel::kSignin. void RevokeSyncConsent();
diff --git a/components/signin/public/identity_manager/identity_test_utils.cc b/components/signin/public/identity_manager/identity_test_utils.cc index e61e80f..f51e9a6 100644 --- a/components/signin/public/identity_manager/identity_test_utils.cc +++ b/components/signin/public/identity_manager/identity_test_utils.cc
@@ -152,6 +152,17 @@ DCHECK(identity_manager->AreRefreshTokensLoaded()); } +absl::optional<signin::ConsentLevel> GetPrimaryAccountConsentLevel( + IdentityManager* identity_manager) { + if (!identity_manager->HasPrimaryAccount(signin::ConsentLevel::kSignin)) { + return absl::nullopt; + } + + return identity_manager->HasPrimaryAccount(signin::ConsentLevel::kSync) + ? signin::ConsentLevel::kSync + : signin::ConsentLevel::kSignin; +} + CoreAccountInfo SetPrimaryAccount(IdentityManager* identity_manager, const std::string& email, ConsentLevel consent_level) {
diff --git a/components/signin/public/identity_manager/identity_test_utils.h b/components/signin/public/identity_manager/identity_test_utils.h index fb972ec3..2674690 100644 --- a/components/signin/public/identity_manager/identity_test_utils.h +++ b/components/signin/public/identity_manager/identity_test_utils.h
@@ -45,6 +45,11 @@ // invoked. void WaitForRefreshTokensLoaded(IdentityManager* identity_manager); +// Returns the current exact consent level for the primary account, or +// `absl::nullopt` if there is no primary account set. +absl::optional<signin::ConsentLevel> GetPrimaryAccountConsentLevel( + IdentityManager* identity_manager); + // Sets the primary account (which must not already be set) to the given email // address with corresponding consent level, generating a GAIA ID that // corresponds uniquely to that email address. On non-ChromeOS, results in the
diff --git a/components/translate/content/browser/per_frame_content_translate_driver.cc b/components/translate/content/browser/per_frame_content_translate_driver.cc index fd7537b..2dc8c93 100644 --- a/components/translate/content/browser/per_frame_content_translate_driver.cc +++ b/components/translate/content/browser/per_frame_content_translate_driver.cc
@@ -152,9 +152,11 @@ translate_seq_no_ = IncrementSeqNo(translate_seq_no_); web_contents()->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating(&PerFrameContentTranslateDriver::TranslateFrame, - base::Unretained(this), translate_script, source_lang, - target_lang, translate_seq_no_)); + [this, &translate_script, &source_lang, + &target_lang](content::RenderFrameHost* render_frame_host) { + TranslateFrame(translate_script, source_lang, target_lang, + translate_seq_no_, render_frame_host); + }); } void PerFrameContentTranslateDriver::TranslateFrame( @@ -191,8 +193,9 @@ translate_seq_no_ = IncrementSeqNo(translate_seq_no_); web_contents()->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating(&PerFrameContentTranslateDriver::RevertFrame, - base::Unretained(this))); + [this](content::RenderFrameHost* render_frame_host) { + RevertFrame(render_frame_host); + }); } void PerFrameContentTranslateDriver::RevertFrame(
diff --git a/components/url_rewrite/browser/url_request_rewrite_rules_manager.cc b/components/url_rewrite/browser/url_request_rewrite_rules_manager.cc index fd24292a..ea9038f 100644 --- a/components/url_rewrite/browser/url_request_rewrite_rules_manager.cc +++ b/components/url_rewrite/browser/url_request_rewrite_rules_manager.cc
@@ -77,9 +77,10 @@ content::WebContents* web_contents, const scoped_refptr<UrlRequestRewriteRules>& cached_rules) : content::WebContentsObserver(web_contents), cached_rules_(cached_rules) { - web_contents->ForEachRenderFrameHost(base::BindRepeating( - &UrlRequestRewriteRulesManager::Updater::MaybeRegisterExistingRenderFrame, - base::Unretained(this))); + web_contents->ForEachRenderFrameHost( + [this](content::RenderFrameHost* render_frame_host) { + MaybeRegisterExistingRenderFrame(render_frame_host); + }); } UrlRequestRewriteRulesManager::Updater::~Updater() {
diff --git a/components/variations/variations_seed_processor.h b/components/variations/variations_seed_processor.h index afcb232..624eb446 100644 --- a/components/variations/variations_seed_processor.h +++ b/components/variations/variations_seed_processor.h
@@ -57,23 +57,6 @@ private: friend void CreateTrialFromStudyFuzzer(const Study& study); - friend class VariationsSeedProcessorTest; - FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, - AllowForceGroupAndVariationId); - FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, - AllowVariationIdWithForcingFlag); - FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, - ForbidForceGroupWithVariationId); - FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag1); - FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag2); - FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, - ForceGroup_ChooseFirstGroupWithFlag); - FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, - ForceGroup_DontChooseGroupWithFlag); - FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, IsStudyExpired); - FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, VariationParams); - FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, - VariationParamsWithForcingFlag); // Check if the |study| is only associated with platform Android/iOS and // channel dev/canary. If so, forcing flag and variation id can both be set.
diff --git a/components/variations/variations_seed_processor_unittest.cc b/components/variations/variations_seed_processor_unittest.cc index a6ae5f7..e7d195e 100644 --- a/components/variations/variations_seed_processor_unittest.cc +++ b/components/variations/variations_seed_processor_unittest.cc
@@ -64,24 +64,25 @@ return experiment; } -// Populates |study| with test data used for testing associating command line -// flags with trials groups. The study will contain three groups, a default -// group that isn't associated with a flag, and two other groups, both +// Adds a Study to |seed| and populates it with test data associating command +// line flags with trials groups. The study will contain three groups, a +// default group that isn't associated with a flag, and two other groups, both // associated with different flags. -Study CreateStudyWithFlagGroups(int default_group_probability, - int flag_group1_probability, - int flag_group2_probability) { +Study* CreateStudyWithFlagGroups(int default_group_probability, + int flag_group1_probability, + int flag_group2_probability, + VariationsSeed* seed) { DCHECK_GE(default_group_probability, 0); DCHECK_GE(flag_group1_probability, 0); DCHECK_GE(flag_group2_probability, 0); - Study study; - study.set_name(kFlagStudyName); - study.set_default_experiment_name(kNonFlagGroupName); + Study* study = seed->add_study(); + study->set_name(kFlagStudyName); + study->set_default_experiment_name(kNonFlagGroupName); - AddExperiment(kNonFlagGroupName, default_group_probability, &study); - AddExperiment(kFlagGroup1Name, flag_group1_probability, &study) + AddExperiment(kNonFlagGroupName, default_group_probability, study); + AddExperiment(kFlagGroup1Name, flag_group1_probability, study) ->set_forcing_flag(kForcingFlag1); - AddExperiment(kFlagGroup2Name, flag_group2_probability, &study) + AddExperiment(kFlagGroup2Name, flag_group2_probability, study) ->set_forcing_flag(kForcingFlag2); return study; @@ -118,11 +119,69 @@ } // namespace -class VariationsSeedProcessorTest : public ::testing::Test { +// Create a ClientFilterableState with reasonable default values for Chrome. +std::unique_ptr<ClientFilterableState> CreateChromeClientFilterableState() { + auto client_state = std::make_unique<ClientFilterableState>( + base::BindOnce([] { return false; })); + client_state->locale = "en-CA"; + client_state->reference_date = base::Time::Now(); + client_state->version = base::Version("20.0.0.0"); + client_state->channel = Study::STABLE; + client_state->form_factor = Study::PHONE; + client_state->platform = Study::PLATFORM_ANDROID; + return client_state; +} + +// ChromeEnvironment calls CreateTrialsFromSeed with arguments similar to +// chrome. In particular, it passes a non-nullptr as low_entropy_source. +class ChromeEnvironment { public: - VariationsSeedProcessorTest() { + void CreateTrialsFromSeed( + const VariationsSeed& seed, + double low_entropy, + base::FeatureList* feature_list, + const VariationsSeedProcessor::UIStringOverrideCallback& callback) { + auto client_state = CreateChromeClientFilterableState(); + client_state->platform = Study::PLATFORM_ANDROID; + + base::MockEntropyProvider mock_low_entropy_provider(low_entropy); + VariationsSeedProcessor seed_processor; + // This should mimic the call through SetUpFieldTrials from + // components/variations/service/variations_service.cc + seed_processor.CreateTrialsFromSeed(seed, *client_state, callback, + &mock_low_entropy_provider, + feature_list); } + bool SupportsLayers() { return true; } +}; + +// WebViewEnvironment calls CreateTrialsFromSeed with arguments similar to +// WebView. In particular, it passes a nullptr as low_entropy_source. +class WebViewEnvironment { + public: + void CreateTrialsFromSeed( + const VariationsSeed& seed, + double low_entropy, + base::FeatureList* feature_list, + const VariationsSeedProcessor::UIStringOverrideCallback& callback) { + auto client_state = CreateChromeClientFilterableState(); + client_state->platform = Study::PLATFORM_ANDROID_WEBVIEW; + + VariationsSeedProcessor seed_processor; + // This should mimic the call through SetUpFieldTrials from + // android_webview/browser/aw_feature_list_creator.cc + seed_processor.CreateTrialsFromSeed(seed, *client_state, callback, nullptr, + feature_list); + } + + bool SupportsLayers() { return false; } +}; + +template <typename Environment> +class VariationsSeedProcessorTest : public ::testing::Test { + public: + VariationsSeedProcessorTest() = default; VariationsSeedProcessorTest(const VariationsSeedProcessorTest&) = delete; VariationsSeedProcessorTest& operator=(const VariationsSeedProcessorTest&) = delete; @@ -134,64 +193,29 @@ testing::ClearAllVariationParams(); } - bool CreateTrialFromStudy(const Study& study) { - base::MockEntropyProvider mock_low_entropy_provider(0.9); - return CreateTrialFromStudyWithFeatureListAndEntropyOverride( - study, mock_low_entropy_provider, base::FeatureList::GetInstance()); - } - - bool CreateTrialFromStudyWithEntropyOverride( - const Study& study, - const base::FieldTrial::EntropyProvider& override_entropy_provider) { - return CreateTrialFromStudyWithFeatureListAndEntropyOverride( - study, override_entropy_provider, base::FeatureList::GetInstance()); - } - - bool CreateTrialFromStudyWithFeatureList(const Study& study, - base::FeatureList* feature_list) { - base::MockEntropyProvider mock_low_entropy_provider(0.9); - return CreateTrialFromStudyWithFeatureListAndEntropyOverride( - study, mock_low_entropy_provider, feature_list); - } - - bool CreateTrialFromStudyWithFeatureListAndEntropyOverride( - const Study& study, - const base::FieldTrial::EntropyProvider& override_entropy_provider, - base::FeatureList* feature_list) { - ProcessedStudy processed_study; - const bool is_expired = internal::IsStudyExpired(study, base::Time::Now()); - if (processed_study.Init(&study, is_expired)) { - VariationsSeedProcessor().CreateTrialFromStudy( - processed_study, override_callback_.callback(), - &override_entropy_provider, feature_list); - return true; - } - return false; + void CreateTrialsFromSeed(const VariationsSeed& seed, + double low_entropy = 0.9) { + base::FeatureList feature_list; + env.CreateTrialsFromSeed(seed, low_entropy, &feature_list, + override_callback_.callback()); } void CreateTrialsFromSeed(const VariationsSeed& seed, - double low_entropy = 0.9) { - ClientFilterableState client_state(base::BindOnce([] { return false; })); - client_state.locale = "en-CA"; - client_state.reference_date = base::Time::Now(); - client_state.version = base::Version("20.0.0.0"); - client_state.channel = Study::STABLE; - client_state.form_factor = Study::PHONE; - client_state.platform = Study::PLATFORM_ANDROID; - - base::FeatureList feature_list; - base::MockEntropyProvider mock_low_entropy_provider(low_entropy); - VariationsSeedProcessor seed_processor; - seed_processor.CreateTrialsFromSeed( - seed, client_state, override_callback_.callback(), - &mock_low_entropy_provider, &feature_list); + base::FeatureList* feature_list) { + env.CreateTrialsFromSeed(seed, 0.9, feature_list, + override_callback_.callback()); } protected: + Environment env; TestOverrideStringCallback override_callback_; }; -TEST_F(VariationsSeedProcessorTest, EmitStudyCountMetric) { +using EnvironmentTypes = + ::testing::Types<ChromeEnvironment, WebViewEnvironment>; +TYPED_TEST_SUITE(VariationsSeedProcessorTest, EnvironmentTypes); + +TYPED_TEST(VariationsSeedProcessorTest, EmitStudyCountMetric) { struct StudyCountMetricTestParams { VariationsSeed seed; int expected_study_count; @@ -208,19 +232,20 @@ for (const StudyCountMetricTestParams& test_case : test_cases) { base::HistogramTester histogram_tester; - CreateTrialsFromSeed(test_case.seed); + this->CreateTrialsFromSeed(test_case.seed); histogram_tester.ExpectUniqueSample("Variations.AppliedSeed.StudyCount", test_case.expected_study_count, 1); } } -TEST_F(VariationsSeedProcessorTest, AllowForceGroupAndVariationId) { +TYPED_TEST(VariationsSeedProcessorTest, AllowForceGroupAndVariationId) { base::CommandLine::ForCurrentProcess()->AppendSwitch(kForcingFlag1); - Study study = CreateStudyWithFlagGroups(100, 0, 0); - study.mutable_experiment(1)->set_google_web_experiment_id(kExperimentId); + VariationsSeed seed; + Study* study = CreateStudyWithFlagGroups(100, 0, 0, &seed); + study->mutable_experiment(1)->set_google_web_experiment_id(kExperimentId); - EXPECT_TRUE(CreateTrialFromStudy(study)); + this->CreateTrialsFromSeed(seed); EXPECT_EQ(kFlagGroup1Name, base::FieldTrialList::FindFullName(kFlagStudyName)); @@ -229,15 +254,17 @@ EXPECT_EQ(kExperimentId, id); } -TEST_F(VariationsSeedProcessorTest, AllowForceGroupAndVariationId_FirstParty) { +TYPED_TEST(VariationsSeedProcessorTest, + AllowForceGroupAndVariationId_FirstParty) { base::CommandLine::ForCurrentProcess()->AppendSwitch(kForcingFlag1); - Study study = CreateStudyWithFlagGroups(100, 0, 0); - Study::Experiment* experiment1 = study.mutable_experiment(1); + VariationsSeed seed; + Study* study = CreateStudyWithFlagGroups(100, 0, 0, &seed); + Study::Experiment* experiment1 = study->mutable_experiment(1); experiment1->set_google_web_experiment_id(kExperimentId); experiment1->set_google_web_visibility(Study::FIRST_PARTY); - EXPECT_TRUE(CreateTrialFromStudy(study)); + this->CreateTrialsFromSeed(seed); EXPECT_EQ(kFlagGroup1Name, base::FieldTrialList::FindFullName(kFlagStudyName)); @@ -247,60 +274,65 @@ } // Test that the group for kForcingFlag1 is forced. -TEST_F(VariationsSeedProcessorTest, ForceGroupWithFlag1) { +TYPED_TEST(VariationsSeedProcessorTest, ForceGroupWithFlag1) { base::CommandLine::ForCurrentProcess()->AppendSwitch(kForcingFlag1); - Study study = CreateStudyWithFlagGroups(100, 0, 0); - EXPECT_TRUE(CreateTrialFromStudy(study)); + VariationsSeed seed; + CreateStudyWithFlagGroups(100, 0, 0, &seed); + this->CreateTrialsFromSeed(seed); EXPECT_EQ(kFlagGroup1Name, base::FieldTrialList::FindFullName(kFlagStudyName)); } // Test that the group for kForcingFlag2 is forced. -TEST_F(VariationsSeedProcessorTest, ForceGroupWithFlag2) { +TYPED_TEST(VariationsSeedProcessorTest, ForceGroupWithFlag2) { base::CommandLine::ForCurrentProcess()->AppendSwitch(kForcingFlag2); - Study study = CreateStudyWithFlagGroups(100, 0, 0); - EXPECT_TRUE(CreateTrialFromStudy(study)); + VariationsSeed seed; + CreateStudyWithFlagGroups(100, 0, 0, &seed); + this->CreateTrialsFromSeed(seed); EXPECT_EQ(kFlagGroup2Name, base::FieldTrialList::FindFullName(kFlagStudyName)); } -TEST_F(VariationsSeedProcessorTest, ForceGroup_ChooseFirstGroupWithFlag) { +TYPED_TEST(VariationsSeedProcessorTest, ForceGroup_ChooseFirstGroupWithFlag) { // Add the flag to the command line arguments so the flag group is forced. base::CommandLine::ForCurrentProcess()->AppendSwitch(kForcingFlag1); base::CommandLine::ForCurrentProcess()->AppendSwitch(kForcingFlag2); - Study study = CreateStudyWithFlagGroups(100, 0, 0); - EXPECT_TRUE(CreateTrialFromStudy(study)); + VariationsSeed seed; + CreateStudyWithFlagGroups(100, 0, 0, &seed); + this->CreateTrialsFromSeed(seed); EXPECT_EQ(kFlagGroup1Name, base::FieldTrialList::FindFullName(kFlagStudyName)); } -TEST_F(VariationsSeedProcessorTest, ForceGroup_DontChooseGroupWithFlag) { +TYPED_TEST(VariationsSeedProcessorTest, ForceGroup_DontChooseGroupWithFlag) { // The two flag groups are given high probability, which would normally make // them very likely to be chosen. They won't be chosen since flag groups are // never chosen when their flag isn't present. - Study study = CreateStudyWithFlagGroups(1, 999, 999); - EXPECT_TRUE(CreateTrialFromStudy(study)); + VariationsSeed seed; + CreateStudyWithFlagGroups(1, 999, 999, &seed); + this->CreateTrialsFromSeed(seed); EXPECT_EQ(kNonFlagGroupName, base::FieldTrialList::FindFullName(kFlagStudyName)); } -TEST_F(VariationsSeedProcessorTest, CreateTrialForRegisteredGroup) { +TYPED_TEST(VariationsSeedProcessorTest, CreateTrialForRegisteredGroup) { base::FieldTrialList::CreateFieldTrial(kFlagStudyName, kOtherGroupName); // Create an arbitrary study that does not have group named |kOtherGroupName|. - Study study = CreateStudyWithFlagGroups(100, 0, 0); + VariationsSeed seed; + CreateStudyWithFlagGroups(100, 0, 0, &seed); // Creating the trial should not crash. - EXPECT_TRUE(CreateTrialFromStudy(study)); + this->CreateTrialsFromSeed(seed); // And the previous group should still be selected. EXPECT_EQ(kOtherGroupName, base::FieldTrialList::FindFullName(kFlagStudyName)); } -TEST_F(VariationsSeedProcessorTest, - NonExpiredStudyPrioritizedOverExpiredStudy) { +TYPED_TEST(VariationsSeedProcessorTest, + NonExpiredStudyPrioritizedOverExpiredStudy) { VariationsSeedProcessor seed_processor; const std::string kTrialName = "A"; @@ -336,7 +368,7 @@ study1->set_expiry_date(TimeToProtoTime(year_ago)); base::MockEntropyProvider mock_low_entropy_provider(0.9); seed_processor.CreateTrialsFromSeed( - seed, client_state, override_callback_.callback(), + seed, client_state, this->override_callback_.callback(), &mock_low_entropy_provider, &feature_list); EXPECT_EQ(kGroup1Name, base::FieldTrialList::FindFullName(kTrialName)); } @@ -352,102 +384,106 @@ study2->set_expiry_date(TimeToProtoTime(year_ago)); base::MockEntropyProvider mock_low_entropy_provider(0.9); seed_processor.CreateTrialsFromSeed( - seed, client_state, override_callback_.callback(), + seed, client_state, this->override_callback_.callback(), &mock_low_entropy_provider, &feature_list); EXPECT_EQ(kGroup1Name, base::FieldTrialList::FindFullName(kTrialName)); } } -TEST_F(VariationsSeedProcessorTest, OverrideUIStrings) { - Study study; - study.set_name("Study1"); - study.set_default_experiment_name("B"); - study.set_activation_type(Study::ACTIVATE_ON_STARTUP); +TYPED_TEST(VariationsSeedProcessorTest, OverrideUIStrings) { + VariationsSeed seed; + Study* study = seed.add_study(); + study->set_name("Study1"); + study->set_default_experiment_name("B"); + study->set_activation_type(Study::ACTIVATE_ON_STARTUP); - Study::Experiment* experiment1 = AddExperiment("A", 0, &study); + Study::Experiment* experiment1 = AddExperiment("A", 0, study); Study::Experiment::OverrideUIString* override = experiment1->add_override_ui_string(); override->set_name_hash(1234); override->set_value("test"); - Study::Experiment* experiment2 = AddExperiment("B", 1, &study); + Study::Experiment* experiment2 = AddExperiment("B", 1, study); - EXPECT_TRUE(CreateTrialFromStudy(study)); + this->CreateTrialsFromSeed(seed); const TestOverrideStringCallback::OverrideMap& overrides = - override_callback_.overrides(); + this->override_callback_.overrides(); EXPECT_TRUE(overrides.empty()); - study.set_name("Study2"); + study->set_name("Study2"); experiment1->set_probability_weight(1); experiment2->set_probability_weight(0); - EXPECT_TRUE(CreateTrialFromStudy(study)); + this->CreateTrialsFromSeed(seed); EXPECT_EQ(1u, overrides.size()); auto it = overrides.find(1234); EXPECT_EQ(u"test", it->second); } -TEST_F(VariationsSeedProcessorTest, OverrideUIStringsWithForcingFlag) { - Study study = CreateStudyWithFlagGroups(100, 0, 0); - ASSERT_EQ(kForcingFlag1, study.experiment(1).forcing_flag()); +TYPED_TEST(VariationsSeedProcessorTest, OverrideUIStringsWithForcingFlag) { + VariationsSeed seed; + Study* study = CreateStudyWithFlagGroups(100, 0, 0, &seed); + ASSERT_EQ(kForcingFlag1, study->experiment(1).forcing_flag()); - study.set_activation_type(Study::ACTIVATE_ON_STARTUP); + study->set_activation_type(Study::ACTIVATE_ON_STARTUP); Study::Experiment::OverrideUIString* override = - study.mutable_experiment(1)->add_override_ui_string(); + study->mutable_experiment(1)->add_override_ui_string(); override->set_name_hash(1234); override->set_value("test"); base::CommandLine::ForCurrentProcess()->AppendSwitch(kForcingFlag1); - EXPECT_TRUE(CreateTrialFromStudy(study)); - EXPECT_EQ(kFlagGroup1Name, base::FieldTrialList::FindFullName(study.name())); + this->CreateTrialsFromSeed(seed); + EXPECT_EQ(kFlagGroup1Name, base::FieldTrialList::FindFullName(study->name())); const TestOverrideStringCallback::OverrideMap& overrides = - override_callback_.overrides(); + this->override_callback_.overrides(); EXPECT_EQ(1u, overrides.size()); auto it = overrides.find(1234); EXPECT_EQ(u"test", it->second); } -TEST_F(VariationsSeedProcessorTest, VariationParams) { - Study study; - study.set_name("Study1"); - study.set_default_experiment_name("B"); +TYPED_TEST(VariationsSeedProcessorTest, VariationParams) { + VariationsSeed seed; + Study* study = seed.add_study(); + study->set_name("Study1"); + study->set_default_experiment_name("B"); - Study::Experiment* experiment1 = AddExperiment("A", 1, &study); + Study::Experiment* experiment1 = AddExperiment("A", 1, study); Study::Experiment::Param* param = experiment1->add_param(); param->set_name("x"); param->set_value("y"); - Study::Experiment* experiment2 = AddExperiment("B", 0, &study); + Study::Experiment* experiment2 = AddExperiment("B", 0, study); - EXPECT_TRUE(CreateTrialFromStudy(study)); + this->CreateTrialsFromSeed(seed); EXPECT_EQ("y", GetVariationParamValue("Study1", "x")); - study.set_name("Study2"); + study->set_name("Study2"); experiment1->set_probability_weight(0); experiment2->set_probability_weight(1); - EXPECT_TRUE(CreateTrialFromStudy(study)); + this->CreateTrialsFromSeed(seed); EXPECT_EQ(std::string(), GetVariationParamValue("Study2", "x")); } -TEST_F(VariationsSeedProcessorTest, VariationParamsWithForcingFlag) { - Study study = CreateStudyWithFlagGroups(100, 0, 0); - ASSERT_EQ(kForcingFlag1, study.experiment(1).forcing_flag()); - Study::Experiment::Param* param = study.mutable_experiment(1)->add_param(); +TYPED_TEST(VariationsSeedProcessorTest, VariationParamsWithForcingFlag) { + VariationsSeed seed; + Study* study = CreateStudyWithFlagGroups(100, 0, 0, &seed); + ASSERT_EQ(kForcingFlag1, study->experiment(1).forcing_flag()); + Study::Experiment::Param* param = study->mutable_experiment(1)->add_param(); param->set_name("x"); param->set_value("y"); base::CommandLine::ForCurrentProcess()->AppendSwitch(kForcingFlag1); - EXPECT_TRUE(CreateTrialFromStudy(study)); - EXPECT_EQ(kFlagGroup1Name, base::FieldTrialList::FindFullName(study.name())); - EXPECT_EQ("y", GetVariationParamValue(study.name(), "x")); + this->CreateTrialsFromSeed(seed); + EXPECT_EQ(kFlagGroup1Name, base::FieldTrialList::FindFullName(study->name())); + EXPECT_EQ("y", GetVariationParamValue(study->name(), "x")); } -TEST_F(VariationsSeedProcessorTest, StartsActive) { +TYPED_TEST(VariationsSeedProcessorTest, StartsActive) { VariationsSeed seed; Study* study1 = seed.add_study(); study1->set_name("A"); @@ -480,7 +516,7 @@ VariationsSeedProcessor seed_processor; base::MockEntropyProvider mock_low_entropy_provider(0.9); seed_processor.CreateTrialsFromSeed( - seed, client_state, override_callback_.callback(), + seed, client_state, this->override_callback_.callback(), &mock_low_entropy_provider, base::FeatureList::GetInstance()); // Non-specified and ACTIVATE_ON_QUERY should not start active, but @@ -499,43 +535,45 @@ EXPECT_TRUE(base::FieldTrialList::IsTrialActive("C")); } -TEST_F(VariationsSeedProcessorTest, StartsActiveWithFlag) { +TYPED_TEST(VariationsSeedProcessorTest, StartsActiveWithFlag) { base::CommandLine::ForCurrentProcess()->AppendSwitch(kForcingFlag1); - Study study = CreateStudyWithFlagGroups(100, 0, 0); - study.set_activation_type(Study::ACTIVATE_ON_STARTUP); + VariationsSeed seed; + Study* study = CreateStudyWithFlagGroups(100, 0, 0, &seed); + study->set_activation_type(Study::ACTIVATE_ON_STARTUP); - EXPECT_TRUE(CreateTrialFromStudy(study)); + this->CreateTrialsFromSeed(seed); EXPECT_TRUE(base::FieldTrialList::IsTrialActive(kFlagStudyName)); EXPECT_EQ(kFlagGroup1Name, base::FieldTrialList::FindFullName(kFlagStudyName)); } -TEST_F(VariationsSeedProcessorTest, ForcingFlagAlreadyForced) { - Study study = CreateStudyWithFlagGroups(100, 0, 0); - ASSERT_EQ(kNonFlagGroupName, study.experiment(0).name()); - Study::Experiment::Param* param = study.mutable_experiment(0)->add_param(); +TYPED_TEST(VariationsSeedProcessorTest, ForcingFlagAlreadyForced) { + VariationsSeed seed; + Study* study = CreateStudyWithFlagGroups(100, 0, 0, &seed); + ASSERT_EQ(kNonFlagGroupName, study->experiment(0).name()); + Study::Experiment::Param* param = study->mutable_experiment(0)->add_param(); param->set_name("x"); param->set_value("y"); - study.mutable_experiment(0)->set_google_web_experiment_id(kExperimentId); + study->mutable_experiment(0)->set_google_web_experiment_id(kExperimentId); base::FieldTrialList::CreateFieldTrial(kFlagStudyName, kNonFlagGroupName); base::CommandLine::ForCurrentProcess()->AppendSwitch(kForcingFlag1); - EXPECT_TRUE(CreateTrialFromStudy(study)); + this->CreateTrialsFromSeed(seed); // The previously forced experiment should still hold. EXPECT_EQ(kNonFlagGroupName, - base::FieldTrialList::FindFullName(study.name())); + base::FieldTrialList::FindFullName(study->name())); // Check that params and experiment ids correspond. - EXPECT_EQ("y", GetVariationParamValue(study.name(), "x")); + EXPECT_EQ("y", GetVariationParamValue(study->name(), "x")); VariationID id = GetGoogleVariationID(GOOGLE_WEB_PROPERTIES_ANY_CONTEXT, kFlagStudyName, kNonFlagGroupName); EXPECT_EQ(kExperimentId, id); } -TEST_F(VariationsSeedProcessorTest, FeatureEnabledOrDisableByTrial) { +TYPED_TEST(VariationsSeedProcessorTest, FeatureEnabledOrDisableByTrial) { struct base::Feature kFeatureOffByDefault { "kOff", base::FEATURE_DISABLED_BY_DEFAULT }; @@ -569,12 +607,13 @@ std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); - Study study; - study.set_name("Study1"); - study.set_default_experiment_name("B"); - AddExperiment("B", 0, &study); + VariationsSeed seed; + Study* study = seed.add_study(); + study->set_name("Study1"); + study->set_default_experiment_name("B"); + AddExperiment("B", 0, study); - Study::Experiment* experiment = AddExperiment("A", 1, &study); + Study::Experiment* experiment = AddExperiment("A", 1, study); Study::Experiment::FeatureAssociation* association = experiment->mutable_feature_association(); if (test_case.enable_feature) @@ -582,7 +621,7 @@ else if (test_case.disable_feature) association->add_disable_feature(test_case.disable_feature); - EXPECT_TRUE(CreateTrialFromStudyWithFeatureList(study, feature_list.get())); + this->CreateTrialsFromSeed(seed, feature_list.get()); base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitWithFeatureList(std::move(feature_list)); @@ -590,7 +629,7 @@ EXPECT_FALSE(base::FeatureList::IsEnabled(kUnrelatedFeature)); // Before the associated feature is queried, the trial shouldn't be active. - EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study.name())); + EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study->name())); EXPECT_EQ(test_case.expected_feature_off_state, base::FeatureList::IsEnabled(kFeatureOffByDefault)); @@ -601,11 +640,11 @@ const bool expected_field_trial_active = test_case.enable_feature || test_case.disable_feature; EXPECT_EQ(expected_field_trial_active, - base::FieldTrialList::IsTrialActive(study.name())); + base::FieldTrialList::IsTrialActive(study->name())); } } -TEST_F(VariationsSeedProcessorTest, FeatureAssociationAndForcing) { +TYPED_TEST(VariationsSeedProcessorTest, FeatureAssociationAndForcing) { struct base::Feature kFeatureOffByDefault { "kFeatureOffByDefault", base::FEATURE_DISABLED_BY_DEFAULT }; @@ -698,43 +737,44 @@ test_case.enable_features_command_line, test_case.disable_features_command_line); - Study study; - study.set_name("Study1"); - study.set_default_experiment_name(kDefaultGroup); - AddExperiment(kDefaultGroup, group == DEFAULT_GROUP ? 1 : 0, &study); + VariationsSeed seed; + Study* study = seed.add_study(); + study->set_name("Study1"); + study->set_default_experiment_name(kDefaultGroup); + AddExperiment(kDefaultGroup, group == DEFAULT_GROUP ? 1 : 0, study); Study::Experiment* feature_enable = - AddExperiment(kEnabledGroup, group == ENABLE_GROUP ? 1 : 0, &study); + AddExperiment(kEnabledGroup, group == ENABLE_GROUP ? 1 : 0, study); feature_enable->mutable_feature_association()->add_enable_feature( test_case.feature.name); Study::Experiment* feature_disable = - AddExperiment(kDisabledGroup, group == DISABLE_GROUP ? 1 : 0, &study); + AddExperiment(kDisabledGroup, group == DISABLE_GROUP ? 1 : 0, study); feature_disable->mutable_feature_association()->add_disable_feature( test_case.feature.name); - AddExperiment(kForcedOnGroup, 0, &study) + AddExperiment(kForcedOnGroup, 0, study) ->mutable_feature_association() ->set_forcing_feature_on(test_case.feature.name); - AddExperiment(kForcedOffGroup, 0, &study) + AddExperiment(kForcedOffGroup, 0, study) ->mutable_feature_association() ->set_forcing_feature_off(test_case.feature.name); - EXPECT_TRUE(CreateTrialFromStudyWithFeatureList(study, feature_list.get())); + this->CreateTrialsFromSeed(seed, feature_list.get()); base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitWithFeatureList(std::move(feature_list)); // Trial should not be activated initially, but later might get activated // depending on the expected values. - EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study.name())); + EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study->name())); EXPECT_EQ(test_case.expected_feature_state, base::FeatureList::IsEnabled(test_case.feature)); EXPECT_EQ(test_case.expected_trial_activated, - base::FieldTrialList::IsTrialActive(study.name())); + base::FieldTrialList::IsTrialActive(study->name())); } } -TEST_F(VariationsSeedProcessorTest, FeaturesInExpiredStudies) { +TYPED_TEST(VariationsSeedProcessorTest, FeaturesInExpiredStudies) { struct base::Feature kDisabledFeature { "kDisabledFeature", base::FEATURE_DISABLED_BY_DEFAULT }; @@ -771,14 +811,15 @@ // Expired study with a 100% feature group and a default group that has no // feature association. - Study study; - study.set_name("Study1"); - study.set_default_experiment_name("Default"); + VariationsSeed seed; + Study* study = seed.add_study(); + study->set_name("Study1"); + study->set_default_experiment_name("Default"); - study.set_expiry_date(TimeToProtoTime(test_case.expiry_date)); + study->set_expiry_date(TimeToProtoTime(test_case.expiry_date)); - AddExperiment("Default", 0, &study); - Study::Experiment* feature_experiment = AddExperiment("Feature", 1, &study); + AddExperiment("Default", 0, study); + Study::Experiment* feature_experiment = AddExperiment("Feature", 1, study); if (test_case.study_force_feature_state) { feature_experiment->mutable_feature_association()->add_enable_feature( test_case.feature.name); @@ -787,7 +828,7 @@ test_case.feature.name); } - EXPECT_TRUE(CreateTrialFromStudyWithFeatureList(study, feature_list.get())); + this->CreateTrialsFromSeed(seed, feature_list.get()); base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitWithFeatureList(std::move(feature_list)); @@ -797,13 +838,14 @@ } } -TEST_F(VariationsSeedProcessorTest, NoDefaultExperiment) { - Study study; - study.set_name("Study1"); +TYPED_TEST(VariationsSeedProcessorTest, NoDefaultExperiment) { + VariationsSeed seed; + Study* study = seed.add_study(); + study->set_name("Study1"); - AddExperiment("A", 1, &study); + AddExperiment("A", 1, study); - EXPECT_TRUE(CreateTrialFromStudy(study)); + this->CreateTrialsFromSeed(seed); base::FieldTrial* trial = base::FieldTrialList::Find("Study1"); trial->Disable(); @@ -812,7 +854,7 @@ base::FieldTrialList::FindFullName("Study1")); } -TEST_F(VariationsSeedProcessorTest, ExistingFieldTrial_ExpiredByConfig) { +TYPED_TEST(VariationsSeedProcessorTest, ExistingFieldTrial_ExpiredByConfig) { static struct base::Feature kFeature { "FeatureName", base::FEATURE_ENABLED_BY_DEFAULT }; @@ -826,23 +868,24 @@ trial->AppendGroup("A", 100); trial->SetForced(); - Study study; - study.set_name("Study1"); + VariationsSeed seed; + Study* study = seed.add_study(); + study->set_name("Study1"); const base::Time year_ago = base::Time::Now() - base::Days(365); - study.set_expiry_date(TimeToProtoTime(year_ago)); - auto* exp1 = AddExperiment("A", 1, &study); + study->set_expiry_date(TimeToProtoTime(year_ago)); + auto* exp1 = AddExperiment("A", 1, study); exp1->mutable_feature_association()->add_enable_feature(kFeature.name); - AddExperiment("Default", 1, &study); - study.set_default_experiment_name("Default"); + AddExperiment("Default", 1, study); + study->set_default_experiment_name("Default"); - EXPECT_TRUE(CreateTrialFromStudy(study)); + this->CreateTrialsFromSeed(seed); // The expected effect is that processing the server config will expire // the existing trial. EXPECT_EQ("ExistingDefault", trial->group_name()); } -TEST_F(VariationsSeedProcessorTest, ExpiredStudy_NoDefaultGroup) { +TYPED_TEST(VariationsSeedProcessorTest, ExpiredStudy_NoDefaultGroup) { static struct base::Feature kFeature { "FeatureName", base::FEATURE_ENABLED_BY_DEFAULT }; @@ -850,20 +893,21 @@ // Although it's not expected for the server to provide a study with an expiry // date set, but not default experiment, this tests that we don't crash if // that happens. - Study study; - study.set_name("Study1"); + VariationsSeed seed; + Study* study = seed.add_study(); + study->set_name("Study1"); const base::Time year_ago = base::Time::Now() - base::Days(365); - study.set_expiry_date(TimeToProtoTime(year_ago)); - auto* exp1 = AddExperiment("A", 1, &study); + study->set_expiry_date(TimeToProtoTime(year_ago)); + auto* exp1 = AddExperiment("A", 1, study); exp1->mutable_feature_association()->add_enable_feature(kFeature.name); - EXPECT_FALSE(study.has_default_experiment_name()); - EXPECT_TRUE(CreateTrialFromStudy(study)); + EXPECT_FALSE(study->has_default_experiment_name()); + this->CreateTrialsFromSeed(seed); EXPECT_EQ("VariationsDefaultExperiment", base::FieldTrialList::FindFullName("Study1")); } -TEST_F(VariationsSeedProcessorTest, LowEntropyStudyTest) { +TYPED_TEST(VariationsSeedProcessorTest, LowEntropyStudyTest) { const std::string kTrial1Name = "A"; const std::string kTrial2Name = "B"; const std::string kGroup1Name = "AA"; @@ -891,15 +935,9 @@ base::FieldTrialList field_trial_list( std::make_unique<base::MockEntropyProvider>(0.1)); - // Use a stack instance, since nothing takes ownership of this provider. // This entropy value will cause the default group to be chosen since it's a // 50/50 trial. - base::MockEntropyProvider mock_low_entropy_provider(0.9); - - EXPECT_TRUE(CreateTrialFromStudyWithEntropyOverride( - *study1, mock_low_entropy_provider)); - EXPECT_TRUE(CreateTrialFromStudyWithEntropyOverride( - *study2, mock_low_entropy_provider)); + this->CreateTrialsFromSeed(seed, 0.9); // Since no experiment in study1 sends experiment IDs, it will use the high // entropy provider, which selects the non-default group. @@ -907,10 +945,15 @@ // Since an experiment in study2 has google_web_experiment_id set, it will use // the low entropy provider, which selects the default group. - EXPECT_EQ(kDefaultName, base::FieldTrialList::FindFullName(kTrial2Name)); + if (this->env.SupportsLayers()) { + EXPECT_EQ(kDefaultName, base::FieldTrialList::FindFullName(kTrial2Name)); + } else { + // On WebView we always use the default entropy provider. + EXPECT_EQ(kGroup1Name, base::FieldTrialList::FindFullName(kTrial1Name)); + } } -TEST_F(VariationsSeedProcessorTest, StudyWithInvalidLayer) { +TYPED_TEST(VariationsSeedProcessorTest, StudyWithInvalidLayer) { VariationsSeed seed; Study* study = seed.add_study(); @@ -922,14 +965,14 @@ layer->set_layer_member_id(82); AddExperiment("A", 1, study); - CreateTrialsFromSeed(seed); + this->CreateTrialsFromSeed(seed); // Since the studies references a layer which doesn't exist, it should // select the default group. EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study->name())); } -TEST_F(VariationsSeedProcessorTest, StudyWithInvalidLayerMember) { +TYPED_TEST(VariationsSeedProcessorTest, StudyWithInvalidLayerMember) { VariationsSeed seed; Layer* layer = seed.add_layers(); @@ -950,14 +993,14 @@ layer_membership->set_layer_member_id(88); AddExperiment("A", 1, study); - CreateTrialsFromSeed(seed); + this->CreateTrialsFromSeed(seed); // Since the studies references a layer member which doesn't exist, it should // not be active. EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study->name())); } -TEST_F(VariationsSeedProcessorTest, StudyWithLayerSelected) { +TYPED_TEST(VariationsSeedProcessorTest, StudyWithLayerSelected) { VariationsSeed seed; Layer* layer = seed.add_layers(); @@ -978,13 +1021,17 @@ layer_membership->set_layer_member_id(82); AddExperiment("A", 1, study); - CreateTrialsFromSeed(seed); + this->CreateTrialsFromSeed(seed); // The layer only has the single member, which is what should be chosen. - EXPECT_TRUE(base::FieldTrialList::IsTrialActive(study->name())); + if (this->env.SupportsLayers()) { + EXPECT_TRUE(base::FieldTrialList::IsTrialActive(study->name())); + } else { + EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study->name())); + } } -TEST_F(VariationsSeedProcessorTest, StudyWithLayerMemberWithNoSlots) { +TYPED_TEST(VariationsSeedProcessorTest, StudyWithLayerMemberWithNoSlots) { VariationsSeed seed; Layer* layer = seed.add_layers(); @@ -1004,14 +1051,14 @@ layer_membership->set_layer_member_id(82); AddExperiment("A", 1, study); - CreateTrialsFromSeed(seed); + this->CreateTrialsFromSeed(seed); // The layer member referenced by the study is missing slots, and should // never be chosen. EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study->name())); } -TEST_F(VariationsSeedProcessorTest, StudyWithLayerWithDuplicateSlots) { +TYPED_TEST(VariationsSeedProcessorTest, StudyWithLayerWithDuplicateSlots) { VariationsSeed seed; Layer* layer = seed.add_layers(); @@ -1037,14 +1084,19 @@ layer_membership->set_layer_member_id(82); AddExperiment("A", 1, study); - CreateTrialsFromSeed(seed); + this->CreateTrialsFromSeed(seed); // The layer only has the single member, which is what should be chosen. // Having two duplicate slot ranges within that member should not crash. - EXPECT_TRUE(base::FieldTrialList::IsTrialActive(study->name())); + if (this->env.SupportsLayers()) { + EXPECT_TRUE(base::FieldTrialList::IsTrialActive(study->name())); + } else { + EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study->name())); + } } -TEST_F(VariationsSeedProcessorTest, StudyWithLayerMemberWithOutOfRangeSlots) { +TYPED_TEST(VariationsSeedProcessorTest, + StudyWithLayerMemberWithOutOfRangeSlots) { VariationsSeed seed; Layer* layer = seed.add_layers(); @@ -1065,14 +1117,14 @@ layer_membership->set_layer_member_id(82); AddExperiment("A", 1, study); - CreateTrialsFromSeed(seed); + this->CreateTrialsFromSeed(seed); // The layer member referenced by the study is missing slots, and should // never be chosen. EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study->name())); } -TEST_F(VariationsSeedProcessorTest, StudyWithLayerMemberWithReversedSlots) { +TYPED_TEST(VariationsSeedProcessorTest, StudyWithLayerMemberWithReversedSlots) { VariationsSeed seed; Layer* layer = seed.add_layers(); @@ -1093,7 +1145,7 @@ layer_membership->set_layer_member_id(82); AddExperiment("A", 1, study); - CreateTrialsFromSeed(seed); + this->CreateTrialsFromSeed(seed); // The layer member referenced by the study is has its slots in the wrong // order (end < start) which should cause the slot to never be chosen @@ -1101,7 +1153,7 @@ EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study->name())); } -TEST_F(VariationsSeedProcessorTest, StudyWithLayerNotSelected) { +TYPED_TEST(VariationsSeedProcessorTest, StudyWithLayerNotSelected) { VariationsSeed seed; Layer* layer = seed.add_layers(); @@ -1139,13 +1191,14 @@ AddExperiment("A", 1, study); // Entropy 0.99 Should cause slot 7920 to be chosen. - CreateTrialsFromSeed(seed, /*low_entropy=*/0.99); + this->CreateTrialsFromSeed(seed, /*low_entropy=*/0.99); - // The study is a member of the 0xDEAD layer member and should be inactive. + // The study is a member of the 0xDEAD layer member and should be inactive + // (or layers are not supported by the environment). EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study->name())); } -TEST_F(VariationsSeedProcessorTest, LayerWithDefaultEntropy) { +TYPED_TEST(VariationsSeedProcessorTest, LayerWithDefaultEntropy) { VariationsSeed seed; Layer* layer = seed.add_layers(); @@ -1183,13 +1236,17 @@ // Since we're *not* setting the entropy_mode to LOW, |low_entropy| should // be ignored and the default high entropy should be used, which in // this case is slot 4000 and hence the first layer member is chosen. - CreateTrialsFromSeed(seed, /*low_entropy=*/0.99); + this->CreateTrialsFromSeed(seed, /*low_entropy=*/0.99); // The study is a member of the 0xDEAD layer member and should be active. - EXPECT_TRUE(base::FieldTrialList::IsTrialActive(study->name())); + if (this->env.SupportsLayers()) { + EXPECT_TRUE(base::FieldTrialList::IsTrialActive(study->name())); + } else { + EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study->name())); + } } -TEST_F(VariationsSeedProcessorTest, LayerWithNoMembers) { +TYPED_TEST(VariationsSeedProcessorTest, LayerWithNoMembers) { VariationsSeed seed; Layer* layer = seed.add_layers(); @@ -1198,10 +1255,10 @@ layer->set_salt(0xBEEF); // Layer should be rejected and not crash. - CreateTrialsFromSeed(seed); + this->CreateTrialsFromSeed(seed); } -TEST_F(VariationsSeedProcessorTest, LayerWithNoSlots) { +TYPED_TEST(VariationsSeedProcessorTest, LayerWithNoSlots) { VariationsSeed seed; Layer* layer = seed.add_layers(); @@ -1209,27 +1266,27 @@ layer->set_salt(0xBEEF); // Layer should be rejected and not crash. - CreateTrialsFromSeed(seed); + this->CreateTrialsFromSeed(seed); } -TEST_F(VariationsSeedProcessorTest, LayerWithNoID) { +TYPED_TEST(VariationsSeedProcessorTest, LayerWithNoID) { VariationsSeed seed; Layer* layer = seed.add_layers(); layer->set_salt(0xBEEF); // Layer should be rejected and not crash. - CreateTrialsFromSeed(seed); + this->CreateTrialsFromSeed(seed); } -TEST_F(VariationsSeedProcessorTest, EmptyLayer) { +TYPED_TEST(VariationsSeedProcessorTest, EmptyLayer) { VariationsSeed seed; seed.add_layers(); // Layer should be rejected and not crash. - CreateTrialsFromSeed(seed); + this->CreateTrialsFromSeed(seed); } -TEST_F(VariationsSeedProcessorTest, LayersWithDuplicateID) { +TYPED_TEST(VariationsSeedProcessorTest, LayersWithDuplicateID) { VariationsSeed seed; { @@ -1257,10 +1314,10 @@ } // The duplicate layer should be rejected and not crash. - CreateTrialsFromSeed(seed); + this->CreateTrialsFromSeed(seed); } -TEST_F(VariationsSeedProcessorTest, StudyWithLayerMemberWithoutID) { +TYPED_TEST(VariationsSeedProcessorTest, StudyWithLayerMemberWithoutID) { VariationsSeed seed; Layer* layer = seed.add_layers(); @@ -1279,7 +1336,7 @@ layer_membership->set_layer_id(42); AddExperiment("A", 1, study); - CreateTrialsFromSeed(seed); + this->CreateTrialsFromSeed(seed); // The layer only has the single member but that member has no // ID set. The LayerMembership also has no member_id set. The study @@ -1288,7 +1345,7 @@ EXPECT_FALSE(base::FieldTrialList::IsTrialActive(study->name())); } -TEST_F(VariationsSeedProcessorTest, StudyWithLowerEntropyThanLayer) { +TYPED_TEST(VariationsSeedProcessorTest, StudyWithLowerEntropyThanLayer) { VariationsSeed seed; Layer* layer = seed.add_layers(); @@ -1310,7 +1367,7 @@ AddExperiment("A", 1, study); study->mutable_experiment(0)->set_google_web_experiment_id(kExperimentId); - CreateTrialsFromSeed(seed); + this->CreateTrialsFromSeed(seed); // Since the study will use the low entropy source and the layer the default // one, the study should be rejected.
diff --git a/components/viz/common/quads/aggregated_render_pass_draw_quad.cc b/components/viz/common/quads/aggregated_render_pass_draw_quad.cc index 111c426..6531da36 100644 --- a/components/viz/common/quads/aggregated_render_pass_draw_quad.cc +++ b/components/viz/common/quads/aggregated_render_pass_draw_quad.cc
@@ -19,6 +19,27 @@ AggregatedRenderPassDrawQuad::~AggregatedRenderPassDrawQuad() = default; +bool AggregatedRenderPassDrawQuad::Equals( + const AggregatedRenderPassDrawQuad& other) const { + DCHECK(shared_quad_state); + + return render_pass_id == other.render_pass_id && + // RenderPassDrawQuadInternal + mask_uv_rect == other.mask_uv_rect && + mask_texture_size == other.mask_texture_size && + filters_scale == other.filters_scale && + filters_origin == other.filters_origin && + tex_coord_rect == other.tex_coord_rect && + backdrop_filter_quality == other.backdrop_filter_quality && + force_anti_aliasing_off == other.force_anti_aliasing_off && + intersects_damage_under == other.intersects_damage_under && + // DrawQuad. Skip resources.ids[kMaskResourceIdIndex]. + material == other.material && rect == other.rect && + visible_rect == other.visible_rect && + needs_blending == other.needs_blending && + shared_quad_state->Equals(*other.shared_quad_state); +} + void AggregatedRenderPassDrawQuad::SetNew( const SharedQuadState* shared_quad_state, const gfx::Rect& rect, @@ -43,6 +64,29 @@ } void AggregatedRenderPassDrawQuad::SetAll( + const AggregatedRenderPassDrawQuad& other) { + render_pass_id = other.render_pass_id; + + // DrawQuad + DrawQuad::SetAll(other.shared_quad_state, + DrawQuad::Material::kAggregatedRenderPass, other.rect, + other.visible_rect, other.needs_blending); + resources.ids[kMaskResourceIdIndex] = + other.resources.ids[kMaskResourceIdIndex]; + resources.count = other.resources.count; + + // RenderPassDrawQuadInternal + mask_uv_rect = other.mask_uv_rect; + mask_texture_size = other.mask_texture_size; + filters_scale = other.filters_scale; + filters_origin = other.filters_origin; + tex_coord_rect = other.tex_coord_rect; + force_anti_aliasing_off = other.force_anti_aliasing_off; + backdrop_filter_quality = other.backdrop_filter_quality; + intersects_damage_under = other.intersects_damage_under; +} + +void AggregatedRenderPassDrawQuad::SetAll( const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& visible_rect,
diff --git a/components/viz/common/quads/aggregated_render_pass_draw_quad.h b/components/viz/common/quads/aggregated_render_pass_draw_quad.h index e9d8d83..23ccc09d 100644 --- a/components/viz/common/quads/aggregated_render_pass_draw_quad.h +++ b/components/viz/common/quads/aggregated_render_pass_draw_quad.h
@@ -25,6 +25,10 @@ AggregatedRenderPassDrawQuad(const AggregatedRenderPassDrawQuad& other); ~AggregatedRenderPassDrawQuad() override; + // No comparison for resources.ids. shared_quad_state is compared + // by calling Equals(). + bool Equals(const AggregatedRenderPassDrawQuad& other) const; + void SetNew(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& visible_rect, @@ -38,6 +42,8 @@ bool force_anti_aliasing_off, float backdrop_filter_quality); + void SetAll(const AggregatedRenderPassDrawQuad& other); + void SetAll(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& visible_rect,
diff --git a/components/viz/common/quads/shared_quad_state.cc b/components/viz/common/quads/shared_quad_state.cc index 0ac44fd2..173ed68 100644 --- a/components/viz/common/quads/shared_quad_state.cc +++ b/components/viz/common/quads/shared_quad_state.cc
@@ -21,6 +21,32 @@ "viz::SharedQuadState", this); } +bool SharedQuadState::Equals(const SharedQuadState& other) const { + // Skip |overlay_damage_index| and |is_fast_rounded_corner|, which are added + // in SurfaceAggregator. They don't really control the rendering effect. + return quad_to_target_transform == other.quad_to_target_transform && + quad_layer_rect == other.quad_layer_rect && + visible_quad_layer_rect == other.visible_quad_layer_rect && + mask_filter_info == other.mask_filter_info && + clip_rect == other.clip_rect && + are_contents_opaque == other.are_contents_opaque && + opacity == other.opacity && blend_mode == other.blend_mode && + sorting_context_id == other.sorting_context_id && + de_jelly_delta_y == other.de_jelly_delta_y; +} + +void SharedQuadState::SetAll(const SharedQuadState& other) { + quad_to_target_transform = other.quad_to_target_transform; + quad_layer_rect = other.quad_layer_rect; + visible_quad_layer_rect = other.visible_quad_layer_rect; + mask_filter_info = other.mask_filter_info; + clip_rect = other.clip_rect; + are_contents_opaque = other.are_contents_opaque; + opacity = other.opacity; + blend_mode = other.blend_mode; + sorting_context_id = other.sorting_context_id; +} + void SharedQuadState::SetAll(const gfx::Transform& transform, const gfx::Rect& layer_rect, const gfx::Rect& visible_layer_rect,
diff --git a/components/viz/common/quads/shared_quad_state.h b/components/viz/common/quads/shared_quad_state.h index 81290b1..a29750a 100644 --- a/components/viz/common/quads/shared_quad_state.h +++ b/components/viz/common/quads/shared_quad_state.h
@@ -33,6 +33,11 @@ SharedQuadState(const SharedQuadState& other); ~SharedQuadState(); + // No comparison for |overlay_damage_index| and |is_fast_rounded_corner|. + bool Equals(const SharedQuadState& other) const; + + void SetAll(const SharedQuadState& other); + void SetAll(const gfx::Transform& transform, const gfx::Rect& layer_rect, const gfx::Rect& visible_layer_rect,
diff --git a/components/viz/service/display/overlay_processor_ozone.cc b/components/viz/service/display/overlay_processor_ozone.cc index cdccfaf..b83bdcd 100644 --- a/components/viz/service/display/overlay_processor_ozone.cc +++ b/components/viz/service/display/overlay_processor_ozone.cc
@@ -84,7 +84,6 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) bool AllowColorSpaceCombination( - gfx::BufferFormat source_format, const gfx::ColorSpace& source_color_space, const gfx::ColorSpace& destination_color_space) { // Allow invalid source color spaces because the assumption is that the @@ -93,35 +92,6 @@ if (!source_color_space.IsValid()) return true; - // Since https://crrev.com/c/2336347, we force BT.601/narrow for the - // COLOR_ENCODING and COLOR_RANGE DRM/KMS properties. On the other hand, the - // compositor is able to handle different YUV encodings and ranges. Therefore, - // in theory, if we don't want to see a difference between overlays and - // compositing, we should not promote video frames to overlays unless they - // actually use BT.601/narrow. - // - // In practice, however, we expect to see lots of BT.709 video frames, and we - // don't want to reject all of them for overlays because the visual difference - // between BT.601/narrow and BT.709/narrow is not expected to be much. - // Therefore, in being consistent with the values we provide for - // EGL_YUV_COLOR_SPACE_HINT_EXT/EGL_SAMPLE_RANGE_HINT_EXT (see - // https://crrev.com/c/3662321), we'll only allow frames that use non-BT.2020 - // with non-full range. In those cases, the compositor and the display - // controller are expected to render the frames equally (and decently - with - // the understanding that the final result may not be fully correct). - // - // TODO(b/233667677): Remove this when we've plumbed the YUV encoding and - // range to DRM/KMS. At that point, we need to ensure that - // EGL_YUV_COLOR_SPACE_HINT_EXT/EGL_SAMPLE_RANGE_HINT_EXT would also get the - // same values as DRM/KMS. - if ((source_format == gfx::BufferFormat::YUV_420_BIPLANAR || - source_format == gfx::BufferFormat::YVU_420) && - (source_color_space.GetPrimaryID() == - gfx::ColorSpace::PrimaryID::BT2020 || - source_color_space.GetRangeID() == gfx::ColorSpace::RangeID::FULL)) { - return false; - } - // Allow color space mismatches as long as either a) the source color space is // SRGB; or b) both the source and destination color spaces have the same // color usage. It is possible that case (a) still allows for visible color @@ -240,7 +210,6 @@ // backend when we get an API for per-plane color management. if (!surface_iterator->requires_overlay && !AllowColorSpaceCombination( - /*source_format=*/surface_iterator->format, /*source_color_space=*/surface_iterator->color_space, /*destination_color_space=*/primary_plane_color_space_)) { *ozone_surface_iterator = ui::OverlaySurfaceCandidate();
diff --git a/components/viz/service/display_embedder/compositor_gpu_thread.cc b/components/viz/service/display_embedder/compositor_gpu_thread.cc index 5c6e89c..68b9aff 100644 --- a/components/viz/service/display_embedder/compositor_gpu_thread.cc +++ b/components/viz/service/display_embedder/compositor_gpu_thread.cc
@@ -68,7 +68,8 @@ device_queue->GetVulkanPhysicalDevice(), device_queue->GetVulkanDevice(), device_queue->GetVulkanQueue(), device_queue->GetVulkanQueueIndex(), device_queue->enabled_extensions(), - device_queue->enabled_device_features_2()); + device_queue->enabled_device_features_2(), + device_queue->vma_allocator()); vulkan_context_provider = VulkanInProcessContextProvider::CreateForCompositorGpuThread( vulkan_implementation, std::move(compositor_thread_device_queue), @@ -226,6 +227,7 @@ // Context should be current for cache/memory cleanup. if (shared_context_state_ && shared_context_state_->MakeCurrent(nullptr, /*needs_gl=*/true)) { + LOG(ERROR) << "vikas: purging drdc context"; shared_context_state_->PurgeMemory(memory_pressure_level); } }
diff --git a/components/viz/service/display_embedder/skia_output_device_gl.cc b/components/viz/service/display_embedder/skia_output_device_gl.cc index ce51ffd6..9974385 100644 --- a/components/viz/service/display_embedder/skia_output_device_gl.cc +++ b/components/viz/service/display_embedder/skia_output_device_gl.cc
@@ -58,17 +58,11 @@ } // namespace -// Holds reference needed to keep overlay textures alive. Can either hold a -// shared image or legacy GL texture. -// TODO(kylechar): Merge with SkiaOutputDeviceBufferQueue::OverlayData when we -// dont need to support TexturePassthrough anymore. +// Holds reference needed to keep overlay textures alive. +// TODO(kylechar): We can probably merge OverlayData in with +// SkiaOutputSurfaceImplOnGpu overlay data. class SkiaOutputDeviceGL::OverlayData { public: - // TODO(crbug.com/1011555): Remove ability to hold TexturePassthrough after - // all Window video paths use shared image API. - explicit OverlayData(scoped_refptr<gpu::gles2::TexturePassthrough> texture) - : texture_(std::move(texture)) {} - explicit OverlayData( std::unique_ptr<gpu::OverlayImageRepresentation> representation) : representation_(std::move(representation)) {} @@ -76,16 +70,13 @@ ~OverlayData() = default; OverlayData(OverlayData&& other) = default; OverlayData& operator=(OverlayData&& other) { - texture_ = std::move(other.texture_); + // `access_` must be overwritten before `representation_`. access_ = std::move(other.access_); representation_ = std::move(other.representation_); return *this; } scoped_refptr<gl::GLImage> GetImage() { - if (texture_) - return texture_->GetLevelImage(texture_->target(), 0); - DCHECK(representation_); access_ = representation_->BeginScopedReadAccess(/*needs_gl_image=*/true); DCHECK(access_); @@ -97,7 +88,6 @@ private: std::unique_ptr<gpu::OverlayImageRepresentation> representation_; std::unique_ptr<gpu::OverlayImageRepresentation::ScopedReadAccess> access_; - scoped_refptr<gpu::gles2::TexturePassthrough> texture_; }; SkiaOutputDeviceGL::SkiaOutputDeviceGL( @@ -482,26 +472,11 @@ if (it != overlays_.end()) return it->second.GetImage(); - // TODO(crbug.com/1005306): Stop using MailboxManager for lookup once all - // clients are using SharedImageInterface to create textures. - // For example, the legacy mailbox still uses GL textures (no overlay) - // and is still used. - auto* texture_base = mailbox_manager_->ConsumeTexture(mailbox); - if (texture_base) { - DCHECK_EQ(texture_base->GetType(), gpu::TextureBase::Type::kPassthrough); - std::tie(it, std::ignore) = overlays_.insert( - {mailbox, - OverlayData(base::WrapRefCounted( - static_cast<gpu::gles2::TexturePassthrough*>(texture_base)))}); - return it->second.GetImage(); - } - auto overlay = shared_image_representation_factory_->ProduceOverlay(mailbox); if (!overlay) return nullptr; - std::tie(it, std::ignore) = - overlays_.try_emplace(mailbox, std::move(overlay)); + std::tie(it, std::ignore) = overlays_.emplace(mailbox, std::move(overlay)); return it->second.GetImage(); }
diff --git a/components/viz/service/gl/gpu_service_impl.cc b/components/viz/service/gl/gpu_service_impl.cc index 9c0cd7e..c77e8cb 100644 --- a/components/viz/service/gl/gpu_service_impl.cc +++ b/components/viz/service/gl/gpu_service_impl.cc
@@ -478,7 +478,7 @@ } // Scheduler must be destroyed before sync point manager is destroyed. - scheduler_.reset(); + owned_scheduler_.reset(); owned_sync_point_manager_.reset(); owned_shared_image_manager_.reset(); @@ -540,6 +540,7 @@ scoped_refptr<gl::GLSurface> default_offscreen_surface, gpu::SyncPointManager* sync_point_manager, gpu::SharedImageManager* shared_image_manager, + gpu::Scheduler* scheduler, base::WaitableEvent* shutdown_event) { DCHECK(main_runner_->BelongsToCurrentThread()); @@ -592,15 +593,20 @@ shutdown_event_ = owned_shutdown_event_.get(); } - scheduler_ = - std::make_unique<gpu::Scheduler>(sync_point_manager, gpu_preferences_); + if (scheduler) { + scheduler_ = scheduler; + } else { + owned_scheduler_ = + std::make_unique<gpu::Scheduler>(sync_point_manager, gpu_preferences_); + scheduler_ = owned_scheduler_.get(); + } // Defer creation of the render thread. This is to prevent it from handling // IPC messages before the sandbox has been enabled and all other necessary // initialization has succeeded. gpu_channel_manager_ = std::make_unique<gpu::GpuChannelManager>( gpu_preferences_, this, watchdog_thread_.get(), main_runner_, io_runner_, - scheduler_.get(), sync_point_manager, shared_image_manager, + scheduler_, sync_point_manager, shared_image_manager, gpu_memory_buffer_factory_.get(), gpu_feature_info_, std::move(activity_flags), std::move(default_offscreen_surface), image_decode_accelerator_worker_.get(), vulkan_context_provider(), @@ -1335,7 +1341,7 @@ } gpu::Scheduler* GpuServiceImpl::GetGpuScheduler() { - return scheduler_.get(); + return scheduler_; } #if BUILDFLAG(IS_WIN)
diff --git a/components/viz/service/gl/gpu_service_impl.h b/components/viz/service/gl/gpu_service_impl.h index 899c4e89..8b2cc94 100644 --- a/components/viz/service/gl/gpu_service_impl.h +++ b/components/viz/service/gl/gpu_service_impl.h
@@ -123,6 +123,7 @@ scoped_refptr<gl::GLSurface> default_offscreen_surface, gpu::SyncPointManager* sync_point_manager = nullptr, gpu::SharedImageManager* shared_image_manager = nullptr, + gpu::Scheduler* scheduler = nullptr, base::WaitableEvent* shutdown_event = nullptr); void Bind(mojo::PendingReceiver<mojom::GpuService> pending_receiver); @@ -461,13 +462,14 @@ // Display compositor gpu thread. std::unique_ptr<CompositorGpuThread> compositor_gpu_thread_; - // On some platforms (e.g. android webview), the SyncPointManager and - // SharedImageManager comes from external sources. + // On some platforms (e.g. android webview), SyncPointManager, + // SharedImageManager and Scheduler come from external sources. std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; std::unique_ptr<gpu::SharedImageManager> owned_shared_image_manager_; - std::unique_ptr<gpu::Scheduler> scheduler_; + std::unique_ptr<gpu::Scheduler> owned_scheduler_; + raw_ptr<gpu::Scheduler> scheduler_; #if BUILDFLAG(ENABLE_VULKAN) raw_ptr<gpu::VulkanImplementation> vulkan_implementation_;
diff --git a/components/viz/service/main/viz_main_impl.cc b/components/viz/service/main/viz_main_impl.cc index 17611a0..7798f37e 100644 --- a/components/viz/service/main/viz_main_impl.cc +++ b/components/viz/service/main/viz_main_impl.cc
@@ -211,7 +211,7 @@ gpu::GpuProcessActivityFlags(std::move(activity_flags_region)), gpu_init_->TakeDefaultOffscreenSurface(), dependencies_.sync_point_manager, dependencies_.shared_image_manager, - dependencies_.shutdown_event); + dependencies_.scheduler, dependencies_.shutdown_event); gpu_service_->Bind(std::move(pending_receiver)); if (!pending_frame_sink_manager_params_.is_null()) {
diff --git a/components/viz/service/main/viz_main_impl.h b/components/viz/service/main/viz_main_impl.h index 74024c98..e1b8a52 100644 --- a/components/viz/service/main/viz_main_impl.h +++ b/components/viz/service/main/viz_main_impl.h
@@ -36,8 +36,9 @@ namespace gpu { class GpuInit; -class SyncPointManager; +class Scheduler; class SharedImageManager; +class SyncPointManager; } // namespace gpu namespace ukm { @@ -93,6 +94,7 @@ mutable std::unique_ptr<base::PowerMonitorSource> power_monitor_source; raw_ptr<gpu::SyncPointManager> sync_point_manager = nullptr; raw_ptr<gpu::SharedImageManager> shared_image_manager = nullptr; + raw_ptr<gpu::Scheduler> scheduler = nullptr; raw_ptr<base::WaitableEvent> shutdown_event = nullptr; scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner; std::unique_ptr<ukm::MojoUkmRecorder> ukm_recorder;
diff --git a/components/viz/test/test_gpu_service_holder.cc b/components/viz/test/test_gpu_service_holder.cc index 4c9da0b..cb41e96 100644 --- a/components/viz/test/test_gpu_service_holder.cc +++ b/components/viz/test/test_gpu_service_holder.cc
@@ -309,7 +309,7 @@ std::move(gpu_host_proxy), gpu::GpuProcessActivityFlags(), gl::init::CreateOffscreenGLSurface(gl::GetDefaultDisplay(), gfx::Size()), /*sync_point_manager=*/nullptr, /*shared_image_manager=*/nullptr, - /*shutdown_event=*/nullptr); + /*scheduler=*/nullptr, /*shutdown_event=*/nullptr); task_executor_ = std::make_unique<gpu::GpuInProcessThreadService>( this, gpu_thread_.task_runner(), gpu_service_->GetGpuScheduler(),
diff --git a/components/viz/test/test_raster_interface.h b/components/viz/test/test_raster_interface.h index e99de82..5ed6208 100644 --- a/components/viz/test/test_raster_interface.h +++ b/components/viz/test/test_raster_interface.h
@@ -130,7 +130,7 @@ const SkImageInfo& dst_info, GLuint dst_row_bytes, unsigned char* out, - base::OnceCallback<void(GrSurfaceOrigin, bool)> readback_done) override {} + base::OnceCallback<void(bool)> readback_done) override {} void ReadbackYUVPixelsAsync( const gpu::Mailbox& source_mailbox, GLenum source_target,
diff --git a/components/webapps/browser/android/bottomsheet/pwa_bottom_sheet_controller.cc b/components/webapps/browser/android/bottomsheet/pwa_bottom_sheet_controller.cc index 947bdf4b..cb1c09b 100644 --- a/components/webapps/browser/android/bottomsheet/pwa_bottom_sheet_controller.cc +++ b/components/webapps/browser/android/bottomsheet/pwa_bottom_sheet_controller.cc
@@ -13,8 +13,10 @@ #include "components/webapps/browser/android/webapps_jni_headers/PwaBottomSheetControllerProvider_jni.h" #include "components/webapps/browser/android/webapps_jni_headers/PwaBottomSheetController_jni.h" #include "components/webapps/browser/webapps_client.h" +#include "components/webapps/common/constants.h" #include "content/public/browser/web_contents.h" #include "ui/gfx/android/java_bitmap.h" +#include "ui/gfx/text_elider.h" using base::ASCIIToUTF16; using base::android::ConvertUTF16ToJavaString; @@ -84,8 +86,10 @@ // longer needed). PwaBottomSheetController* controller = new PwaBottomSheetController( app_name, primary_icon, is_primary_icon_maskable, start_url, - screenshots, description, std::move(a2hs_params), - std::move(a2hs_event_callback)); + screenshots, + gfx::TruncateString(description, webapps::kMaximumDescriptionLength, + gfx::CHARACTER_BREAK), + std::move(a2hs_params), std::move(a2hs_event_callback)); controller->ShowBottomSheetInstaller(web_contents, expand_sheet); } return true;
diff --git a/components/webapps/browser/features.cc b/components/webapps/browser/features.cc index dd89664..90e5c4c 100644 --- a/components/webapps/browser/features.cc +++ b/components/webapps/browser/features.cc
@@ -51,7 +51,13 @@ // Skip the service worker install criteria check for installing. This affect // only the "installable" status but not "promotable". const base::Feature kSkipServiceWorkerCheckInstallOnly{ - "SkipServiceWorkerCheckInstallOnly", base::FEATURE_DISABLED_BY_DEFAULT}; + "SkipServiceWorkerCheckInstallOnly", +#if BUILDFLAG(IS_ANDROID) + base::FEATURE_ENABLED_BY_DEFAULT +#else + base::FEATURE_DISABLED_BY_DEFAULT +#endif +}; // Enables showing a detailed install dialog for user installs. const base::Feature kDesktopPWAsDetailedInstallDialog{
diff --git a/components/webapps/common/constants.cc b/components/webapps/common/constants.cc index 747a075..c2a7a838 100644 --- a/components/webapps/common/constants.cc +++ b/components/webapps/common/constants.cc
@@ -15,4 +15,6 @@ // dimension for screenshots. const double kMaximumScreenshotRatio = 2.3; +const size_t kMaximumDescriptionLength = 300; + } // namespace webapps
diff --git a/components/webapps/common/constants.h b/components/webapps/common/constants.h index 6b70dfd0..8a7592f4 100644 --- a/components/webapps/common/constants.h +++ b/components/webapps/common/constants.h
@@ -20,6 +20,9 @@ // Maximum allowed screenshot ratio between the max dimension and min dimension. extern const double kMaximumScreenshotRatio; +// Maximum length of description to be displayed on the richer install dialog. +extern const size_t kMaximumDescriptionLength; + } // namespace webapps #endif // COMPONENTS_WEBAPPS_COMMON_CONSTANTS_H_
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index c68ec866..bb94a8f 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -950,6 +950,8 @@ "first_party_sets/database/first_party_sets_database.h", "first_party_sets/first_party_set_parser.cc", "first_party_sets/first_party_set_parser.h", + "first_party_sets/first_party_sets_handler_database_helper.cc", + "first_party_sets/first_party_sets_handler_database_helper.h", "first_party_sets/first_party_sets_handler_impl.cc", "first_party_sets/first_party_sets_handler_impl.h", "first_party_sets/first_party_sets_loader.cc",
diff --git a/content/browser/android/java/gin_java_bridge_dispatcher_host.cc b/content/browser/android/java/gin_java_bridge_dispatcher_host.cc index 360c96d..ff734ac 100644 --- a/content/browser/android/java/gin_java_bridge_dispatcher_host.cc +++ b/content/browser/android/java/gin_java_bridge_dispatcher_host.cc
@@ -55,13 +55,12 @@ return; } - // Unretained() is safe because ForEachRenderFrameHost() is synchronous. - web_contents()->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating( - [](GinJavaBridgeDispatcherHost* host, RenderFrameHost* frame) { + web_contents() + ->GetPrimaryMainFrame() + ->ForEachRenderFrameHost( + [this](RenderFrameHostImpl* frame) { AgentSchedulingGroupHost& agent_scheduling_group = - static_cast<RenderFrameHostImpl*>(frame) - ->GetAgentSchedulingGroup(); + frame->GetAgentSchedulingGroup(); scoped_refptr<GinJavaBridgeMessageFilter> per_asg_filter = GinJavaBridgeMessageFilter::FromHost( @@ -73,12 +72,15 @@ GinJavaBridgeObjectDeletionMessageFilter::FromHost( agent_scheduling_group.GetProcess(), /*create_if_not_exists=*/true); - process_global_filter->AddRoutingIdForHost(host, frame); + process_global_filter->AddRoutingIdForHost(this, frame); } - per_asg_filter->AddRoutingIdForHost(host, frame); - }, - base::Unretained(this))); + per_asg_filter->AddRoutingIdForHost(this, frame); + }); +} + +WebContentsImpl* GinJavaBridgeDispatcherHost::web_contents() const { + return static_cast<WebContentsImpl*>(WebContentsObserver::web_contents()); } void GinJavaBridgeDispatcherHost::RenderFrameCreated( @@ -105,19 +107,16 @@ void GinJavaBridgeDispatcherHost::WebContentsDestroyed() { // Unretained() is safe because ForEachRenderFrameHost() is synchronous. web_contents()->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating( - [](GinJavaBridgeDispatcherHost* host, RenderFrameHost* frame) { - AgentSchedulingGroupHost& agent_scheduling_group = - static_cast<RenderFrameHostImpl*>(frame) - ->GetAgentSchedulingGroup(); - scoped_refptr<GinJavaBridgeMessageFilter> filter = - GinJavaBridgeMessageFilter::FromHost( - agent_scheduling_group, /*create_if_not_exists=*/false); + [this](RenderFrameHostImpl* frame) { + AgentSchedulingGroupHost& agent_scheduling_group = + frame->GetAgentSchedulingGroup(); + scoped_refptr<GinJavaBridgeMessageFilter> filter = + GinJavaBridgeMessageFilter::FromHost( + agent_scheduling_group, /*create_if_not_exists=*/false); - if (filter) - filter->RemoveHost(host); - }, - base::Unretained(this))); + if (filter) + filter->RemoveHost(this); + }); } void GinJavaBridgeDispatcherHost::RenderViewHostChanged( @@ -254,16 +253,13 @@ // We should include pending RenderFrameHosts, otherwise they will miss the // chance when calling add or remove methods when they are created but not // committed. See: http://crbug.com/1087806 - WebContentsImpl* web_contents_impl = - static_cast<WebContentsImpl*>(web_contents()); - web_contents_impl->GetPrimaryMainFrame() - ->ForEachRenderFrameHostIncludingSpeculative(base::BindRepeating( - [](const std::string& name, GinJavaBoundObject::ObjectID object_id, - RenderFrameHostImpl* render_frame_host) { + web_contents() + ->GetPrimaryMainFrame() + ->ForEachRenderFrameHostIncludingSpeculative( + [&name, object_id](RenderFrameHostImpl* render_frame_host) { render_frame_host->Send(new GinJavaBridgeMsg_AddNamedObject( render_frame_host->GetRoutingID(), name, object_id)); - }, - name, object_id)); + }); } void GinJavaBridgeDispatcherHost::RemoveNamedObject( @@ -291,15 +287,13 @@ // We should include pending RenderFrameHosts, otherwise they will miss the // chance when calling add or remove methods when they are created but not // committed. See: http://crbug.com/1087806 - WebContentsImpl* web_contents_impl = - static_cast<WebContentsImpl*>(web_contents()); - web_contents_impl->GetPrimaryMainFrame() - ->ForEachRenderFrameHostIncludingSpeculative(base::BindRepeating( - [](const std::string& name, RenderFrameHostImpl* render_frame_host) { + web_contents() + ->GetPrimaryMainFrame() + ->ForEachRenderFrameHostIncludingSpeculative( + [&copied_name](RenderFrameHostImpl* render_frame_host) { render_frame_host->Send(new GinJavaBridgeMsg_RemoveNamedObject( - render_frame_host->GetRoutingID(), name)); - }, - copied_name)); + render_frame_host->GetRoutingID(), copied_name)); + }); } void GinJavaBridgeDispatcherHost::SetAllowObjectContentsInspection(bool allow) {
diff --git a/content/browser/android/java/gin_java_bridge_dispatcher_host.h b/content/browser/android/java/gin_java_bridge_dispatcher_host.h index 1a677bc..16f8c2b 100644 --- a/content/browser/android/java/gin_java_bridge_dispatcher_host.h +++ b/content/browser/android/java/gin_java_bridge_dispatcher_host.h
@@ -25,6 +25,8 @@ namespace content { +class WebContentsImpl; + // This class handles injecting Java objects into a single WebContents / // WebView. The Java object itself lives in the browser process on a background // thread, while multiple JavaScript wrapper objects (one per frame) are created @@ -86,6 +88,7 @@ // Run on the UI thread. void InstallFilterAndRegisterAllRoutingIds(); + WebContentsImpl* web_contents() const; // Run on any thread. GinJavaBoundObject::ObjectID AddObject(
diff --git a/content/browser/back_forward_cache_features_browsertest.cc b/content/browser/back_forward_cache_features_browsertest.cc index 29ebb0e..f2ac816 100644 --- a/content/browser/back_forward_cache_features_browsertest.cc +++ b/content/browser/back_forward_cache_features_browsertest.cc
@@ -2148,7 +2148,7 @@ AppBannerBackForwardCacheBrowserTest, testing::Bool()); -// https://crbug.com/1317431: WebSQL does not work on Fuchsia. +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. #if BUILDFLAG(IS_FUCHSIA) #define MAYBE_DoesNotCacheIfWebDatabase DISABLED_DoesNotCacheIfWebDatabase #else
diff --git a/content/browser/back_forward_cache_internal_browsertest.cc b/content/browser/back_forward_cache_internal_browsertest.cc index 6283c98..b4fe8a1 100644 --- a/content/browser/back_forward_cache_internal_browsertest.cc +++ b/content/browser/back_forward_cache_internal_browsertest.cc
@@ -161,12 +161,12 @@ // that point. In this case, if we stop iteration in the primary page, we do // not continue to iterate in the bfcached page. bool stopped = false; - web_contents()->ForEachRenderFrameHost( - base::BindLambdaForTesting([&](RenderFrameHostImpl* rfh) { + web_contents()->ForEachRenderFrameHostWithAction( + [&](RenderFrameHostImpl* rfh) { EXPECT_FALSE(stopped); stopped = true; return RenderFrameHost::FrameIterationAction::kStop; - })); + }); } EXPECT_EQ(nullptr, rfh_a->GetParentOrOuterDocument());
diff --git a/content/browser/database_browsertest.cc b/content/browser/database_browsertest.cc index fbc8abc..f29e730 100644 --- a/content/browser/database_browsertest.cc +++ b/content/browser/database_browsertest.cc
@@ -17,7 +17,7 @@ namespace content { -// https://crbug.com/1317431: WebSQL does not work on Fuchsia. +// TODO(crbug.com/1317431): WebSQL does not work on Fuchsia. #if BUILDFLAG(IS_FUCHSIA) #define MAYBE_DatabaseTest DISABLED_DatabaseTest #else
diff --git a/content/browser/devtools/frame_auto_attacher.cc b/content/browser/devtools/frame_auto_attacher.cc index 39d7e83..380cfe2 100644 --- a/content/browser/devtools/frame_auto_attacher.cc +++ b/content/browser/devtools/frame_auto_attacher.cc
@@ -171,27 +171,25 @@ Hosts new_hosts; if (render_frame_host_) { - render_frame_host_->ForEachRenderFrameHost(base::BindRepeating( - [](Hosts* new_hosts, RenderFrameHost* root, RenderFrameHost* rfh) { - RenderFrameHostImpl* rfhi = static_cast<RenderFrameHostImpl*>(rfh); + render_frame_host_->ForEachRenderFrameHostWithAction( + [root = render_frame_host_, &new_hosts](RenderFrameHostImpl* rfh) { if (rfh == root) return RenderFrameHost::FrameIterationAction::kContinue; - FrameTreeNode* frame_tree_node = rfhi->frame_tree_node(); + FrameTreeNode* frame_tree_node = rfh->frame_tree_node(); if (frame_tree_node->IsMainFrame() && WebContentsImpl::FromFrameTreeNode(frame_tree_node)->IsPortal()) { scoped_refptr<DevToolsAgentHost> new_host = RenderFrameDevToolsAgentHost::GetOrCreateFor(frame_tree_node); - new_hosts->insert(new_host); + new_hosts.insert(new_host); return RenderFrameHost::FrameIterationAction::kSkipChildren; } - if (rfhi->is_local_root()) + if (rfh->is_local_root()) return RenderFrameHost::FrameIterationAction::kSkipChildren; return RenderFrameHost::FrameIterationAction::kContinue; - }, - &new_hosts, render_frame_host_)); + }); } DispatchSetAttachedTargetsOfType(new_hosts, DevToolsAgentHost::kTypePage); @@ -292,29 +290,27 @@ Hosts new_hosts; DevToolsAgentHost::List new_worklet_hosts; if (render_frame_host_) { - render_frame_host_->ForEachRenderFrameHost(base::BindRepeating( - [](Hosts* new_hosts, RenderFrameHostImpl* root, RenderFrameHost* rfh) { - auto* rfh_impl = static_cast<RenderFrameHostImpl*>(rfh); - if (rfh_impl == root || !rfh_impl->is_local_root()) + render_frame_host_->ForEachRenderFrameHostWithAction( + [root = render_frame_host_, &new_hosts](RenderFrameHostImpl* rfh) { + if (rfh == root || !rfh->is_local_root()) return RenderFrameHost::FrameIterationAction::kContinue; - // At this point, |rfh_impl| is a local root that is in the subtree of + // At this point, |rfh| is a local root that is in the subtree of // |root|. - FrameTreeNode* node = rfh_impl->frame_tree_node(); + FrameTreeNode* node = rfh->frame_tree_node(); bool should_create = !node->IsMainFrame() || node->IsFencedFrameRoot(); if (should_create) { scoped_refptr<DevToolsAgentHost> new_host = RenderFrameDevToolsAgentHost::GetOrCreateFor(node); - new_hosts->insert(new_host); + new_hosts.insert(new_host); } // Note: We don't search through children of local roots as they will // be handled by a FrameAutoAttacher that is created for the local // root. return RenderFrameHost::FrameIterationAction::kSkipChildren; - }, - &new_hosts, render_frame_host_)); + }); AuctionWorkletDevToolsAgentHostManager::GetInstance().GetAllForFrame( render_frame_host_, &new_worklet_hosts);
diff --git a/content/browser/devtools/protocol/emulation_handler.cc b/content/browser/devtools/protocol/emulation_handler.cc index 90c7fbeb..f14c405 100644 --- a/content/browser/devtools/protocol/emulation_handler.cc +++ b/content/browser/devtools/protocol/emulation_handler.cc
@@ -619,15 +619,13 @@ // this is tricky since we'd have to track the DevTools message id with the // WidgetMsg and acknowledgment, as well as plump the acknowledgment back to // the EmulationHandler somehow. Mojo callbacks should make this much simpler. - host_->ForEachRenderFrameHostIncludingSpeculative(base::BindRepeating( - [](EmulationHandler* handler, RenderFrameHostImpl* host) { + host_->ForEachRenderFrameHostIncludingSpeculative( + [this](RenderFrameHostImpl* host) { // The main frame of nested subpages (ex. fenced frames, portals) inside // this page are updated as well. if (host->is_main_frame()) - handler->UpdateDeviceEmulationStateForHost( - host->GetRenderWidgetHost()); - }, - this)); + UpdateDeviceEmulationStateForHost(host->GetRenderWidgetHost()); + }); } void EmulationHandler::UpdateDeviceEmulationStateForHost(
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.cc b/content/browser/devtools/render_frame_devtools_agent_host.cc index df78c4f..51753a9 100644 --- a/content/browser/devtools/render_frame_devtools_agent_host.cc +++ b/content/browser/devtools/render_frame_devtools_agent_host.cc
@@ -197,17 +197,15 @@ // ForEachRenderFrameHost. if (wc->GetOutermostWebContents() != wc) continue; - wc->GetPrimaryMainFrame()->ForEachRenderFrameHost(base::BindRepeating( - [](DevToolsAgentHost::List* result, - RenderFrameHost* render_frame_host) { + wc->GetPrimaryMainFrame()->ForEachRenderFrameHost( + [result](RenderFrameHostImpl* render_frame_host) { FrameTreeNode* node = FrameTreeNode::From(render_frame_host); if (!ShouldCreateDevToolsForNode(node)) return; if (!render_frame_host->IsRenderFrameLive()) return; result->push_back(RenderFrameDevToolsAgentHost::GetOrCreateFor(node)); - }, - result)); + }); } }
diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index 988c0d60..d612ecc 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc
@@ -171,8 +171,8 @@ const base::FilePath::CharType SavePackage::kDefaultHtmlExtension[] = FILE_PATH_LITERAL("html"); -SavePackage::SavePackage(Page& page) - : page_(page.GetWeakPtr()), +SavePackage::SavePackage(PageImpl& page) + : page_(page.GetWeakPtrImpl()), page_url_(GetUrlToBeSaved(&page.GetMainDocument())), title_(GetTitle(page)), start_tick_(base::TimeTicks::Now()), @@ -183,11 +183,11 @@ } // Used for tests. -SavePackage::SavePackage(Page& page, +SavePackage::SavePackage(PageImpl& page, SavePageType save_type, const base::FilePath& file_full_path, const base::FilePath& directory_full_path) - : page_(page.GetWeakPtr()), + : page_(page.GetWeakPtrImpl()), page_url_(GetUrlToBeSaved(&page.GetMainDocument())), saved_main_file_path_(file_full_path), saved_main_directory_path_(directory_full_path), @@ -1200,11 +1200,11 @@ } void SavePackage::GetSavableResourceLinksForRenderFrameHost( - RenderFrameHost* rfh) { + RenderFrameHostImpl* rfh) { if (!IsSavableFrame(rfh)) return; ++number_of_frames_pending_response_; - static_cast<RenderFrameHostImpl*>(rfh)->GetSavableResourceLinksFromRenderer(); + rfh->GetSavableResourceLinksFromRenderer(); } // Ask for all savable resource links from backend, include main frame and @@ -1218,8 +1218,10 @@ wait_state_ = RESOURCES_LIST; DCHECK_EQ(0, number_of_frames_pending_response_); - page_->GetMainDocument().ForEachRenderFrameHost(base::BindRepeating( - &SavePackage::GetSavableResourceLinksForRenderFrameHost, this)); + page_->GetMainDocument().ForEachRenderFrameHost( + [this](RenderFrameHostImpl* rfh) { + GetSavableResourceLinksForRenderFrameHost(rfh); + }); DCHECK_LT(0, number_of_frames_pending_response_); // Enqueue the main frame separately (because this frame won't show up in any
diff --git a/content/browser/download/save_package.h b/content/browser/download/save_package.h index 4b98c0fe..52373f3 100644 --- a/content/browser/download/save_package.h +++ b/content/browser/download/save_package.h
@@ -42,7 +42,7 @@ namespace content { class DownloadManagerImpl; -class Page; +class PageImpl; class FrameTreeNode; class RenderFrameHostImpl; class SaveFileManager; @@ -89,7 +89,7 @@ // Constructor for user initiated page saving. This constructor results in a // SavePackage that will generate and sanitize a suggested name for the user // in the "Save As" dialog box. - explicit SavePackage(Page& page); + explicit SavePackage(PageImpl& page); SavePackage(const SavePackage&) = delete; SavePackage& operator=(const SavePackage&) = delete; @@ -167,7 +167,7 @@ // Used only for testing. Bypasses the file and directory name generation / // sanitization by providing well known paths better suited for tests. - SavePackage(Page& page, + SavePackage(PageImpl& page, SavePageType save_type, const base::FilePath& file_full_path, const base::FilePath& directory_full_path); @@ -261,7 +261,7 @@ // with the help of CreatePendingSaveItem, EnqueueSavableResource, // EnqueueFrame. void GetSavableResourceLinks(); - void GetSavableResourceLinksForRenderFrameHost(RenderFrameHost* rfh); + void GetSavableResourceLinksForRenderFrameHost(RenderFrameHostImpl* rfh); // Helper for finding or creating a SaveItem with the given parameters. SaveItem* CreatePendingSaveItem( @@ -363,7 +363,7 @@ // The current page, may be null if the primary page has been navigated away // or destroyed. - base::WeakPtr<Page> page_; + base::WeakPtr<PageImpl> page_; // A queue for items we are about to start saving. base::circular_deque<std::unique_ptr<SaveItem>> waiting_item_queue_;
diff --git a/content/browser/download/save_package_browsertest.cc b/content/browser/download/save_package_browsertest.cc index c566c8e2..e46f8cd 100644 --- a/content/browser/download/save_package_browsertest.cc +++ b/content/browser/download/save_package_browsertest.cc
@@ -12,6 +12,7 @@ #include "base/threading/sequenced_task_runner_handle.h" #include "content/browser/download/download_manager_impl.h" #include "content/browser/download/save_package.h" +#include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_package/web_bundle_utils.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/download_manager.h" @@ -190,7 +191,7 @@ download_manager->AddObserver(&download_item_killer); scoped_refptr<SavePackage> save_package( - new SavePackage(shell()->web_contents()->GetPrimaryPage())); + new SavePackage(web_contents_impl()->GetPrimaryPage())); save_package->GetSaveInfo(); run_loop.Run(); download_manager->RemoveObserver(&download_item_killer); @@ -211,6 +212,10 @@ download_manager->SetDelegate(old_delegate); } + WebContentsImpl* web_contents_impl() { + return static_cast<WebContentsImpl*>(shell()->web_contents()); + } + // Temporary directory we will save pages to. base::ScopedTempDir save_dir_; }; @@ -224,7 +229,7 @@ base::FilePath full_file_name, dir; GetDestinationPaths("a", &full_file_name, &dir); scoped_refptr<SavePackage> save_package( - new SavePackage(shell()->web_contents()->GetPrimaryPage(), + new SavePackage(web_contents_impl()->GetPrimaryPage(), SAVE_PAGE_TYPE_AS_ONLY_HTML, full_file_name, dir)); } @@ -237,7 +242,7 @@ base::FilePath full_file_name, dir; GetDestinationPaths("a", &full_file_name, &dir); scoped_refptr<SavePackage> save_package( - new SavePackage(shell()->web_contents()->GetPrimaryPage(), + new SavePackage(web_contents_impl()->GetPrimaryPage(), SAVE_PAGE_TYPE_AS_ONLY_HTML, full_file_name, dir)); save_package->Cancel(true); } @@ -269,7 +274,7 @@ download_manager->SetDelegate(delegate.get()); scoped_refptr<SavePackage> save_package( - new SavePackage(shell()->web_contents()->GetPrimaryPage(), + new SavePackage(web_contents_impl()->GetPrimaryPage(), SAVE_PAGE_TYPE_AS_ONLY_HTML, full_file_name, dir)); save_package->GetSaveInfo(); shell()->web_contents()->GetController().Reload(content::ReloadType::NORMAL, @@ -312,7 +317,7 @@ DownloadCompleteObserver observer(run_loop.QuitClosure()); download_manager->AddObserver(&observer); scoped_refptr<SavePackage> save_package( - new SavePackage(shell()->web_contents()->GetPrimaryPage())); + new SavePackage(web_contents_impl()->GetPrimaryPage())); save_package->GetSaveInfo(); run_loop.Run(); download_manager->RemoveObserver(&observer); @@ -387,7 +392,7 @@ DownloadCompleteObserver observer(run_loop.QuitClosure()); download_manager->AddObserver(&observer); scoped_refptr<SavePackage> save_package( - new SavePackage(shell()->web_contents()->GetPrimaryPage())); + new SavePackage(web_contents_impl()->GetPrimaryPage())); save_package->GetSaveInfo(); run_loop.Run(); download_manager->RemoveObserver(&observer);
diff --git a/content/browser/find_request_manager.cc b/content/browser/find_request_manager.cc index 4dc00f6..0b53c04 100644 --- a/content/browser/find_request_manager.cc +++ b/content/browser/find_request_manager.cc
@@ -377,32 +377,29 @@ } void FindRequestManager::ForEachAddedFindInPageRenderFrameHost( - FrameIterationCallback callback) { - contents_->GetPrimaryMainFrame()->ForEachRenderFrameHost(base::BindRepeating( - [](FindRequestManager* manager, FrameIterationCallback callback, - RenderFrameHostImpl* rfh) { - if (!manager->CheckFrame(rfh)) + base::FunctionRef<void(RenderFrameHostImpl*)> func_ref) { + contents_->GetPrimaryMainFrame()->ForEachRenderFrameHost( + [this, func_ref](RenderFrameHostImpl* rfh) { + if (!CheckFrame(rfh)) return; // A Portal's RenderFrameHost can't reach here because we don't observe // Portals WebContents (see FindRequestManager::FindInternal()). DCHECK(!WebContents::FromRenderFrameHost(rfh)->IsPortal()); DCHECK(rfh->IsRenderFrameLive()); DCHECK(rfh->IsActive()); - callback.Run(rfh); - }, - this, std::move(callback))); + func_ref(rfh); + }); } void FindRequestManager::StopFinding(StopFindAction action) { // Cancel any delayed find-in-page requests delayed_find_task_.Cancel(); - ForEachAddedFindInPageRenderFrameHost(base::BindRepeating( - [](StopFindAction action, RenderFrameHostImpl* rfh) { - rfh->GetFindInPage()->StopFinding( - static_cast<blink::mojom::StopFindAction>(action)); - }, - action)); + ForEachAddedFindInPageRenderFrameHost([action](RenderFrameHostImpl* rfh) { + rfh->GetFindInPage()->StopFinding( + // TODO(dcheng): Use typemapping or use the Mojo enum directly. + static_cast<blink::mojom::StopFindAction>(action)); + }); current_session_id_ = kInvalidId; #if BUILDFLAG(IS_ANDROID) @@ -587,18 +584,16 @@ // Request from each frame the distance to the nearest find result (in that // frame) from the point (x, y), defined in find-in-page coordinates. - ForEachAddedFindInPageRenderFrameHost(base::BindRepeating( - [](FindRequestManager* manager, RenderFrameHostImpl* rfh) { - manager->activate_.pending_replies.insert(rfh); - // Lifetime of FindRequestManager > RenderFrameHost > Mojo - // connection, so it's safe to bind |this| and |rfh|. - rfh->GetFindInPage()->GetNearestFindResult( - manager->activate_.point, - base::BindOnce(&FindRequestManager::OnGetNearestFindResultReply, - base::Unretained(manager), rfh, - manager->activate_.current_request_id)); - }, - this)); + ForEachAddedFindInPageRenderFrameHost([this](RenderFrameHostImpl* rfh) { + activate_.pending_replies.insert(rfh); + // Lifetime of FindRequestManager > RenderFrameHost > Mojo + // connection, so it's safe to bind |this| and |rfh|. + rfh->GetFindInPage()->GetNearestFindResult( + activate_.point, + base::BindOnce(&FindRequestManager::OnGetNearestFindResultReply, + base::Unretained(this), rfh, + activate_.current_request_id)); + }); } void FindRequestManager::OnGetNearestFindResultReply(RenderFrameHostImpl* rfh, @@ -624,18 +619,17 @@ match_rects_.active_rect = gfx::RectF(); // Request the latest find match rects from each frame. - ForEachAddedFindInPageRenderFrameHost(base::BindRepeating( - [](FindRequestManager* manager, RenderFrameHostImpl* rfh) { - manager->match_rects_.pending_replies.insert(rfh); - auto it = manager->match_rects_.frame_rects.find(rfh); - int version = (it != manager->match_rects_.frame_rects.end()) - ? it->second.version - : kInvalidId; - rfh->GetFindInPage()->FindMatchRects( - version, base::BindOnce(&FindRequestManager::OnFindMatchRectsReply, - base::Unretained(manager), rfh)); - }, - this)); + ForEachAddedFindInPageRenderFrameHost([this](RenderFrameHostImpl* rfh) { + match_rects_.pending_replies.insert(rfh); + auto it = match_rects_.frame_rects.find(rfh); + int version = (it != match_rects_.frame_rects.end()) ? it->second.version + : kInvalidId; + // Lifetime of FindRequestManager > RenderFrameHost > Mojo + // connection, so it's safe to bind |this| and |rfh|. + rfh->GetFindInPage()->FindMatchRects( + version, base::BindOnce(&FindRequestManager::OnFindMatchRectsReply, + base::Unretained(this), rfh)); + }); } void FindRequestManager::OnFindMatchRectsReply( @@ -707,9 +701,8 @@ // ForEachRenderFrameHost instead of ForEachAddedFindInPageRenderFrameHost // because that calls CheckFrame() which will only be true if we've called // AddFrame() for the frame. - contents_->GetPrimaryMainFrame()->ForEachRenderFrameHost(base::BindRepeating( - [](FindRequestManager* manager, WebContents* web_contents, - RenderFrameHostImpl* rfh) { + contents_->GetPrimaryMainFrame()->ForEachRenderFrameHost( + [this](RenderFrameHostImpl* rfh) { // Portals can't receive keyboard events or be focused, so we don't // return find results inside a portal. auto* wc = WebContents::FromRenderFrameHost(rfh); @@ -717,14 +710,12 @@ return; // Make sure each WebContents is only added once. if (rfh->IsInPrimaryMainFrame()) { - manager->frame_observers_.push_back( - std::make_unique<FrameObserver>(wc, manager)); + frame_observers_.push_back(std::make_unique<FrameObserver>(wc, this)); } if (IsFindInPageDisabled(rfh)) return; - manager->AddFrame(rfh, false /* force */); - }, - this, contents_)); + AddFrame(rfh, false /* force */); + }); } void FindRequestManager::AdvanceQueue(int request_id) {
diff --git a/content/browser/find_request_manager.h b/content/browser/find_request_manager.h index 2e897702f..c506baa0 100644 --- a/content/browser/find_request_manager.h +++ b/content/browser/find_request_manager.h
@@ -12,6 +12,7 @@ #include "base/cancelable_callback.h" #include "base/containers/queue.h" +#include "base/functional/function_ref.h" #include "base/memory/raw_ptr.h" #include "base/time/time.h" #include "build/build_config.h" @@ -217,11 +218,10 @@ std::unique_ptr<FindInPageClient> CreateFindInPageClient( RenderFrameHostImpl* rfh); - using FrameIterationCallback = - base::RepeatingCallback<void(RenderFrameHostImpl*)>; // Traverses all RenderFrameHosts added for find-in-page and invokes the // callback if the each RenderFrameHost is alive and active. - void ForEachAddedFindInPageRenderFrameHost(FrameIterationCallback callback); + void ForEachAddedFindInPageRenderFrameHost( + base::FunctionRef<void(RenderFrameHostImpl*)> func_ref); void EmitFindRequest(int request_id, const std::u16string& search_text,
diff --git a/content/browser/first_party_sets/first_party_sets_handler_database_helper.cc b/content/browser/first_party_sets/first_party_sets_handler_database_helper.cc new file mode 100644 index 0000000..b11b05e --- /dev/null +++ b/content/browser/first_party_sets/first_party_sets_handler_database_helper.cc
@@ -0,0 +1,118 @@ +// Copyright 2022 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 "content/browser/first_party_sets/first_party_sets_handler_database_helper.h" + +#include "base/containers/contains.h" +#include "base/logging.h" +#include "content/browser/first_party_sets/database/first_party_sets_database.h" +#include "net/base/schemeful_site.h" +#include "net/cookies/first_party_set_entry.h" + +namespace content { + +namespace { + +// TODO(https://crbug.com/1349487): Since this is basically the same as +// FirstPartySetsManager::FindOwnerInternal(), move the common algorithm into +// //net to be reused in both here and FirstPartySetsManager. +absl::optional<net::FirstPartySetEntry> FindOwner( + const net::SchemefulSite& site, + const FirstPartySetsHandlerDatabaseHelper::FlattenedSets& sets, + const FirstPartySetsHandlerDatabaseHelper::PolicyCustomization& + policy_sets) { + absl::optional<net::FirstPartySetEntry> owner; + if (const auto it = policy_sets.find(site); it != policy_sets.end()) { + owner = it->second; + } else if (const auto it = sets.find(site); it != sets.end()) { + owner = it->second; + } + return owner; +} + +} // namespace + +FirstPartySetsHandlerDatabaseHelper::FirstPartySetsHandlerDatabaseHelper( + const base::FilePath& db_path) { + DCHECK(!db_path.empty()); + db_ = std::make_unique<FirstPartySetsDatabase>(db_path); +} + +FirstPartySetsHandlerDatabaseHelper::~FirstPartySetsHandlerDatabaseHelper() = + default; + +// static +base::flat_set<net::SchemefulSite> +FirstPartySetsHandlerDatabaseHelper::ComputeSetsDiff( + const FlattenedSets& old_sets, + const PolicyCustomization& old_policy, + const FlattenedSets& current_sets, + const PolicyCustomization& current_policy) { + // TODO(https://crbug.com/1219656): For now we don't clear site data if FPSs + // is disabled. This may change with future feature ruquest. + if ((old_sets.empty() && old_policy.empty()) || + (current_sets.empty() && current_policy.empty())) + return {}; + + std::vector<net::SchemefulSite> result; + for (const auto& old_pair : old_sets) { + const net::SchemefulSite& old_member = old_pair.first; + const net::FirstPartySetEntry& old_entry = old_pair.second; + + if (base::Contains(old_policy, old_member)) + continue; + + absl::optional<net::FirstPartySetEntry> current_entry = + FindOwner(old_member, current_sets, current_policy); + // Look for the removed sites and the ones have owner changed. + if (!current_entry.has_value() || + current_entry.value().primary() != old_entry.primary()) { + result.push_back(old_member); + } + } + + for (const auto& old_pair : old_policy) { + const net::SchemefulSite& old_member = old_pair.first; + const absl::optional<net::FirstPartySetEntry>& old_entry = old_pair.second; + + const absl::optional<net::FirstPartySetEntry> current_entry = + FindOwner(old_member, current_sets, current_policy); + // Look for the ones have owner changed. + if (old_entry.has_value() && current_entry != old_entry) { + result.push_back(old_member); + } + } + return result; +} + +std::vector<net::SchemefulSite> +FirstPartySetsHandlerDatabaseHelper::UpdateAndGetSitesToClearForContext( + const std::string& browser_context_id, + const FlattenedSets& old_sets, + const FlattenedSets& current_sets, + const PolicyCustomization& current_policy) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + base::flat_set<net::SchemefulSite> diff = ComputeSetsDiff( + old_sets, db_->FetchPolicyModifications(browser_context_id), current_sets, + current_policy); + + if (!db_->InsertSitesToClear(browser_context_id, diff)) { + DVLOG(1) << "Failed to update the sites to clear for browser_context_id=" + << browser_context_id; + return {}; + } + return db_->FetchSitesToClear(browser_context_id); +} + +void FirstPartySetsHandlerDatabaseHelper::UpdateClearStatusForContext( + const std::string& browser_context_id) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + if (!db_->InsertBrowserContextCleared(browser_context_id)) { + DVLOG(1) << "Failed to update clear state for browser_context_id=" + << browser_context_id; + } +} + +} // namespace content
diff --git a/content/browser/first_party_sets/first_party_sets_handler_database_helper.h b/content/browser/first_party_sets/first_party_sets_handler_database_helper.h new file mode 100644 index 0000000..1e10853a --- /dev/null +++ b/content/browser/first_party_sets/first_party_sets_handler_database_helper.h
@@ -0,0 +1,94 @@ +// Copyright 2022 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. + +#ifndef CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SETS_HANDLER_DATABASE_HELPER_H_ +#define CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SETS_HANDLER_DATABASE_HELPER_H_ + +#include <memory> +#include <string> +#include <vector> + +#include "base/containers/flat_map.h" +#include "base/containers/flat_set.h" +#include "base/files/file_path.h" +#include "base/sequence_checker.h" +#include "content/common/content_export.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace net { +class SchemefulSite; +class FirstPartySetEntry; +} // namespace net + +namespace content { + +class FirstPartySetsDatabase; + +// A helper class for the access of the underlying First-Party Sets database. +// Owned by the FirstPartySetsHandlerImpl, and will be created on a different +// sequence that supports blocking, i.e. a database sequence, so that none of +// these methods should be called directly on the main thread. +class CONTENT_EXPORT FirstPartySetsHandlerDatabaseHelper { + public: + using FlattenedSets = + base::flat_map<net::SchemefulSite, net::FirstPartySetEntry>; + using PolicyCustomization = + base::flat_map<net::SchemefulSite, + absl::optional<net::FirstPartySetEntry>>; + + explicit FirstPartySetsHandlerDatabaseHelper( + const base::FilePath& user_data_directory); + + FirstPartySetsHandlerDatabaseHelper( + const FirstPartySetsHandlerDatabaseHelper&) = delete; + FirstPartySetsHandlerDatabaseHelper& operator=( + const FirstPartySetsHandlerDatabaseHelper&) = delete; + FirstPartySetsHandlerDatabaseHelper(FirstPartySetsHandlerDatabaseHelper&&) = + delete; + FirstPartySetsHandlerDatabaseHelper& operator=( + FirstPartySetsHandlerDatabaseHelper&&) = delete; + + ~FirstPartySetsHandlerDatabaseHelper(); + + // Gets the difference between the previously used FPSs info with the current + // FPSs info by comparing the combined `old_sets` and `old_policy` with the + // combined `current_sets` and `current_policy`. Returns the set of sites + // that: 1) were in old FPSs but are no longer in current FPSs i.e. leave the + // FPSs; or, 2) mapped to a different owner site. + // + // This method assumes that the sites were normalized properly when the maps + // were created. Made public only for testing, + static base::flat_set<net::SchemefulSite> ComputeSetsDiff( + const FlattenedSets& old_sets, + const PolicyCustomization& old_policy, + const FlattenedSets& current_sets, + const PolicyCustomization& current_policy); + + // Gets the list of sites to clear for the `browser_context_id`. This method + // wraps a few DB operations: reads the old policy customization from DB, call + // `ComputeSetsDiff` with required inputs to compute the list of sites to + // clear, stores the sites into DB, then reads the final list of sites to be + // cleared from DB, which can include sites stored during previous browser + // runs that did not have state cleared. + std::vector<net::SchemefulSite> UpdateAndGetSitesToClearForContext( + const std::string& browser_context_id, + const FlattenedSets& old_sets, + const FlattenedSets& current_sets, + const PolicyCustomization& current_policy); + + // Wraps FirstPartySetsDatabase::InsertBrowserContextCleared. + // Update DB whether site data clearing has been performed for the + // `browser_context_id`. + void UpdateClearStatusForContext(const std::string& browser_context_id); + + private: + std::unique_ptr<FirstPartySetsDatabase> db_ + GUARDED_BY_CONTEXT(sequence_checker_); + + SEQUENCE_CHECKER(sequence_checker_); +}; + +} // namespace content + +#endif // CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SETS_HANDLER_DATABASE_HELPER_H_
diff --git a/content/browser/first_party_sets/first_party_sets_handler_database_helper_unittest.cc b/content/browser/first_party_sets/first_party_sets_handler_database_helper_unittest.cc new file mode 100644 index 0000000..71fa698 --- /dev/null +++ b/content/browser/first_party_sets/first_party_sets_handler_database_helper_unittest.cc
@@ -0,0 +1,470 @@ +// Copyright 2022 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 "content/browser/first_party_sets/first_party_sets_handler_database_helper.h" + +#include <string> + +#include "base/files/scoped_temp_dir.h" +#include "base/test/task_environment.h" +#include "net/base/schemeful_site.h" +#include "net/cookies/first_party_set_entry.h" +#include "testing/gmock/include/gmock/gmock-matchers.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/abseil-cpp/absl/types/optional.h" +#include "url/gurl.h" + +using ::testing::Eq; +using ::testing::IsEmpty; +using ::testing::Optional; +using ::testing::Pair; +using ::testing::UnorderedElementsAre; + +namespace content { +namespace { +using PolicyCustomization = + FirstPartySetsHandlerDatabaseHelper::PolicyCustomization; +using FlattenedSets = FirstPartySetsHandlerDatabaseHelper::FlattenedSets; + +MATCHER_P(SerializesTo, want, "") { + const std::string got = arg.Serialize(); + return testing::ExplainMatchResult(testing::Eq(want), got, result_listener); +} + +} // namespace + +TEST(FirstPartySetsHandlerDatabaseHelper, ComputeSetsDiff_SitesJoined) { + FirstPartySetsHandlerDatabaseHelper::FlattenedSets old_sets = { + {net::SchemefulSite(GURL("https://example.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member1.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}, + {net::SchemefulSite(GURL("https://member3.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 1)}}; + + FirstPartySetsHandlerDatabaseHelper::FlattenedSets current_sets = { + {net::SchemefulSite(GURL("https://example.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member1.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}, + {net::SchemefulSite(GURL("https://member3.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 1)}, + {net::SchemefulSite(GURL("https://foo.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member2.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}, + }; + + // "https://foo.test" and "https://member2.test" joined FPSs. We don't clear + // site data upon joining, so the computed diff should be empty set. + EXPECT_THAT( + FirstPartySetsHandlerDatabaseHelper::ComputeSetsDiff( + old_sets, /*old_policy=*/{}, current_sets, /*current_policy=*/{}), + IsEmpty()); +} + +TEST(FirstPartySetsHandlerDatabaseHelper, ComputeSetsDiff_SitesLeft) { + FirstPartySetsHandlerDatabaseHelper::FlattenedSets old_sets = { + {net::SchemefulSite(GURL("https://example.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member1.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}, + {net::SchemefulSite(GURL("https://member3.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 1)}, + {net::SchemefulSite(GURL("https://foo.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member2.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}}; + + FirstPartySetsHandlerDatabaseHelper::FlattenedSets current_sets = { + {net::SchemefulSite(GURL("https://example.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member1.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}}; + + // Expected diff: "https://foo.test", "https://member2.test" and + // "https://member3.test" left FPSs. + EXPECT_THAT( + FirstPartySetsHandlerDatabaseHelper::ComputeSetsDiff( + old_sets, /*old_policy=*/{}, current_sets, /*current_policy=*/{}), + UnorderedElementsAre(SerializesTo("https://foo.test"), + SerializesTo("https://member2.test"), + SerializesTo("https://member3.test"))); +} + +TEST(FirstPartySetsHandlerDatabaseHelper, ComputeSetsDiff_OwnerChanged) { + FirstPartySetsHandlerDatabaseHelper::FlattenedSets old_sets = { + {net::SchemefulSite(GURL("https://example.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member1.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}, + {net::SchemefulSite(GURL("https://foo.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member2.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}, + {net::SchemefulSite(GURL("https://member3.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 1)}}; + + FirstPartySetsHandlerDatabaseHelper::FlattenedSets current_sets = { + {net::SchemefulSite(GURL("https://example.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member1.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}, + {net::SchemefulSite(GURL("https://member3.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 1)}, + {net::SchemefulSite(GURL("https://foo.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member2.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}}; + + // Expected diff: "https://member3.test" changed owner. + EXPECT_THAT( + FirstPartySetsHandlerDatabaseHelper::ComputeSetsDiff( + old_sets, /*old_policy=*/{}, current_sets, /*current_policy=*/{}), + UnorderedElementsAre(SerializesTo("https://member3.test"))); +} + +TEST(FirstPartySetsHandlerDatabaseHelper, ComputeSetsDiff_OwnerLeft) { + FirstPartySetsHandlerDatabaseHelper::FlattenedSets old_sets = { + {net::SchemefulSite(GURL("https://example.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://foo.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}, + {net::SchemefulSite(GURL("https://bar.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 1)}}; + + FirstPartySetsHandlerDatabaseHelper::FlattenedSets current_sets = { + {net::SchemefulSite(GURL("https://foo.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://bar.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}}; + + // Expected diff: "https://example.test" left FPSs, "https://foo.test" and + // "https://bar.test" changed owner. + // It would be valid to only have example.test in the diff, but our logic + // isn't sophisticated enough yet to know that foo.test and bar.test don't + // need to be included in the result. + EXPECT_THAT( + FirstPartySetsHandlerDatabaseHelper::ComputeSetsDiff( + old_sets, /*old_policy=*/{}, current_sets, /*current_policy=*/{}), + UnorderedElementsAre(SerializesTo("https://example.test"), + SerializesTo("https://foo.test"), + SerializesTo("https://bar.test"))); +} + +TEST(FirstPartySetsHandlerDatabaseHelper, ComputeSetsDiff_OwnerMemberRotate) { + FirstPartySetsHandlerDatabaseHelper::FlattenedSets old_sets = { + {net::SchemefulSite(GURL("https://example.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://foo.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}}; + + FirstPartySetsHandlerDatabaseHelper::FlattenedSets current_sets = { + {net::SchemefulSite(GURL("https://example.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}, + {net::SchemefulSite(GURL("https://foo.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kPrimary, absl::nullopt)}}; + + // Expected diff: "https://example.test" and "https://foo.test" changed owner. + // It would be valid to not include example.test and foo.test in the result, + // but our logic isn't sophisticated enough yet to know that.ß + EXPECT_THAT( + FirstPartySetsHandlerDatabaseHelper::ComputeSetsDiff( + old_sets, /*old_policy=*/{}, current_sets, /*current_policy=*/{}), + UnorderedElementsAre(SerializesTo("https://example.test"), + SerializesTo("https://foo.test"))); +} + +TEST(FirstPartySetsHandlerDatabaseHelper, ComputeSetsDiff_EmptyOldSets) { + // Empty old_sets. + FirstPartySetsHandlerDatabaseHelper::FlattenedSets current_sets = { + {net::SchemefulSite(GURL("https://example.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member1.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}}; + + EXPECT_THAT(FirstPartySetsHandlerDatabaseHelper::ComputeSetsDiff( + /*old_sets=*/{}, /*old_policy=*/{}, current_sets, + /*current_policy=*/{}), + IsEmpty()); +} + +TEST(FirstPartySetsHandlerDatabaseHelper, ComputeSetsDiff_EmptyCurrentSets) { + // Empty current sets. + FirstPartySetsHandlerDatabaseHelper::FlattenedSets old_sets = { + {net::SchemefulSite(GURL("https://example.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member1.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}}; + + EXPECT_THAT(FirstPartySetsHandlerDatabaseHelper::ComputeSetsDiff( + old_sets, /*old_policy=*/{}, /*current_sets=*/{}, + /*current_policy=*/{}), + IsEmpty()); +} + +TEST(FirstPartySetsHandlerDatabaseHelper, ComputeSetsDiff_PolicySitesJoined) { + FirstPartySetsHandlerDatabaseHelper::PolicyCustomization current_policy = { + {net::SchemefulSite(GURL("https://foo.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kPrimary, absl::nullopt)}}, + {net::SchemefulSite(GURL("https://member2.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}}, + }; + + // "https://example.test" and "https://member2.test" joined FPSs via + // enterprise policy. We don't clear site data upon joining, so the computed + // diff should be empty. + EXPECT_THAT(FirstPartySetsHandlerDatabaseHelper::ComputeSetsDiff( + /*old_sets=*/{}, /*old_policy=*/{}, /*current_sets=*/{}, + current_policy), + IsEmpty()); +} + +TEST(FirstPartySetsHandlerDatabaseHelper, + ComputeSetsDiff_PolicyRemovedSitesJoined) { + FirstPartySetsHandlerDatabaseHelper::FlattenedSets sets = { + {net::SchemefulSite(GURL("https://example.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member1.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}}; + + // "https://example.test" was removed from FPSs by policy modifications. + FirstPartySetsHandlerDatabaseHelper::PolicyCustomization old_policy = { + {net::SchemefulSite(GURL("https://foo.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kPrimary, absl::nullopt)}}, + {net::SchemefulSite(GURL("https://member1.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}}, + {net::SchemefulSite(GURL("https://example.test")), absl::nullopt}, + }; + + // "https://example.test" added back to FPSs. + FirstPartySetsHandlerDatabaseHelper::PolicyCustomization current_policy = { + {net::SchemefulSite(GURL("https://foo.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kPrimary, absl::nullopt)}}, + {net::SchemefulSite(GURL("https://member1.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}}, + {net::SchemefulSite(GURL("https://example.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}}, + }; + + // We don't clear site data upon joining, so the computed diff should be + // empty. + EXPECT_THAT( + FirstPartySetsHandlerDatabaseHelper::ComputeSetsDiff( + /*old_sets=*/sets, old_policy, /*current_sets=*/sets, current_policy), + IsEmpty()); +} + +TEST(FirstPartySetsHandlerDatabaseHelper, ComputeSetsDiff_PolicyMemberLeft) { + FirstPartySetsHandlerDatabaseHelper::PolicyCustomization old_policy = { + {net::SchemefulSite(GURL("https://foo.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kPrimary, absl::nullopt)}}, + {net::SchemefulSite(GURL("https://member1.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}}, + {net::SchemefulSite(GURL("https://member2.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}}, + }; + + // "https://member2.test" left FPSs via enterprise policy. + FirstPartySetsHandlerDatabaseHelper::PolicyCustomization current_policy = { + {net::SchemefulSite(GURL("https://foo.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kPrimary, absl::nullopt)}}, + {net::SchemefulSite(GURL("https://member1.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}}, + }; + + EXPECT_THAT( + FirstPartySetsHandlerDatabaseHelper::ComputeSetsDiff( + /*old_sets=*/{}, old_policy, /*current_sets=*/{}, current_policy), + UnorderedElementsAre(SerializesTo("https://member2.test"))); +} + +TEST(FirstPartySetsHandlerDatabaseHelper, ComputeSetsDiff_PolicyOwnerLeft) { + FirstPartySetsHandlerDatabaseHelper::PolicyCustomization old_policy = { + {net::SchemefulSite(GURL("https://example.test")), + {net::FirstPartySetEntry( + net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kPrimary, absl::nullopt)}}, + {net::SchemefulSite(GURL("https://member1.test")), + {net::FirstPartySetEntry( + net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}}, + {net::SchemefulSite(GURL("https://member2.test")), + {net::FirstPartySetEntry( + net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}}, + }; + + FirstPartySetsHandlerDatabaseHelper::PolicyCustomization current_policy = { + {net::SchemefulSite(GURL("https://member1.test")), + {net::FirstPartySetEntry( + net::SchemefulSite(GURL("https://member1.test")), + net::SiteType::kPrimary, absl::nullopt)}}, + {net::SchemefulSite(GURL("https://member2.test")), + {net::FirstPartySetEntry( + net::SchemefulSite(GURL("https://member1.test")), + net::SiteType::kAssociated, 0)}}, + }; + + // Expected diff: "https://example.test" left FPSs, "https://member1.test" and + // "https://member2.test" changed owner. + // It would be valid to only have example.test in the diff, but our logic + // isn't sophisticated enough yet to know that member1.test and member2.test + // don't need to be included in the result. + EXPECT_THAT(FirstPartySetsHandlerDatabaseHelper::ComputeSetsDiff( + /*old_sets=*/{}, /*old_policy=*/old_policy, + /*current_sets=*/{}, current_policy), + UnorderedElementsAre(SerializesTo("https://example.test"), + SerializesTo("https://member1.test"), + SerializesTo("https://member2.test"))); +} + +TEST(FirstPartySetsHandlerDatabaseHelper, + ComputeSetsDiff_PolicyMembersChangeSet) { + FirstPartySetsHandlerDatabaseHelper::PolicyCustomization old_policy = { + {net::SchemefulSite(GURL("https://foo.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kPrimary, absl::nullopt)}}, + {net::SchemefulSite(GURL("https://member1.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}}, + {net::SchemefulSite(GURL("https://bar.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://bar.test")), + net::SiteType::kPrimary, absl::nullopt)}}, + {net::SchemefulSite(GURL("https://member2.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://bar.test")), + net::SiteType::kAssociated, 0)}}, + }; + + FirstPartySetsHandlerDatabaseHelper::PolicyCustomization current_policy = { + {net::SchemefulSite(GURL("https://foo.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kPrimary, absl::nullopt)}}, + {net::SchemefulSite(GURL("https://member2.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}}, + {net::SchemefulSite(GURL("https://bar.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://bar.test")), + net::SiteType::kPrimary, absl::nullopt)}}, + {net::SchemefulSite(GURL("https://member1.test")), + {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://bar.test")), + net::SiteType::kAssociated, 0)}}, + }; + + EXPECT_THAT( + FirstPartySetsHandlerDatabaseHelper::ComputeSetsDiff( + /*old_sets=*/{}, old_policy, /*current_sets=*/{}, current_policy), + UnorderedElementsAre(SerializesTo("https://member1.test"), + SerializesTo("https://member2.test"))); +} + +class FirstPartySetsHandlerDatabaseHelperTest : public testing::Test { + public: + FirstPartySetsHandlerDatabaseHelperTest() { + EXPECT_TRUE(dir_.CreateUniqueTempDir()); + db_helper_ = std::make_unique<FirstPartySetsHandlerDatabaseHelper>( + dir_.GetPath().AppendASCII("TestFirstPartySets.db")); + } + + protected: + base::ScopedTempDir dir_; + base::test::TaskEnvironment env_; + + std::unique_ptr<FirstPartySetsHandlerDatabaseHelper> db_helper_; +}; + +TEST_F(FirstPartySetsHandlerDatabaseHelperTest, + UpdateAndGetSitesToClearForContext) { + const std::string& browser_context_id = "b"; + + FirstPartySetsHandlerDatabaseHelper::FlattenedSets old_sets = { + {net::SchemefulSite(GURL("https://example.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member1.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}, + {net::SchemefulSite(GURL("https://member3.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 1)}, + {net::SchemefulSite(GURL("https://foo.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member2.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), + net::SiteType::kAssociated, 0)}}; + + FirstPartySetsHandlerDatabaseHelper::FlattenedSets current_sets = { + {net::SchemefulSite(GURL("https://example.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kPrimary, absl::nullopt)}, + {net::SchemefulSite(GURL("https://member1.test")), + net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), + net::SiteType::kAssociated, 0)}}; + + std::vector<net::SchemefulSite> res = + db_helper_->UpdateAndGetSitesToClearForContext( + "b", old_sets, current_sets, /*current_policy=*/{}); + + // Expected diff: "https://foo.test", "https://member2.test" and + // "https://member3.test" left FPSs. + EXPECT_THAT(res, UnorderedElementsAre(SerializesTo("https://foo.test"), + SerializesTo("https://member2.test"), + SerializesTo("https://member3.test"))); +} + +} // namespace content
diff --git a/content/browser/first_party_sets/first_party_sets_handler_impl.cc b/content/browser/first_party_sets/first_party_sets_handler_impl.cc index a88b844..06ac1c5 100644 --- a/content/browser/first_party_sets/first_party_sets_handler_impl.cc +++ b/content/browser/first_party_sets/first_party_sets_handler_impl.cc
@@ -163,22 +163,6 @@ return normalized_additions; } -// TODO(https://crbug.com/1349487): Since this is basically the same as -// FirstPartySetsManager::FindOwnerInternal(), move the common algorithm into -// //net to be reused in both here and FirstPartySetsManager. -absl::optional<net::FirstPartySetEntry> FindOwner( - const net::SchemefulSite& site, - const FlattenedSets& sets, - const FirstPartySetsHandlerImpl::PolicyCustomization& policy_sets) { - absl::optional<net::FirstPartySetEntry> owner; - if (const auto it = policy_sets.find(site); it != policy_sets.end()) { - owner = it->second; - } else if (const auto it = sets.find(site); it != sets.end()) { - owner = it->second; - } - return owner; -} - } // namespace bool FirstPartySetsHandler::PolicyParsingError::operator==( @@ -499,49 +483,6 @@ return public_sets_->Clone(); } -// static -base::flat_set<net::SchemefulSite> FirstPartySetsHandlerImpl::ComputeSetsDiff( - const FlattenedSets& old_sets, - const PolicyCustomization& old_policy, - const FlattenedSets& current_sets, - const PolicyCustomization& current_policy) { - // TODO(https://crbug.com/1219656): For now we don't clear site data if FPSs - // is disabled. This may change with future feature ruquest. - if ((old_sets.empty() && old_policy.empty()) || - (current_sets.empty() && current_policy.empty())) - return {}; - - std::vector<net::SchemefulSite> result; - for (const auto& old_pair : old_sets) { - const net::SchemefulSite& old_member = old_pair.first; - const net::FirstPartySetEntry& old_entry = old_pair.second; - - if (base::Contains(old_policy, old_member)) - continue; - - absl::optional<net::FirstPartySetEntry> current_entry = - FindOwner(old_member, current_sets, current_policy); - // Look for the removed sites and the ones have owner changed. - if (!current_entry.has_value() || - current_entry.value().primary() != old_entry.primary()) { - result.push_back(old_member); - } - } - - for (const auto& old_pair : old_policy) { - const net::SchemefulSite& old_member = old_pair.first; - const absl::optional<net::FirstPartySetEntry>& old_entry = old_pair.second; - - const absl::optional<net::FirstPartySetEntry> current_entry = - FindOwner(old_member, current_sets, current_policy); - // Look for the ones have owner changed. - if (old_entry.has_value() && current_entry != old_entry) { - result.push_back(old_member); - } - } - return result; -} - void FirstPartySetsHandlerImpl::ClearSiteDataOnChangedSets() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!public_sets_.is_null());
diff --git a/content/browser/first_party_sets/first_party_sets_handler_impl.h b/content/browser/first_party_sets/first_party_sets_handler_impl.h index 4fd5e16..4c7b2ac 100644 --- a/content/browser/first_party_sets/first_party_sets_handler_impl.h +++ b/content/browser/first_party_sets/first_party_sets_handler_impl.h
@@ -95,20 +95,6 @@ embedder_will_provide_public_sets_ = enabled_ && will_provide; } - // Gets the difference between the previously used FPSs info with the current - // FPSs info by comparing the combined `old_sets` and `old_policy` with the - // combined `current_sets` and `current_policy`. Returns the set of sites - // that: 1) were in old FPSs but are no longer in current FPSs i.e. leave the - // FPSs; or, 2) mapped to a different owner site. - // - // This method assumes that the sites were normalized properly when the maps - // were created. Made public only for testing, - static base::flat_set<net::SchemefulSite> ComputeSetsDiff( - const FlattenedSets& old_sets, - const PolicyCustomization& old_policy, - const FlattenedSets& current_sets, - const PolicyCustomization& current_policy); - // Computes information needed by the FirstPartySetsAccessDelegate in order // to update the browser's list of First-Party Sets to respect a profile's // setting for the per-profile FirstPartySetsOverrides policy.
diff --git a/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc b/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc index 6ebbc7a..b0bec043 100644 --- a/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc +++ b/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc
@@ -120,381 +120,6 @@ } } // namespace -TEST(FirstPartySetsHandlerImpl, ComputeSetsDiff_SitesJoined) { - FirstPartySetsHandlerImpl::FlattenedSets old_sets = { - {net::SchemefulSite(GURL("https://example.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://member1.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 0)}, - {net::SchemefulSite(GURL("https://member3.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 1)}}; - - FirstPartySetsHandlerImpl::FlattenedSets current_sets = { - {net::SchemefulSite(GURL("https://example.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://member1.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 0)}, - {net::SchemefulSite(GURL("https://member3.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 1)}, - {net::SchemefulSite(GURL("https://foo.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://member2.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}, - }; - - // "https://foo.test" and "https://member2.test" joined FPSs. We don't clear - // site data upon joining, so the computed diff should be empty set. - EXPECT_THAT( - FirstPartySetsHandlerImpl::ComputeSetsDiff( - old_sets, /*old_policy=*/{}, current_sets, /*current_policy=*/{}), - IsEmpty()); -} - -TEST(FirstPartySetsHandlerImpl, ComputeSetsDiff_SitesLeft) { - FirstPartySetsHandlerImpl::FlattenedSets old_sets = { - {net::SchemefulSite(GURL("https://example.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://member1.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 0)}, - {net::SchemefulSite(GURL("https://member3.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 1)}, - {net::SchemefulSite(GURL("https://foo.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://member2.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}}; - - FirstPartySetsHandlerImpl::FlattenedSets current_sets = { - {net::SchemefulSite(GURL("https://example.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://member1.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 0)}}; - - // Expected diff: "https://foo.test", "https://member2.test" and - // "https://member3.test" left FPSs. - EXPECT_THAT( - FirstPartySetsHandlerImpl::ComputeSetsDiff( - old_sets, /*old_policy=*/{}, current_sets, /*current_policy=*/{}), - UnorderedElementsAre(SerializesTo("https://foo.test"), - SerializesTo("https://member2.test"), - SerializesTo("https://member3.test"))); -} - -TEST(FirstPartySetsHandlerImpl, ComputeSetsDiff_OwnerChanged) { - FirstPartySetsHandlerImpl::FlattenedSets old_sets = { - {net::SchemefulSite(GURL("https://example.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://member1.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 0)}, - {net::SchemefulSite(GURL("https://foo.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://member2.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}, - {net::SchemefulSite(GURL("https://member3.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 1)}}; - - FirstPartySetsHandlerImpl::FlattenedSets current_sets = { - {net::SchemefulSite(GURL("https://example.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://member1.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 0)}, - {net::SchemefulSite(GURL("https://member3.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 1)}, - {net::SchemefulSite(GURL("https://foo.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://member2.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}}; - - // Expected diff: "https://member3.test" changed owner. - EXPECT_THAT( - FirstPartySetsHandlerImpl::ComputeSetsDiff( - old_sets, /*old_policy=*/{}, current_sets, /*current_policy=*/{}), - UnorderedElementsAre(SerializesTo("https://member3.test"))); -} - -TEST(FirstPartySetsHandlerImpl, ComputeSetsDiff_OwnerLeft) { - FirstPartySetsHandlerImpl::FlattenedSets old_sets = { - {net::SchemefulSite(GURL("https://example.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://foo.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 0)}, - {net::SchemefulSite(GURL("https://bar.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 1)}}; - - FirstPartySetsHandlerImpl::FlattenedSets current_sets = { - {net::SchemefulSite(GURL("https://foo.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://bar.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}}; - - // Expected diff: "https://example.test" left FPSs, "https://foo.test" and - // "https://bar.test" changed owner. - // It would be valid to only have example.test in the diff, but our logic - // isn't sophisticated enough yet to know that foo.test and bar.test don't - // need to be included in the result. - EXPECT_THAT( - FirstPartySetsHandlerImpl::ComputeSetsDiff( - old_sets, /*old_policy=*/{}, current_sets, /*current_policy=*/{}), - UnorderedElementsAre(SerializesTo("https://example.test"), - SerializesTo("https://foo.test"), - SerializesTo("https://bar.test"))); -} - -TEST(FirstPartySetsHandlerImpl, ComputeSetsDiff_OwnerMemberRotate) { - FirstPartySetsHandlerImpl::FlattenedSets old_sets = { - {net::SchemefulSite(GURL("https://example.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://foo.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 0)}}; - - FirstPartySetsHandlerImpl::FlattenedSets current_sets = { - {net::SchemefulSite(GURL("https://example.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}, - {net::SchemefulSite(GURL("https://foo.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kPrimary, absl::nullopt)}}; - - // Expected diff: "https://example.test" and "https://foo.test" changed owner. - // It would be valid to not include example.test and foo.test in the result, - // but our logic isn't sophisticated enough yet to know that.ß - EXPECT_THAT( - FirstPartySetsHandlerImpl::ComputeSetsDiff( - old_sets, /*old_policy=*/{}, current_sets, /*current_policy=*/{}), - UnorderedElementsAre(SerializesTo("https://example.test"), - SerializesTo("https://foo.test"))); -} - -TEST(FirstPartySetsHandlerImpl, ComputeSetsDiff_EmptyOldSets) { - // Empty old_sets. - FirstPartySetsHandlerImpl::FlattenedSets current_sets = { - {net::SchemefulSite(GURL("https://example.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://member1.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 0)}}; - - EXPECT_THAT(FirstPartySetsHandlerImpl::ComputeSetsDiff( - /*old_sets=*/{}, /*old_policy=*/{}, current_sets, - /*current_policy=*/{}), - IsEmpty()); -} - -TEST(FirstPartySetsHandlerImpl, ComputeSetsDiff_EmptyCurrentSets) { - // Empty current sets. - FirstPartySetsHandlerImpl::FlattenedSets old_sets = { - {net::SchemefulSite(GURL("https://example.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://member1.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 0)}}; - - EXPECT_THAT(FirstPartySetsHandlerImpl::ComputeSetsDiff( - old_sets, /*old_policy=*/{}, /*current_sets=*/{}, - /*current_policy=*/{}), - IsEmpty()); -} - -TEST(FirstPartySetsHandlerImpl, ComputeSetsDiff_PolicySitesJoined) { - FirstPartySetsHandlerImpl::PolicyCustomization current_policy = { - {net::SchemefulSite(GURL("https://foo.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kPrimary, absl::nullopt)}}, - {net::SchemefulSite(GURL("https://member2.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}}, - }; - - // "https://example.test" and "https://member2.test" joined FPSs via - // enterprise policy. We don't clear site data upon joining, so the computed - // diff should be empty. - EXPECT_THAT(FirstPartySetsHandlerImpl::ComputeSetsDiff( - /*old_sets=*/{}, /*old_policy=*/{}, /*current_sets=*/{}, - current_policy), - IsEmpty()); -} - -TEST(FirstPartySetsHandlerImpl, ComputeSetsDiff_PolicyRemovedSitesJoined) { - FirstPartySetsHandlerImpl::FlattenedSets sets = { - {net::SchemefulSite(GURL("https://example.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kPrimary, absl::nullopt)}, - {net::SchemefulSite(GURL("https://member1.test")), - net::FirstPartySetEntry(net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 0)}}; - - // "https://example.test" was removed from FPSs by policy modifications. - FirstPartySetsHandlerImpl::PolicyCustomization old_policy = { - {net::SchemefulSite(GURL("https://foo.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kPrimary, absl::nullopt)}}, - {net::SchemefulSite(GURL("https://member1.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}}, - {net::SchemefulSite(GURL("https://example.test")), absl::nullopt}, - }; - - // "https://example.test" added back to FPSs. - FirstPartySetsHandlerImpl::PolicyCustomization current_policy = { - {net::SchemefulSite(GURL("https://foo.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kPrimary, absl::nullopt)}}, - {net::SchemefulSite(GURL("https://member1.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}}, - {net::SchemefulSite(GURL("https://example.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}}, - }; - - // We don't clear site data upon joining, so the computed diff should be - // empty. - EXPECT_THAT( - FirstPartySetsHandlerImpl::ComputeSetsDiff( - /*old_sets=*/sets, old_policy, /*current_sets=*/sets, current_policy), - IsEmpty()); -} - -TEST(FirstPartySetsHandlerImpl, ComputeSetsDiff_PolicyMemberLeft) { - FirstPartySetsHandlerImpl::PolicyCustomization old_policy = { - {net::SchemefulSite(GURL("https://foo.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kPrimary, absl::nullopt)}}, - {net::SchemefulSite(GURL("https://member1.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}}, - {net::SchemefulSite(GURL("https://member2.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}}, - }; - - // "https://member2.test" left FPSs via enterprise policy. - FirstPartySetsHandlerImpl::PolicyCustomization current_policy = { - {net::SchemefulSite(GURL("https://foo.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kPrimary, absl::nullopt)}}, - {net::SchemefulSite(GURL("https://member1.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}}, - }; - - EXPECT_THAT( - FirstPartySetsHandlerImpl::ComputeSetsDiff( - /*old_sets=*/{}, old_policy, /*current_sets=*/{}, current_policy), - UnorderedElementsAre(SerializesTo("https://member2.test"))); -} - -TEST(FirstPartySetsHandlerImpl, ComputeSetsDiff_PolicyOwnerLeft) { - FirstPartySetsHandlerImpl::PolicyCustomization old_policy = { - {net::SchemefulSite(GURL("https://example.test")), - {net::FirstPartySetEntry( - net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kPrimary, absl::nullopt)}}, - {net::SchemefulSite(GURL("https://member1.test")), - {net::FirstPartySetEntry( - net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 0)}}, - {net::SchemefulSite(GURL("https://member2.test")), - {net::FirstPartySetEntry( - net::SchemefulSite(GURL("https://example.test")), - net::SiteType::kAssociated, 0)}}, - }; - - FirstPartySetsHandlerImpl::PolicyCustomization current_policy = { - {net::SchemefulSite(GURL("https://member1.test")), - {net::FirstPartySetEntry( - net::SchemefulSite(GURL("https://member1.test")), - net::SiteType::kPrimary, absl::nullopt)}}, - {net::SchemefulSite(GURL("https://member2.test")), - {net::FirstPartySetEntry( - net::SchemefulSite(GURL("https://member1.test")), - net::SiteType::kAssociated, 0)}}, - }; - - // Expected diff: "https://example.test" left FPSs, "https://member1.test" and - // "https://member2.test" changed owner. - // It would be valid to only have example.test in the diff, but our logic - // isn't sophisticated enough yet to know that member1.test and member2.test - // don't need to be included in the result. - EXPECT_THAT(FirstPartySetsHandlerImpl::ComputeSetsDiff( - /*old_sets=*/{}, /*old_policy=*/old_policy, - /*current_sets=*/{}, current_policy), - UnorderedElementsAre(SerializesTo("https://example.test"), - SerializesTo("https://member1.test"), - SerializesTo("https://member2.test"))); -} - -TEST(FirstPartySetsHandlerImpl, ComputeSetsDiff_PolicyMembersChangeSet) { - FirstPartySetsHandlerImpl::PolicyCustomization old_policy = { - {net::SchemefulSite(GURL("https://foo.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kPrimary, absl::nullopt)}}, - {net::SchemefulSite(GURL("https://member1.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}}, - {net::SchemefulSite(GURL("https://bar.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://bar.test")), - net::SiteType::kPrimary, absl::nullopt)}}, - {net::SchemefulSite(GURL("https://member2.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://bar.test")), - net::SiteType::kAssociated, 0)}}, - }; - - FirstPartySetsHandlerImpl::PolicyCustomization current_policy = { - {net::SchemefulSite(GURL("https://foo.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kPrimary, absl::nullopt)}}, - {net::SchemefulSite(GURL("https://member2.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://foo.test")), - net::SiteType::kAssociated, 0)}}, - {net::SchemefulSite(GURL("https://bar.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://bar.test")), - net::SiteType::kPrimary, absl::nullopt)}}, - {net::SchemefulSite(GURL("https://member1.test")), - {net::FirstPartySetEntry(net::SchemefulSite(GURL("https://bar.test")), - net::SiteType::kAssociated, 0)}}, - }; - - EXPECT_THAT( - FirstPartySetsHandlerImpl::ComputeSetsDiff( - /*old_sets=*/{}, old_policy, /*current_sets=*/{}, current_policy), - UnorderedElementsAre(SerializesTo("https://member1.test"), - SerializesTo("https://member2.test"))); -} - TEST(FirstPartySetsHandlerImpl, ValidateEnterprisePolicy_ValidPolicy) { base::Value input = base::JSONReader::Read(R"( {
diff --git a/content/browser/first_party_sets/first_party_sets_site_data_remover.cc b/content/browser/first_party_sets/first_party_sets_site_data_remover.cc index 3b4970825..6d84d45e 100644 --- a/content/browser/first_party_sets/first_party_sets_site_data_remover.cc +++ b/content/browser/first_party_sets/first_party_sets_site_data_remover.cc
@@ -92,7 +92,7 @@ } // namespace // static -void FirstPartySetsSiteDataRemover::HandleRemovingSiteData( +void FirstPartySetsSiteDataRemover::RemoveSiteData( BrowsingDataRemover* remover, std::vector<net::SchemefulSite> sites, base::OnceCallback<void(uint64_t)> callback) {
diff --git a/content/browser/first_party_sets/first_party_sets_site_data_remover.h b/content/browser/first_party_sets/first_party_sets_site_data_remover.h index b42bc822..b444885 100644 --- a/content/browser/first_party_sets/first_party_sets_site_data_remover.h +++ b/content/browser/first_party_sets/first_party_sets_site_data_remover.h
@@ -25,10 +25,9 @@ // enum, 0 indicates success. // // Currently it only accounts for cookie and storage data types. - static void HandleRemovingSiteData( - BrowsingDataRemover* remover, - std::vector<net::SchemefulSite> sites, - base::OnceCallback<void(uint64_t)> callback); + static void RemoveSiteData(BrowsingDataRemover* remover, + std::vector<net::SchemefulSite> sites, + base::OnceCallback<void(uint64_t)> callback); }; } // namespace content
diff --git a/content/browser/media/capture/crop_id_web_contents_helper.cc b/content/browser/media/capture/crop_id_web_contents_helper.cc index 5211991..7384bdf 100644 --- a/content/browser/media/capture/crop_id_web_contents_helper.cc +++ b/content/browser/media/capture/crop_id_web_contents_helper.cc
@@ -22,7 +22,7 @@ namespace content { -// TODO(crbug.com/1247761): Remove this protected static function. +// TODO(crbug.com/1264849): Remove this protected static function. // See header for more details. base::Token CropIdWebContentsHelper::GUIDToToken(const base::GUID& guid) { std::string lowercase = guid.AsLowercaseString();
diff --git a/content/browser/media/capture/crop_id_web_contents_helper.h b/content/browser/media/capture/crop_id_web_contents_helper.h index 72d865c0..49df813 100644 --- a/content/browser/media/capture/crop_id_web_contents_helper.h +++ b/content/browser/media/capture/crop_id_web_contents_helper.h
@@ -55,7 +55,7 @@ bool IsAssociatedWithCropId(const base::Token& crop_id) const; protected: - // TODO(crbug.com/1247761): Remove this local copy of GUIDToToken(). + // TODO(crbug.com/1264849): Remove this local copy of GUIDToToken(). // It is copy of a function that is not currently visible from the browser // process. It should be made visible to the browser process and reused // rather than redefined. It is defined as protected so that unit tests @@ -69,11 +69,11 @@ // WebContentsObserver implementation. // Cross-document navigation of the top-level document discards all crop-IDs // associated with the top-level WebContents. - // TODO(crbug.com/1247761): Record per RFH and treat its navigation. + // TODO(crbug.com/1264849): Record per RFH and treat its navigation. void ReadyToCommitNavigation(NavigationHandle* navigation_handle) final; // Forgets all associations of crop-IDs to this WebContents. - // TODO(crbug.com/1247761): Clear per-RFH or throughout. + // TODO(crbug.com/1264849): Clear per-RFH or throughout. void ClearCropIds(); // Records which crop-IDs are associated with this WebContents.
diff --git a/content/browser/media/capture/web_contents_frame_tracker.cc b/content/browser/media/capture/web_contents_frame_tracker.cc index 69411bd..4ca3298 100644 --- a/content/browser/media/capture/web_contents_frame_tracker.cc +++ b/content/browser/media/capture/web_contents_frame_tracker.cc
@@ -447,7 +447,7 @@ frame_sink_id = context_->GetFrameSinkIdForCapture(); } - // TODO(crbug.com/1247761): Clear |crop_id_| when share-this-tab-instead + // TODO(crbug.com/1264849): Clear |crop_id_| when share-this-tab-instead // is clicked. if (frame_sink_id != target_frame_sink_id_) { target_frame_sink_id_ = frame_sink_id;
diff --git a/content/browser/navigation_browsertest.cc b/content/browser/navigation_browsertest.cc index d6989f0..0b2b7705 100644 --- a/content/browser/navigation_browsertest.cc +++ b/content/browser/navigation_browsertest.cc
@@ -4669,11 +4669,11 @@ // Flush all the frames in the `current_contents's active page. current_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating([](RenderFrameHost* frame_to_flush) { + [](RenderFrameHost* frame_to_flush) { constexpr bool kDoNothingIfNoNetworkServiceConnection = true; frame_to_flush->FlushNetworkAndNavigationInterfacesForTesting( kDoNothingIfNoNetworkServiceConnection); - })); + }); // Traverse the `current_frame`'s opener chain. if (FrameTreeNode* opener_node =
diff --git a/content/browser/navigation_mhtml_browsertest.cc b/content/browser/navigation_mhtml_browsertest.cc index 5778365..6963d50 100644 --- a/content/browser/navigation_mhtml_browsertest.cc +++ b/content/browser/navigation_mhtml_browsertest.cc
@@ -751,11 +751,11 @@ // All MHTML frames should have an opaque origin. shell()->web_contents()->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating([](RenderFrameHost* frame) { + [](RenderFrameHost* frame) { EXPECT_TRUE(frame->GetLastCommittedOrigin().opaque()) << "frame->GetLastCommittedURL() = " << frame->GetLastCommittedURL(); - })); + }); } // Regression test for https://crbug.com/1168249. @@ -867,8 +867,8 @@ // Ensure nothing was created for the fencedframe element. Only a single // RenderFrameHost, the `main_document`, should exist. int num_documents = 0; - main_document->ForEachRenderFrameHost(base::BindLambdaForTesting( - [&](RenderFrameHostImpl* rfh) { num_documents++; })); + main_document->ForEachRenderFrameHost( + [&](RenderFrameHostImpl* rfh) { num_documents++; }); EXPECT_EQ(1, num_documents); }
diff --git a/content/browser/preloading/prerender/prerender_browsertest.cc b/content/browser/preloading/prerender/prerender_browsertest.cc index ec3f6fb..0b9269ea 100644 --- a/content/browser/preloading/prerender/prerender_browsertest.cc +++ b/content/browser/preloading/prerender/prerender_browsertest.cc
@@ -358,7 +358,7 @@ RenderFrameHostImpl* navigated_render_frame_host = current_frame_host(); // The new page shouldn't be in the prerendering state. navigated_render_frame_host->ForEachRenderFrameHost( - base::BindRepeating([](content::RenderFrameHostImpl* rfhi) { + [](content::RenderFrameHostImpl* rfhi) { // All the subframes should be transitioned to // LifecycleStateImpl::kActive state after activation. EXPECT_EQ(rfhi->lifecycle_state(), @@ -372,7 +372,7 @@ navigator.locks.request('hi', {mode:'shared'}, () => {}); )"; EXPECT_TRUE(ExecJs(rfhi, kMojoScript)); - })); + }); } test::PrerenderTestHelper* prerender_helper() { @@ -2686,11 +2686,11 @@ std::vector<RenderFrameHostImpl*> all_prerender_frames; size_t count_speculative = 0; prerendered_render_frame_host->ForEachRenderFrameHostIncludingSpeculative( - base::BindLambdaForTesting([&](RenderFrameHostImpl* rfh) { + [&](RenderFrameHostImpl* rfh) { all_prerender_frames.push_back(rfh); count_speculative += (rfh->lifecycle_state() == LifecycleStateImpl::kSpeculative); - })); + }); ASSERT_EQ(all_prerender_frames.size(), 4u); ASSERT_EQ(count_speculative, 1u); @@ -6844,11 +6844,10 @@ // Since we've deferred creating the fenced frame delegate, we should see no // child frames. size_t child_frame_count = 0; - prerendered_rfh->ForEachRenderFrameHost( - base::BindLambdaForTesting([&](RenderFrameHostImpl* rfh) { - if (rfh != prerendered_rfh) - child_frame_count++; - })); + prerendered_rfh->ForEachRenderFrameHost([&](RenderFrameHostImpl* rfh) { + if (rfh != prerendered_rfh) + child_frame_count++; + }); EXPECT_EQ(0lu, child_frame_count); NavigatePrimaryPage(kPrerenderingUrl);
diff --git a/content/browser/preloading/prerender/prerender_page_holder.cc b/content/browser/preloading/prerender/prerender_page_holder.cc index 54e4454..d7e4fbb 100644 --- a/content/browser/preloading/prerender/prerender_page_holder.cc +++ b/content/browser/preloading/prerender/prerender_page_holder.cc
@@ -198,17 +198,15 @@ } page->render_frame_host->ForEachRenderFrameHostIncludingSpeculative( - base::BindRepeating( - [](const WebContentsImpl& web_contents, RenderFrameHostImpl* rfh) { - // The visibility state of the prerendering page has not been - // updated by - // WebContentsImpl::UpdateVisibilityAndNotifyPageAndView(). So - // updates the visibility state using the PageVisibilityState of - // |web_contents|. - rfh->render_view_host()->SetFrameTreeVisibility( - web_contents.GetPageVisibilityState()); - }, - std::cref(web_contents_))); + [this](RenderFrameHostImpl* rfh) { + // The visibility state of the prerendering page has not been + // updated by + // WebContentsImpl::UpdateVisibilityAndNotifyPageAndView(). So + // updates the visibility state using the PageVisibilityState of + // |web_contents|. + rfh->render_view_host()->SetFrameTreeVisibility( + web_contents_.GetPageVisibilityState()); + }); frame_tree_->Shutdown(); frame_tree_.reset();
diff --git a/content/browser/process_internals/process_internals_handler_impl.cc b/content/browser/process_internals/process_internals_handler_impl.cc index 949ed4a4..5bf582f 100644 --- a/content/browser/process_internals/process_internals_handler_impl.cc +++ b/content/browser/process_internals/process_internals_handler_impl.cc
@@ -107,29 +107,26 @@ // Execute over all frames appending any frames encountered to the parent's // subframe data. - frame->ForEachRenderFrameHost(base::BindRepeating( - [](WebContentsImpl* web_contents, RenderFrameHostImpl* outermost_frame, - ::mojom::FrameInfo::Type type, - std::map<RenderFrameHostImpl*, ::mojom::FrameInfo*>& all_frame_info, - RenderFrameHostImpl* frame) { + frame->ForEachRenderFrameHostWithAction( + [web_contents, outermost_frame = frame, type, + &all_frame_info](RenderFrameHostImpl* rfh) { // We've already handled the outermost frame outside of this. - if (frame == outermost_frame) + if (rfh == outermost_frame) return RenderFrameHost::FrameIterationAction::kContinue; // If this is a nested WebContents skip it, it will be encountered // by the GetAllWebContents iteration. - if (WebContents::FromRenderFrameHost(frame) != web_contents) + if (WebContents::FromRenderFrameHost(rfh) != web_contents) return RenderFrameHost::FrameIterationAction::kSkipChildren; ::mojom::FrameInfoPtr frame_info = - RenderFrameHostToFrameInfoNoTraverse(frame, type); - all_frame_info[frame] = frame_info.get(); - RenderFrameHostImpl* parent = frame->GetParentOrOuterDocument(); + RenderFrameHostToFrameInfoNoTraverse(rfh, type); + all_frame_info[rfh] = frame_info.get(); + RenderFrameHostImpl* parent = rfh->GetParentOrOuterDocument(); DCHECK(base::Contains(all_frame_info, parent)); all_frame_info[parent]->subframes.push_back(std::move(frame_info)); return RenderFrameHost::FrameIterationAction::kContinue; - }, - web_contents, frame, type, std::ref(all_frame_info))); + }); return outermost_frame_info; } @@ -137,14 +134,13 @@ // Adds `host` to `out_frames` if it is a prerendered main frame. RenderFrameHost::FrameIterationAction CollectPrerenders( WebContentsImpl* web_contents, - std::vector<::mojom::FrameInfoPtr>& out_frames, - RenderFrameHost* host) { + RenderFrameHostImpl* host, + std::vector<::mojom::FrameInfoPtr>& out_frames) { if (!host->GetParentOrOuterDocument()) { if (host->GetLifecycleState() == RenderFrameHost::LifecycleState::kPrerendering) { out_frames.push_back(RenderFrameHostToFrameInfo( - web_contents, static_cast<RenderFrameHostImpl*>(host), - ::mojom::FrameInfo::Type::kPrerender)); + web_contents, host, ::mojom::FrameInfo::Type::kPrerender)); } return RenderFrameHost::FrameIterationAction::kSkipChildren; } @@ -288,8 +284,10 @@ // Retrieve prerendering root frames. web_contents->ForEachRenderFrameHost( - base::BindRepeating(&CollectPrerenders, web_contents, - std::ref(info->prerender_root_frames))); + [web_contents, &prerender_root_frames = info->prerender_root_frames]( + RenderFrameHostImpl* rfh) { + CollectPrerenders(web_contents, rfh, prerender_root_frames); + }); infos.push_back(std::move(info)); }
diff --git a/content/browser/renderer_host/document_user_data_browsertest.cc b/content/browser/renderer_host/document_user_data_browsertest.cc index a0621fa..d26a503 100644 --- a/content/browser/renderer_host/document_user_data_browsertest.cc +++ b/content/browser/renderer_host/document_user_data_browsertest.cc
@@ -85,7 +85,7 @@ std::unique_ptr<WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override { callback_.Run(new_contents.get());
diff --git a/content/browser/renderer_host/media/service_launched_video_capture_device.cc b/content/browser/renderer_host/media/service_launched_video_capture_device.cc index 1b2ed70..77e34a15 100644 --- a/content/browser/renderer_host/media/service_launched_video_capture_device.cc +++ b/content/browser/renderer_host/media/service_launched_video_capture_device.cc
@@ -83,7 +83,7 @@ uint32_t crop_version, base::OnceCallback<void(media::mojom::CropRequestResult)> callback) { DCHECK(sequence_checker_.CalledOnValidSequence()); - // TODO(crbug.com/1247761): Implement if necessary. + // TODO(crbug.com/1264849): Implement if necessary. std::move(callback).Run(media::mojom::CropRequestResult::kNotImplemented); }
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index 4b3d430..642a154 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc
@@ -5056,27 +5056,23 @@ // since the page entered bfcache. We must update all frames, not just the // top frame, because it is possible (though unlikely) that an iframe's // entries have changed, too. - activated_entry->render_frame_host()->ForEachRenderFrameHost( - base::BindRepeating( - [](content::RenderFrameHost* navigating_rfh, - NavigationRequest* request, content::RenderFrameHost* rfh) { - RenderFrameHostImpl* rfhi = - static_cast<RenderFrameHostImpl*>(rfh); - // |request| is given as a parameter to - // GetNavigationApiHistoryEntryVectors() only for the frame being - // committed (i.e., the top frame). - auto entry_arrays = - rfhi->frame_tree() - ->controller() - .GetNavigationApiHistoryEntryVectors( - rfhi->frame_tree_node(), - navigating_rfh == rfh ? request : nullptr); - rfhi->GetAssociatedLocalFrame() - ->SetNavigationApiHistoryEntriesForRestore( - std::move(entry_arrays)); - return content::RenderFrameHost::FrameIterationAction::kContinue; - }, - activated_entry->render_frame_host(), this)); + activated_entry->render_frame_host()->ForEachRenderFrameHostWithAction( + [this, &activated_entry](RenderFrameHostImpl* rfh) { + // |this| is given as a parameter to + // GetNavigationApiHistoryEntryVectors() only for the frame being + // committed (i.e., the top frame). + auto entry_arrays = + rfh->frame_tree() + ->controller() + .GetNavigationApiHistoryEntryVectors( + rfh->frame_tree_node(), + activated_entry->render_frame_host() == rfh ? this + : nullptr); + rfh->GetAssociatedLocalFrame() + ->SetNavigationApiHistoryEntriesForRestore( + std::move(entry_arrays)); + return RenderFrameHost::FrameIterationAction::kContinue; + }); base::WeakPtr<NavigationRequest> weak_self(weak_factory_.GetWeakPtr()); ReadyToCommitNavigation(false /* is_error */);
diff --git a/content/browser/renderer_host/page_impl.cc b/content/browser/renderer_host/page_impl.cc index 77b50008..0913fb887 100644 --- a/content/browser/renderer_host/page_impl.cc +++ b/content/browser/renderer_host/page_impl.cc
@@ -191,13 +191,12 @@ // inner WebContents. These are in a different FrameTree which might not know // it is being prerendered. We should teach these FrameTrees that they are // being prerendered, or ban inner FrameTrees in a prerendering page. - main_document_.ForEachRenderFrameHostIncludingSpeculative(base::BindRepeating( - [](PageImpl* page, RenderFrameHostImpl* rfh) { - if (&rfh->GetPage() != page) + main_document_.ForEachRenderFrameHostIncludingSpeculative( + [this](RenderFrameHostImpl* rfh) { + if (&rfh->GetPage() != this) return; rfh->RendererWillActivateForPrerendering(); - }, - this)); + }); } void PageImpl::MaybeDispatchLoadEventsOnPrerenderActivation() { @@ -216,28 +215,22 @@ main_document_.MainDocumentElementAvailable(uses_temporary_zoom_level()); main_document_.ForEachRenderFrameHost( - base::BindRepeating([](RenderFrameHostImpl* rfh) { - rfh->MaybeDispatchDOMContentLoadedOnPrerenderActivation(); - })); + &RenderFrameHostImpl::MaybeDispatchDOMContentLoadedOnPrerenderActivation); if (is_on_load_completed_in_main_document()) main_document_.DocumentOnLoadCompleted(); main_document_.ForEachRenderFrameHost( - base::BindRepeating([](RenderFrameHostImpl* rfh) { - rfh->MaybeDispatchDidFinishLoadOnPrerenderActivation(); - })); + &RenderFrameHostImpl::MaybeDispatchDidFinishLoadOnPrerenderActivation); } void PageImpl::DidActivateAllRenderViewsForPrerendering() { // Tell each RenderFrameHostImpl in this Page that activation finished. - main_document_.ForEachRenderFrameHost(base::BindRepeating( - [](PageImpl* page, RenderFrameHostImpl* rfh) { - if (&rfh->GetPage() != page) - return; - rfh->RendererDidActivateForPrerendering(); - }, - this)); + main_document_.ForEachRenderFrameHost([this](RenderFrameHostImpl* rfh) { + if (&rfh->GetPage() != this) + return; + rfh->RendererDidActivateForPrerendering(); + }); } RenderFrameHost& PageImpl::GetMainDocumentHelper() {
diff --git a/content/browser/renderer_host/render_frame_host_android.cc b/content/browser/renderer_host/render_frame_host_android.cc index 66dda42..9a7eddf2 100644 --- a/content/browser/renderer_host/render_frame_host_android.cc +++ b/content/browser/renderer_host/render_frame_host_android.cc
@@ -129,11 +129,8 @@ JNIEnv* env, const JavaParamRef<jobject>& obj) const { std::vector<RenderFrameHostImpl*> frames; - render_frame_host_->ForEachRenderFrameHost(base::BindRepeating( - [](std::vector<RenderFrameHostImpl*>* frames, RenderFrameHostImpl* rfh) { - frames->push_back(rfh); - }, - &frames)); + render_frame_host_->ForEachRenderFrameHost( + [&frames](RenderFrameHostImpl* rfh) { frames.push_back(rfh); }); jclass clazz = org_chromium_content_browser_framehost_RenderFrameHostImpl_clazz(env); jobjectArray jframes = env->NewObjectArray(frames.size(), clazz, nullptr);
diff --git a/content/browser/renderer_host/render_frame_host_delegate.h b/content/browser/renderer_host/render_frame_host_delegate.h index 3d863d3..533eea8 100644 --- a/content/browser/renderer_host/render_frame_host_delegate.h +++ b/content/browser/renderer_host/render_frame_host_delegate.h
@@ -77,6 +77,7 @@ namespace mojom { class DisplayCutoutHost; class FullscreenOptions; +class WindowFeatures; } class PageState; namespace web_pref { @@ -409,20 +410,21 @@ bool has_user_gesture, SessionStorageNamespace* session_storage_namespace); - // Show a previously created page with the specified disposition and bounds. - // The window is identified by the |main_frame_widget_route_id| passed to - // CreateNewWindow. + // Show a previously created page with the specified disposition and window + // features. The window is identified by the |main_frame_widget_route_id| + // passed to CreateNewWindow. // // The passed |opener| is the RenderFrameHost initiating the window creation. // It will never be null, even if the opener is suppressed via |params|. // // Note: this is not called "ShowWindow" because that will clash with // the Windows function which is actually a #define. - virtual void ShowCreatedWindow(RenderFrameHostImpl* opener, - int main_frame_widget_route_id, - WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, - bool user_gesture) {} + virtual void ShowCreatedWindow( + RenderFrameHostImpl* opener, + int main_frame_widget_route_id, + WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures& window_features, + bool user_gesture) {} // The main frame document element is ready. This happens when the document // has finished parsing.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index 58808d00..3fd85c1 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -253,6 +253,7 @@ #include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom.h" #include "third_party/blink/public/mojom/storage_key/ancestor_chain_bit.mojom.h" #include "third_party/blink/public/mojom/timing/resource_timing.mojom.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" #include "ui/accessibility/ax_action_handler_registry.h" #include "ui/accessibility/ax_common.h" #include "ui/accessibility/ax_tree_update.h" @@ -2185,38 +2186,47 @@ } } -void RenderFrameHostImpl::ForEachRenderFrameHost( - FrameIterationCallback on_frame) { - ForEachRenderFrameHost(FrameIterationWrapper(on_frame)); +void RenderFrameHostImpl::ForEachRenderFrameHostWithAction( + base::FunctionRef<FrameIterationAction(RenderFrameHost*)> on_frame) { + ForEachRenderFrameHostWithAction( + [on_frame](RenderFrameHostImpl* rfh) { return on_frame(rfh); }); } void RenderFrameHostImpl::ForEachRenderFrameHost( - FrameIterationAlwaysContinueCallback on_frame) { - ForEachRenderFrameHost(FrameIterationWrapper(on_frame)); + base::FunctionRef<void(RenderFrameHost*)> on_frame) { + ForEachRenderFrameHost( + [on_frame](RenderFrameHostImpl* rfh) { on_frame(rfh); }); } -void RenderFrameHostImpl::ForEachRenderFrameHost( - FrameIterationCallbackImpl on_frame) { +void RenderFrameHostImpl::ForEachRenderFrameHostWithAction( + base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame) { ForEachRenderFrameHostImpl(on_frame, /*include_speculative=*/false); } void RenderFrameHostImpl::ForEachRenderFrameHost( - FrameIterationAlwaysContinueCallbackImpl on_frame) { - ForEachRenderFrameHost(FrameIterationWrapper(on_frame)); + base::FunctionRef<void(RenderFrameHostImpl*)> on_frame) { + ForEachRenderFrameHostWithAction([on_frame](RenderFrameHostImpl* rfh) { + on_frame(rfh); + return FrameIterationAction::kContinue; + }); } -void RenderFrameHostImpl::ForEachRenderFrameHostIncludingSpeculative( - FrameIterationCallbackImpl on_frame) { +void RenderFrameHostImpl::ForEachRenderFrameHostIncludingSpeculativeWithAction( + base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame) { ForEachRenderFrameHostImpl(on_frame, /*include_speculative=*/true); } void RenderFrameHostImpl::ForEachRenderFrameHostIncludingSpeculative( - FrameIterationAlwaysContinueCallbackImpl on_frame) { - ForEachRenderFrameHostIncludingSpeculative(FrameIterationWrapper(on_frame)); + base::FunctionRef<void(RenderFrameHostImpl*)> on_frame) { + ForEachRenderFrameHostIncludingSpeculativeWithAction( + [on_frame](RenderFrameHostImpl* rfh) { + on_frame(rfh); + return FrameIterationAction::kContinue; + }); } void RenderFrameHostImpl::ForEachRenderFrameHostImpl( - FrameIterationCallbackImpl on_frame, + base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame, bool include_speculative) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -2231,7 +2241,7 @@ // |this| and then actually start iterating over the subtree starting with // our children's FrameTreeNodes. bool skip_children_of_starting_frame = false; - switch (on_frame.Run(this)) { + switch (on_frame(this)) { case FrameIterationAction::kContinue: break; case FrameIterationAction::kSkipChildren: @@ -2252,7 +2262,7 @@ frame_tree_node()->render_manager()->speculative_frame_host(); if (speculative_frame_host) { DCHECK_EQ(speculative_frame_host->child_count(), 0U); - switch (on_frame.Run(speculative_frame_host)) { + switch (on_frame(speculative_frame_host)) { case FrameIterationAction::kContinue: case FrameIterationAction::kSkipChildren: break; @@ -2273,7 +2283,7 @@ FrameTreeNode* node = *it; RenderFrameHostImpl* frame_host = node->current_frame_host(); if (frame_host) { - switch (on_frame.Run(frame_host)) { + switch (on_frame(frame_host)) { case FrameIterationAction::kContinue: ++it; break; @@ -2290,7 +2300,7 @@ node->render_manager()->speculative_frame_host(); if (speculative_frame_host) { DCHECK_EQ(speculative_frame_host->child_count(), 0U); - switch (on_frame.Run(speculative_frame_host)) { + switch (on_frame(speculative_frame_host)) { case FrameIterationAction::kContinue: case FrameIterationAction::kSkipChildren: break; @@ -3528,16 +3538,14 @@ // TODO(danakj): We only blocked the main frame, so we should only need to // resume that? - ForEachRenderFrameHostIncludingSpeculative(base::BindRepeating( - [](RenderFrameHostImpl* main_rfh, - RenderFrameHostImpl* render_frame_host) { + ForEachRenderFrameHostIncludingSpeculative( + [this](RenderFrameHostImpl* render_frame_host) { // Inner frame trees shouldn't be possible here. - DCHECK_EQ(render_frame_host->frame_tree(), main_rfh->frame_tree()); + DCHECK_EQ(render_frame_host->frame_tree(), frame_tree()); if (render_frame_host->IsRenderFrameLive()) render_frame_host->frame_->ResumeBlockedRequests(); - }, - base::Unretained(this))); + }); if (pending_navigate_) { frame_tree_node()->navigator().OnBeginNavigation( @@ -4533,13 +4541,13 @@ // // Note that due to PrerenderCommitDeferringCondition, the main frame should // have no ongoing NavigationRequest at all, so it is not checked here. - ForEachRenderFrameHost(base::BindRepeating([](RenderFrameHostImpl* rfh) { + ForEachRenderFrameHost([](RenderFrameHostImpl* rfh) { // Interested only in subframes. if (rfh->is_main_frame()) return; for (const auto& pair : rfh->navigation_requests_) DCHECK_EQ(pair.first->nav_entry_id(), 0); - })); + }); #endif DidCommitNavigationInternal(std::move(owned_request), std::move(params), @@ -5372,7 +5380,7 @@ void RenderFrameHostImpl::ShowCreatedWindow( const blink::LocalFrameToken& opener_frame_token, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + blink::mojom::WindowFeaturesPtr window_features, bool user_gesture, ShowCreatedWindowCallback callback) { // This needs to be sent to the opener frame's delegate since it stores @@ -5390,7 +5398,7 @@ } opener_frame_host->delegate()->ShowCreatedWindow( opener_frame_host, GetRenderWidgetHost()->GetRoutingID(), disposition, - initial_rect, user_gesture); + *window_features, user_gesture); std::move(callback).Run(); } @@ -6666,21 +6674,18 @@ bool RenderFrameHostImpl::UnloadHandlerExistsInSameSiteInstanceSubtree() { DCHECK(!GetParent()); bool result = false; - ForEachRenderFrameHost(base::BindRepeating( - [](const SiteInstanceImpl* main_frame_site_instance, - const PageImpl* main_frame_page, bool* result, - RenderFrameHostImpl* rfhi) { + ForEachRenderFrameHostWithAction( + [this, &result](RenderFrameHostImpl* rfhi) -> FrameIterationAction { // If we aren't from the same page ignore unload handlers. - if (&rfhi->GetPage() != main_frame_page) + if (&rfhi->GetPage() != &GetPage()) return FrameIterationAction::kSkipChildren; - if (rfhi->GetSiteInstance() == main_frame_site_instance && + if (rfhi->GetSiteInstance() == GetSiteInstance() && rfhi->has_unload_handler_) { - *result = true; + result = true; return FrameIterationAction::kStop; } return FrameIterationAction::kContinue; - }, - base::Unretained(GetSiteInstance()), &GetPage(), &result)); + }); return result; } @@ -11122,26 +11127,21 @@ #endif void RenderFrameHostImpl::ForEachImmediateLocalRoot( - const base::RepeatingCallback<void(RenderFrameHostImpl*)>& callback) { - ForEachRenderFrameHost(base::BindRepeating( - [](const base::RepeatingCallback<void(RenderFrameHostImpl*)>& callback, - const RenderFrameHostImpl* starting_rfh, RenderFrameHostImpl* rfh) { - if (rfh->is_local_root() && rfh != starting_rfh) { - callback.Run(rfh); - return FrameIterationAction::kSkipChildren; - } - return FrameIterationAction::kContinue; - }, - callback, this)); + base::FunctionRef<void(RenderFrameHostImpl*)> func_ref) { + ForEachRenderFrameHostWithAction([func_ref, this](RenderFrameHostImpl* rfh) { + if (rfh->is_local_root() && rfh != this) { + func_ref(rfh); + return FrameIterationAction::kSkipChildren; + } + return FrameIterationAction::kContinue; + }); } void RenderFrameHostImpl::SetVisibilityForChildViews(bool visible) { - ForEachImmediateLocalRoot(base::BindRepeating( - [](bool is_visible, RenderFrameHostImpl* frame_host) { - if (auto* view = frame_host->GetView()) - return is_visible ? view->Show() : view->Hide(); - }, - visible)); + ForEachImmediateLocalRoot([visible](RenderFrameHostImpl* frame_host) { + if (auto* view = frame_host->GetView()) + return visible ? view->Show() : view->Hide(); + }); } mojom::Frame* RenderFrameHostImpl::GetMojomFrameInRenderer() {
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h index b68afb3..2967eb8c 100644 --- a/content/browser/renderer_host/render_frame_host_impl.h +++ b/content/browser/renderer_host/render_frame_host_impl.h
@@ -21,6 +21,7 @@ #include "base/containers/flat_set.h" #include "base/containers/unique_ptr_adapters.h" #include "base/files/file_path.h" +#include "base/functional/function_ref.h" #include "base/gtest_prod_util.h" #include "base/i18n/rtl.h" #include "base/memory/raw_ptr.h" @@ -353,9 +354,11 @@ RenderFrameHostImpl* GetOutermostMainFrame() override; bool IsFencedFrameRoot() const override; bool IsNestedWithinFencedFrame() const override; - void ForEachRenderFrameHost(FrameIterationCallback on_frame) override; + void ForEachRenderFrameHostWithAction( + base::FunctionRef<FrameIterationAction(RenderFrameHost*)> on_frame) + override; void ForEachRenderFrameHost( - FrameIterationAlwaysContinueCallback on_frame) override; + base::FunctionRef<void(RenderFrameHost*)> on_frame) override; // TODO (crbug.com/1251545) : Frame tree node id should only be known for // subframes. As such, update this method. int GetFrameTreeNodeId() const override; @@ -2009,41 +2012,14 @@ // for details. Content internals can also access speculative // RenderFrameHostImpls if necessary by using the // |ForEachRenderFrameHostIncludingSpeculative| variations. - using FrameIterationCallbackImpl = - base::RepeatingCallback<FrameIterationAction(RenderFrameHostImpl*)>; - using FrameIterationAlwaysContinueCallbackImpl = - base::RepeatingCallback<void(RenderFrameHostImpl*)>; - void ForEachRenderFrameHost(FrameIterationCallbackImpl on_frame); + void ForEachRenderFrameHostWithAction( + base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame); void ForEachRenderFrameHost( - FrameIterationAlwaysContinueCallbackImpl on_frame); + base::FunctionRef<void(RenderFrameHostImpl*)> on_frame); + void ForEachRenderFrameHostIncludingSpeculativeWithAction( + base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame); void ForEachRenderFrameHostIncludingSpeculative( - FrameIterationCallbackImpl on_frame); - void ForEachRenderFrameHostIncludingSpeculative( - FrameIterationAlwaysContinueCallbackImpl on_frame); - - // |ForEachRenderFrameHost| has multiple overloads for convenience of the - // caller that only differ by the provided callback's signature. - // |FrameIterationWrapper| converts to a common callback signature for the - // implementation to use. - template <typename RfhType> - static FrameIterationCallbackImpl FrameIterationWrapper( - base::RepeatingCallback<FrameIterationAction(RfhType*)> on_frame) { - return base::BindRepeating( - [](base::RepeatingCallback<FrameIterationAction(RfhType*)> on_frame, - RenderFrameHostImpl* rfh) { return on_frame.Run(rfh); }, - on_frame); - } - template <typename RfhType> - static FrameIterationCallbackImpl FrameIterationWrapper( - base::RepeatingCallback<void(RfhType*)> on_frame) { - return base::BindRepeating( - [](base::RepeatingCallback<void(RfhType*)> on_frame, - RenderFrameHostImpl* rfh) { - on_frame.Run(rfh); - return FrameIterationAction::kContinue; - }, - on_frame); - } + base::FunctionRef<void(RenderFrameHostImpl*)> on_frame); bool DocumentUsedWebOTP() override; @@ -2224,7 +2200,7 @@ void RequestClose() override; void ShowCreatedWindow(const blink::LocalFrameToken& opener_frame_token, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + blink::mojom::WindowFeaturesPtr window_features, bool user_gesture, ShowCreatedWindowCallback callback) override; void SetWindowRect(const gfx::Rect& bounds, @@ -3161,12 +3137,13 @@ // under the root at A0, but only B, C, and E are considered immediate local // roots of A0. Note that this will exclude any speculative RFHs. void ForEachImmediateLocalRoot( - const base::RepeatingCallback<void(RenderFrameHostImpl*)>& callback); + base::FunctionRef<void(RenderFrameHostImpl*)> func_ref); // This is the actual implementation of the various overloads of // |ForEachRenderFrameHost|. - void ForEachRenderFrameHostImpl(FrameIterationCallbackImpl on_frame, - bool include_speculative); + void ForEachRenderFrameHostImpl( + base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame, + bool include_speculative); // Returns the mojom::Frame interface for this frame in the renderer process. // May be overridden by friend subclasses for e.g. tests which wish to
diff --git a/content/browser/renderer_host/render_frame_host_impl_browsertest.cc b/content/browser/renderer_host/render_frame_host_impl_browsertest.cc index 7f6f7c7..3b96f4d 100644 --- a/content/browser/renderer_host/render_frame_host_impl_browsertest.cc +++ b/content/browser/renderer_host/render_frame_host_impl_browsertest.cc
@@ -654,10 +654,10 @@ EXPECT_TRUE(WaitForLoadStop(web_contents())); // JavaScript onbeforeunload dialogs require a user gesture. web_contents()->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating([](content::RenderFrameHost* render_frame_host) { + [](content::RenderFrameHostImpl* render_frame_host) { render_frame_host->ExecuteJavaScriptWithUserGestureForTests( std::u16string(), base::NullCallback()); - })); + }); // Force a process switch by going to a privileged page. The beforeunload // timer will be started on the top-level frame but will be paused while the @@ -5662,20 +5662,18 @@ // Test that iteration stops when requested. { std::vector<RenderFrameHostImpl*> visited_frames; - rfh_a->ForEachRenderFrameHost( - base::BindLambdaForTesting([&](RenderFrameHostImpl* rfh) { - visited_frames.push_back(rfh); - return RenderFrameHost::FrameIterationAction::kStop; - })); + rfh_a->ForEachRenderFrameHostWithAction([&](RenderFrameHostImpl* rfh) { + visited_frames.push_back(rfh); + return RenderFrameHost::FrameIterationAction::kStop; + }); EXPECT_THAT(visited_frames, testing::ElementsAre(rfh_a)); } { std::vector<RenderFrameHostImpl*> visited_frames; - rfh_a->ForEachRenderFrameHost( - base::BindLambdaForTesting([&](RenderFrameHostImpl* rfh) { - visited_frames.push_back(rfh); - return RenderFrameHost::FrameIterationAction::kSkipChildren; - })); + rfh_a->ForEachRenderFrameHostWithAction([&](RenderFrameHostImpl* rfh) { + visited_frames.push_back(rfh); + return RenderFrameHost::FrameIterationAction::kSkipChildren; + }); EXPECT_THAT(visited_frames, testing::ElementsAre(rfh_a)); } @@ -5684,24 +5682,20 @@ // |rfh_c| and |rfh_d|. { std::vector<RenderFrameHostImpl*> visited_frames; - rfh_a->ForEachRenderFrameHost( - base::BindLambdaForTesting([&](RenderFrameHostImpl* rfh) { - visited_frames.push_back(rfh); - return rfh == rfh_b - ? RenderFrameHost::FrameIterationAction::kStop - : RenderFrameHost::FrameIterationAction::kContinue; - })); + rfh_a->ForEachRenderFrameHostWithAction([&](RenderFrameHostImpl* rfh) { + visited_frames.push_back(rfh); + return rfh == rfh_b ? RenderFrameHost::FrameIterationAction::kStop + : RenderFrameHost::FrameIterationAction::kContinue; + }); EXPECT_THAT(visited_frames, testing::ElementsAre(rfh_a, rfh_b)); } { std::vector<RenderFrameHostImpl*> visited_frames; - rfh_a->ForEachRenderFrameHost( - base::BindLambdaForTesting([&](RenderFrameHostImpl* rfh) { - visited_frames.push_back(rfh); - return rfh == rfh_b - ? RenderFrameHost::FrameIterationAction::kSkipChildren - : RenderFrameHost::FrameIterationAction::kContinue; - })); + rfh_a->ForEachRenderFrameHostWithAction([&](RenderFrameHostImpl* rfh) { + visited_frames.push_back(rfh); + return rfh == rfh_b ? RenderFrameHost::FrameIterationAction::kSkipChildren + : RenderFrameHost::FrameIterationAction::kContinue; + }); EXPECT_THAT(visited_frames, testing::ElementsAre(rfh_a, rfh_b, rfh_d)); } @@ -5754,11 +5748,10 @@ // If ForEachRenderFrameHost is called on a speculative RFH directly, do // nothing. - rfh_b->ForEachRenderFrameHost( - base::BindRepeating([](RenderFrameHostImpl* rfh) { - ADD_FAILURE() << "Visited speculative RFH"; - return RenderFrameHost::FrameIterationAction::kStop; - })); + rfh_b->ForEachRenderFrameHostWithAction([](RenderFrameHostImpl* rfh) { + ADD_FAILURE() << "Visited speculative RFH"; + return RenderFrameHost::FrameIterationAction::kStop; + }); // If we request speculative RFHs and directly call this on a // speculative RFH, just visit the given speculative RFH. @@ -5839,11 +5832,10 @@ // If ForEachRenderFrameHost is called on a speculative RFH directly, do // nothing. - rfh_d->ForEachRenderFrameHost( - base::BindRepeating([](RenderFrameHostImpl* rfh) { - ADD_FAILURE() << "Visited speculative RFH"; - return RenderFrameHost::FrameIterationAction::kStop; - })); + rfh_d->ForEachRenderFrameHostWithAction([](RenderFrameHostImpl* rfh) { + ADD_FAILURE() << "Visited speculative RFH"; + return RenderFrameHost::FrameIterationAction::kStop; + }); // If we request speculative RFHs and directly call this on a speculative RFH, // just visit the given speculative RFH. @@ -5855,54 +5847,54 @@ // We don't check the RFHs visited in the interest of not overtesting the // ordering of speculative RFHs. bool stopped = false; - rfh_a->ForEachRenderFrameHostIncludingSpeculative( - base::BindLambdaForTesting([&](RenderFrameHostImpl* rfh) { + rfh_a->ForEachRenderFrameHostIncludingSpeculativeWithAction( + [&](RenderFrameHostImpl* rfh) { EXPECT_FALSE(stopped); if (rfh->lifecycle_state() == LifecycleStateImpl::kSpeculative) { stopped = true; return RenderFrameHost::FrameIterationAction::kStop; } return RenderFrameHost::FrameIterationAction::kContinue; - })); + }); } { bool stopped = false; - rfh_b->ForEachRenderFrameHostIncludingSpeculative( - base::BindLambdaForTesting([&](RenderFrameHostImpl* rfh) { + rfh_b->ForEachRenderFrameHostIncludingSpeculativeWithAction( + [&](RenderFrameHostImpl* rfh) { EXPECT_FALSE(stopped); if (rfh->lifecycle_state() == LifecycleStateImpl::kSpeculative) { stopped = true; return RenderFrameHost::FrameIterationAction::kStop; } return RenderFrameHost::FrameIterationAction::kContinue; - })); + }); } // Skipping the children of a current RFH whose FrameTreeNode has a // speculative RFH skips the children but still includes the speculative RFH. { std::vector<RenderFrameHostImpl*> visited_frames; - rfh_a->ForEachRenderFrameHostIncludingSpeculative( - base::BindLambdaForTesting([&](RenderFrameHostImpl* rfh) { + rfh_a->ForEachRenderFrameHostIncludingSpeculativeWithAction( + [&](RenderFrameHostImpl* rfh) { visited_frames.push_back(rfh); return (rfh == rfh_b) ? RenderFrameHost::FrameIterationAction::kSkipChildren : RenderFrameHost::FrameIterationAction::kContinue; - })); + }); EXPECT_THAT(visited_frames, testing::UnorderedElementsAre(rfh_a, rfh_b, rfh_d)); } { std::vector<RenderFrameHostImpl*> visited_frames; - rfh_b->ForEachRenderFrameHostIncludingSpeculative( - base::BindLambdaForTesting([&](RenderFrameHostImpl* rfh) { + rfh_b->ForEachRenderFrameHostIncludingSpeculativeWithAction( + [&](RenderFrameHostImpl* rfh) { visited_frames.push_back(rfh); return (rfh == rfh_b) ? RenderFrameHost::FrameIterationAction::kSkipChildren : RenderFrameHost::FrameIterationAction::kContinue; - })); + }); EXPECT_THAT(visited_frames, testing::UnorderedElementsAre(rfh_b, rfh_d)); } @@ -5910,26 +5902,26 @@ // here for completeness of testing. { std::vector<RenderFrameHostImpl*> visited_frames; - rfh_a->ForEachRenderFrameHostIncludingSpeculative( - base::BindLambdaForTesting([&](RenderFrameHostImpl* rfh) { + rfh_a->ForEachRenderFrameHostIncludingSpeculativeWithAction( + [&](RenderFrameHostImpl* rfh) { visited_frames.push_back(rfh); return (rfh->lifecycle_state() == LifecycleStateImpl::kSpeculative) ? RenderFrameHost::FrameIterationAction::kSkipChildren : RenderFrameHost::FrameIterationAction::kContinue; - })); + }); EXPECT_THAT(visited_frames, testing::UnorderedElementsAre(rfh_a, rfh_b, rfh_d, rfh_c)); } { std::vector<RenderFrameHostImpl*> visited_frames; - rfh_b->ForEachRenderFrameHostIncludingSpeculative( - base::BindLambdaForTesting([&](RenderFrameHostImpl* rfh) { + rfh_b->ForEachRenderFrameHostIncludingSpeculativeWithAction( + [&](RenderFrameHostImpl* rfh) { visited_frames.push_back(rfh); return (rfh->lifecycle_state() == LifecycleStateImpl::kSpeculative) ? RenderFrameHost::FrameIterationAction::kSkipChildren : RenderFrameHost::FrameIterationAction::kContinue; - })); + }); EXPECT_THAT(visited_frames, testing::UnorderedElementsAre(rfh_b, rfh_d, rfh_c)); } @@ -6096,11 +6088,9 @@ // visits each and only each immediate local root in a BFS traversal order. for (auto* ftn : web_contents()->GetPrimaryFrameTree().Nodes()) { RenderFrameHostImpl* current_frame_host = ftn->current_frame_host(); - std::list<RenderFrameHostImpl*> frame_list; - current_frame_host->ForEachImmediateLocalRoot(base::BindRepeating( - [](std::list<RenderFrameHostImpl*>* ilr_list, - RenderFrameHostImpl* rfh) { ilr_list->push_back(rfh); }, - &frame_list)); + std::vector<RenderFrameHostImpl*> frame_list; + current_frame_host->ForEachImmediateLocalRoot( + [&frame_list](RenderFrameHostImpl* rfh) { frame_list.push_back(rfh); }); std::string result = frame_to_label_map[current_frame_host]; result.append(":");
diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc index d77a0f2..cc5ada1 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc
@@ -298,11 +298,9 @@ while (root->IsFencedFrameRoot()) { root = root->GetParentOrOuterDocument()->GetMainFrame(); } - root->ForEachRenderFrameHost(base::BindRepeating( - [](scoped_refptr<SiteInstance> site_instance, RenderFrameHost* root, - RenderFrameHost* rfh) { - RenderFrameHostImpl* rfhi = static_cast<RenderFrameHostImpl*>(rfh); - + root->ForEachRenderFrameHostWithAction( + [site_instance = std::move(new_instance), + root](RenderFrameHostImpl* rfhi) { if (rfhi->GetParent()) return RenderFrameHost::FrameIterationAction::kContinue; @@ -324,8 +322,7 @@ } return RenderFrameHost::FrameIterationAction::kContinue; - }, - new_instance, root)); + }); } } // namespace
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index e1df463..e70f44c 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -2843,11 +2843,10 @@ float scale = GetScaleFactorForView(GetView()); gfx::ImageSkia image = gfx::ImageSkia::CreateFromBitmap(bitmap, scale); gfx::Vector2d offset = bitmap_offset_in_dip; -#if !BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_WIN) // Scale the offset by device scale factor, otherwise the drag // image location doesn't line up with the drop location (drag destination). - // (TODO: crbug.com/1298831) Remove !BUILDFLAG(IS_MAC) after fixing the drag - // icon position. + // TODO(crbug.com/1354831): this conversion should not be necessary. gfx::Vector2dF scaled_offset = static_cast<gfx::Vector2dF>(offset); scaled_offset.Scale(scale); offset = gfx::ToRoundedVector2d(scaled_offset);
diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame_browsertest.cc b/content/browser/renderer_host/render_widget_host_view_child_frame_browsertest.cc index 48a6076..3730170e 100644 --- a/content/browser/renderer_host/render_widget_host_view_child_frame_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_view_child_frame_browsertest.cc
@@ -155,13 +155,12 @@ .GetInt(); EXPECT_NE(main_frame_screen_width, 0); - auto check_screen_width = [&](RenderFrameHost* frame_host) { - int width = - ExecuteScriptAndGetValue(frame_host, "window.screen.width").GetInt(); - EXPECT_EQ(width, main_frame_screen_width); - }; shell()->web_contents()->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindLambdaForTesting(check_screen_width)); + [&](RenderFrameHost* frame_host) { + int width = ExecuteScriptAndGetValue(frame_host, "window.screen.width") + .GetInt(); + EXPECT_EQ(width, main_frame_screen_width); + }); } // Auto-resize is only implemented for Ash and GuestViews. So we need to inject
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc index 44488fc..7acd4a0 100644 --- a/content/browser/site_per_process_browsertest.cc +++ b/content/browser/site_per_process_browsertest.cc
@@ -5872,13 +5872,13 @@ void ShowCreatedWindow(const blink::LocalFrameToken& opener_frame_token, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + blink::mojom::WindowFeaturesPtr window_features, bool user_gesture, ShowCreatedWindowCallback callback) override { show_callback_ = std::move(callback); opener_frame_token_ = opener_frame_token; user_gesture_ = user_gesture; - initial_rect_ = initial_rect; + window_features_ = std::move(window_features); disposition_ = disposition; std::move(test_callback_) .Run(render_frame_host_->GetRenderWidgetHost()->GetRoutingID()); @@ -5886,8 +5886,8 @@ void ResumeShowCreatedWindow() { GetForwardingInterface()->ShowCreatedWindow( - opener_frame_token_, disposition_, initial_rect_, user_gesture_, - std::move(show_callback_)); + opener_frame_token_, disposition_, std::move(window_features_), + user_gesture_, std::move(show_callback_)); } private: @@ -5895,7 +5895,7 @@ base::OnceCallback<void(int32_t pending_widget_routing_id)> test_callback_; ShowCreatedWindowCallback show_callback_; blink::LocalFrameToken opener_frame_token_; - gfx::Rect initial_rect_; + blink::mojom::WindowFeaturesPtr window_features_; bool user_gesture_ = false; WindowOpenDisposition disposition_; mojo::test::ScopedSwapImplForTesting<
diff --git a/content/browser/web_contents/web_contents_android.cc b/content/browser/web_contents/web_contents_android.cc index fd8af56c..37117d7 100644 --- a/content/browser/web_contents/web_contents_android.cc +++ b/content/browser/web_contents/web_contents_android.cc
@@ -316,11 +316,8 @@ ScopedJavaLocalRef<jobjectArray> WebContentsAndroid::GetAllRenderFrameHosts( JNIEnv* env) const { std::vector<RenderFrameHost*> frames; - web_contents_->ForEachRenderFrameHost(base::BindRepeating( - [](std::vector<RenderFrameHost*>* frames, RenderFrameHostImpl* rfh) { - frames->push_back(rfh); - }, - &frames)); + web_contents_->ForEachRenderFrameHost( + [&frames](RenderFrameHostImpl* rfh) { frames.push_back(rfh); }); ScopedJavaLocalRef<jobjectArray> jframes = Java_WebContentsImpl_createRenderFrameHostArray(env, frames.size()); for (size_t i = 0; i < frames.size(); i++) {
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index b3c50d5..2683152 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -171,6 +171,7 @@ #include "third_party/blink/public/mojom/image_downloader/image_downloader.mojom.h" #include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/accessibility/ax_tree_combiner.h" #include "ui/base/pointer/pointer_device.h" @@ -1386,39 +1387,47 @@ return ftn->current_frame_host(); } -void WebContentsImpl::ForEachRenderFrameHost( - RenderFrameHost::FrameIterationCallback on_frame) { - ForEachRenderFrameHost(RenderFrameHostImpl::FrameIterationWrapper(on_frame)); +void WebContentsImpl::ForEachRenderFrameHostWithAction( + base::FunctionRef<FrameIterationAction(RenderFrameHost*)> on_frame) { + ForEachRenderFrameHostWithAction( + [on_frame](RenderFrameHostImpl* rfh) { return on_frame(rfh); }); } void WebContentsImpl::ForEachRenderFrameHost( - RenderFrameHost::FrameIterationAlwaysContinueCallback on_frame) { - ForEachRenderFrameHost(RenderFrameHostImpl::FrameIterationWrapper(on_frame)); + base::FunctionRef<void(RenderFrameHost*)> on_frame) { + ForEachRenderFrameHost( + [on_frame](RenderFrameHostImpl* rfh) { on_frame(rfh); }); } -void WebContentsImpl::ForEachRenderFrameHost( - RenderFrameHostImpl::FrameIterationCallbackImpl on_frame) { +void WebContentsImpl::ForEachRenderFrameHostWithAction( + base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame) { ForEachRenderFrameHostImpl(on_frame, /* include_speculative */ false); } void WebContentsImpl::ForEachRenderFrameHost( - RenderFrameHostImpl::FrameIterationAlwaysContinueCallbackImpl on_frame) { - ForEachRenderFrameHost(RenderFrameHostImpl::FrameIterationWrapper(on_frame)); + base::FunctionRef<void(RenderFrameHostImpl*)> on_frame) { + ForEachRenderFrameHostWithAction([on_frame](RenderFrameHostImpl* rfh) { + on_frame(rfh); + return FrameIterationAction::kContinue; + }); } -void WebContentsImpl::ForEachRenderFrameHostIncludingSpeculative( - RenderFrameHostImpl::FrameIterationCallbackImpl on_frame) { +void WebContentsImpl::ForEachRenderFrameHostIncludingSpeculativeWithAction( + base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame) { ForEachRenderFrameHostImpl(on_frame, /* include_speculative */ true); } void WebContentsImpl::ForEachRenderFrameHostIncludingSpeculative( - RenderFrameHostImpl::FrameIterationAlwaysContinueCallbackImpl on_frame) { - ForEachRenderFrameHostIncludingSpeculative( - RenderFrameHostImpl::FrameIterationWrapper(on_frame)); + base::FunctionRef<void(RenderFrameHostImpl*)> on_frame) { + ForEachRenderFrameHostIncludingSpeculativeWithAction( + [on_frame](RenderFrameHostImpl* rfh) { + on_frame(rfh); + return FrameIterationAction::kContinue; + }); } void WebContentsImpl::ForEachRenderFrameHostImpl( - RenderFrameHostImpl::FrameIterationCallbackImpl on_frame, + base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame, bool include_speculative) { // Since |RenderFrameHostImpl::ForEachRenderFrameHost| will reach the // RenderFrameHosts descending from a specified root, it is enough to start @@ -1427,25 +1436,21 @@ // |RenderFrameHostImpl::ForEachRenderFrameHost|, we also need to stop early // by not iterating over additional outermost main frames. bool iteration_stopped = false; - RenderFrameHostImpl::FrameIterationCallbackImpl on_frame_with_termination = - base::BindRepeating( - [](bool& iteration_stopped, - RenderFrameHostImpl::FrameIterationCallbackImpl on_frame, - RenderFrameHostImpl* rfh) { - const auto action = on_frame.Run(rfh); - if (action == RenderFrameHost::FrameIterationAction::kStop) { - iteration_stopped = true; - } - return action; - }, - std::ref(iteration_stopped), on_frame); + auto on_frame_with_termination = + [on_frame, &iteration_stopped](RenderFrameHostImpl* rfh) { + const auto action = on_frame(rfh); + if (action == FrameIterationAction::kStop) { + iteration_stopped = true; + } + return action; + }; for (auto* rfh : GetOutermostMainFrames()) { if (include_speculative) { - rfh->ForEachRenderFrameHostIncludingSpeculative( + rfh->ForEachRenderFrameHostIncludingSpeculativeWithAction( on_frame_with_termination); } else { - rfh->ForEachRenderFrameHost(on_frame_with_termination); + rfh->ForEachRenderFrameHostWithAction(on_frame_with_termination); } if (iteration_stopped) { @@ -1654,8 +1659,7 @@ // Update state for all frames in this tree and inner trees. Should also // include speculative frame hosts. GetPrimaryMainFrame()->ForEachRenderFrameHostIncludingSpeculative( - base::BindRepeating( - [](RenderFrameHostImpl* rfhi) { rfhi->UpdateAccessibilityMode(); })); + &RenderFrameHostImpl::UpdateAccessibilityMode); } void WebContentsImpl::AddAccessibilityMode(ui::AXMode mode) { @@ -1725,8 +1729,10 @@ auto combiner = base::MakeRefCounted<AXTreeSnapshotCombiner>( std::move(callback), std::move(params)); - GetPrimaryMainFrame()->ForEachRenderFrameHost(base::BindRepeating( - &AXTreeSnapshotCombiner::AXTreeSnapshotOnFrame, combiner)); + GetPrimaryMainFrame()->ForEachRenderFrameHost( + [&combiner](RenderFrameHostImpl* rfh) { + combiner->AXTreeSnapshotOnFrame(rfh); + }); } void WebContentsImpl::NotifyViewportFitChanged( @@ -1907,8 +1913,7 @@ // called indirectly above via AddAccessibilityMode). if (need_reset) { GetPrimaryMainFrame()->ForEachRenderFrameHostIncludingSpeculative( - base::BindRepeating( - [](RenderFrameHostImpl* rfhi) { rfhi->AccessibilityReset(); })); + &RenderFrameHostImpl::AccessibilityReset); } } @@ -3229,15 +3234,13 @@ std::set<RenderWidgetHostViewBase*> WebContentsImpl::GetRenderWidgetHostViewsInWebContentsTree() { std::set<RenderWidgetHostViewBase*> result; - GetPrimaryMainFrame()->ForEachRenderFrameHost(base::BindRepeating( - [](std::set<RenderWidgetHostViewBase*>& result, - RenderFrameHostImpl* rfh) { + GetPrimaryMainFrame()->ForEachRenderFrameHost( + [&result](RenderFrameHostImpl* rfh) { if (auto* view = static_cast<RenderWidgetHostViewBase*>(rfh->GetView())) { result.insert(view); } - }, - std::ref(result))); + }); return result; } @@ -4079,19 +4082,9 @@ base::WeakPtr<WebContentsImpl> weak_new_contents = new_contents_impl->weak_factory_.GetWeakPtr(); - gfx::Rect initial_rect; - if (params.features->has_width) - initial_rect.set_width(params.features->width); - if (params.features->has_height) - initial_rect.set_height(params.features->height); - if (params.features->has_x) - initial_rect.set_x(params.features->x); - if (params.features->has_y) - initial_rect.set_y(params.features->y); - - delegate_->AddNewContents(this, std::move(new_contents), - params.target_url, params.disposition, - initial_rect, has_user_gesture, &was_blocked); + delegate_->AddNewContents( + this, std::move(new_contents), params.target_url, params.disposition, + *params.features, has_user_gesture, &was_blocked); // The delegate may delete |new_contents_impl| during AddNewContents(). if (!weak_new_contents) return nullptr; @@ -4174,11 +4167,12 @@ return widget_host; } -void WebContentsImpl::ShowCreatedWindow(RenderFrameHostImpl* opener, - int main_frame_widget_route_id, - WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, - bool user_gesture) { +void WebContentsImpl::ShowCreatedWindow( + RenderFrameHostImpl* opener, + int main_frame_widget_route_id, + WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures& window_features, + bool user_gesture) { OPTIONAL_TRACE_EVENT2("content", "WebContentsImpl::ShowCreatedWindow", "opener", opener, "main_frame_widget_route_id", main_frame_widget_route_id); @@ -4205,15 +4199,15 @@ // from, to control how to show the newly created window. WebContentsDelegate* delegate = GetDelegate(); - // Individual members of |initial_rect| may be 0 to indicate that the - // window.open() feature string did not specify a value. This code does not - // have the ability to distinguish between an unspecified value and 0. + // Individual members of |window_features.bounds| may be 0 to indicate that + // the window.open() feature string did not specify a value. This code does + // not distinguish between an unspecified value and 0. // Assume that if any single value is non-zero, all values should be used. - // TODO(crbug.com/897300): Plumb values as specified; set defaults here? - gfx::Rect adjusted_rect = initial_rect; + // TODO(crbug.com/897300): Utilize window_features.has_x and others. + blink::mojom::WindowFeatures adjusted_features = window_features; int64_t display_id = display::kInvalidDisplayId; - if (adjusted_rect != gfx::Rect()) - display_id = AdjustRequestedWindowBounds(&adjusted_rect, opener); + if (adjusted_features.bounds != gfx::Rect()) + display_id = AdjustRequestedWindowBounds(&adjusted_features.bounds, opener); // Drop fullscreen when opening a WebContents to prohibit deceptive behavior. // Only drop fullscreen on the specific destination display, if it is known. @@ -4231,7 +4225,7 @@ delegate->AddNewContents(this, std::move(owned_created->contents), std::move(owned_created->target_url), disposition, - adjusted_rect, user_gesture, nullptr); + adjusted_features, user_gesture, nullptr); } } @@ -4570,24 +4564,23 @@ DCHECK(!IsBeingDestroyed()); GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating([](RenderFrameHostImpl* render_frame_host) { + [](RenderFrameHostImpl* render_frame_host) { if (render_frame_host->is_local_root()) { render_frame_host->GetRenderWidgetHost()->SendScreenRects(); } - })); + }); } void WebContentsImpl::SendActiveState(bool active) { DCHECK(!IsBeingDestroyed()); // Replicate the active state to all LocalRoots. - GetPrimaryMainFrame()->ForEachRenderFrameHost(base::BindRepeating( - [](bool active, RenderFrameHostImpl* render_frame_host) { + GetPrimaryMainFrame()->ForEachRenderFrameHost( + [active](RenderFrameHostImpl* render_frame_host) { if (render_frame_host->is_local_root()) { render_frame_host->GetRenderWidgetHost()->SetActive(active); } - }, - active)); + }); } TextInputManager* WebContentsImpl::GetTextInputManager() { @@ -6137,12 +6130,12 @@ &navigation_entries); // Add |view_source_contents| as a new tab. - gfx::Rect initial_rect; constexpr bool kUserGesture = true; bool ignored_was_blocked; delegate_->AddNewContents(this, std::move(view_source_contents), url, WindowOpenDisposition::NEW_FOREGROUND_TAB, - initial_rect, kUserGesture, &ignored_was_blocked); + blink::mojom::WindowFeatures(), kUserGesture, + &ignored_was_blocked); // Note that the |delegate_| could have deleted |view_source_contents| during // AddNewContents method call. }
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index 805e7e0..335ed04c 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -18,6 +18,7 @@ #include "base/callback_helpers.h" #include "base/callback_list.h" #include "base/containers/flat_map.h" +#include "base/functional/function_ref.h" #include "base/gtest_prod_util.h" #include "base/memory/raw_ptr.h" #include "base/memory/safe_ref.h" @@ -345,10 +346,11 @@ bool IsPrerenderedFrame(int frame_tree_node_id) override; RenderFrameHostImpl* UnsafeFindFrameByFrameTreeNodeId( int frame_tree_node_id) override; + void ForEachRenderFrameHostWithAction( + base::FunctionRef<FrameIterationAction(RenderFrameHost*)> on_frame) + override; void ForEachRenderFrameHost( - RenderFrameHost::FrameIterationCallback on_frame) override; - void ForEachRenderFrameHost( - RenderFrameHost::FrameIterationAlwaysContinueCallback on_frame) override; + base::FunctionRef<void(RenderFrameHost*)> on_frame) override; RenderViewHostImpl* GetRenderViewHost() override; RenderWidgetHostView* GetRenderWidgetHostView() override; RenderWidgetHostView* GetTopLevelRenderWidgetHostView() override; @@ -692,7 +694,7 @@ void ShowCreatedWindow(RenderFrameHostImpl* opener, int main_frame_widget_route_id, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture) override; void PrimaryMainDocumentElementAvailable() override; void PassiveInsecureContentFound(const GURL& resource_url) override; @@ -1288,14 +1290,14 @@ // for details. Content internals can also access speculative // RenderFrameHostImpls if necessary by using the // |ForEachRenderFrameHostIncludingSpeculative| variations. + void ForEachRenderFrameHostWithAction( + base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame); void ForEachRenderFrameHost( - RenderFrameHostImpl::FrameIterationCallbackImpl on_frame); - void ForEachRenderFrameHost( - RenderFrameHostImpl::FrameIterationAlwaysContinueCallbackImpl on_frame); + base::FunctionRef<void(RenderFrameHostImpl*)> on_frame); + void ForEachRenderFrameHostIncludingSpeculativeWithAction( + base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame); void ForEachRenderFrameHostIncludingSpeculative( - RenderFrameHostImpl::FrameIterationCallbackImpl on_frame); - void ForEachRenderFrameHostIncludingSpeculative( - RenderFrameHostImpl::FrameIterationAlwaysContinueCallbackImpl on_frame); + base::FunctionRef<void(RenderFrameHostImpl*)> on_frame); // Computes and returns the content specific preferences for this WebContents. // Recomputes only the "fast" preferences (those not requiring slow @@ -1831,7 +1833,7 @@ // This is the actual implementation of the various overloads of // |ForEachRenderFrameHost|. void ForEachRenderFrameHostImpl( - RenderFrameHostImpl::FrameIterationCallbackImpl on_frame, + base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame, bool include_speculative); // Calls |on_frame_tree| for every FrameTree in this WebContents.
diff --git a/content/browser/web_contents/web_contents_impl_browsertest.cc b/content/browser/web_contents/web_contents_impl_browsertest.cc index 817f469..e130aeb 100644 --- a/content/browser/web_contents/web_contents_impl_browsertest.cc +++ b/content/browser/web_contents/web_contents_impl_browsertest.cc
@@ -1782,7 +1782,7 @@ std::unique_ptr<WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override { popups_.push_back(std::move(new_contents));
diff --git a/content/browser/webid/federated_auth_request_impl.cc b/content/browser/webid/federated_auth_request_impl.cc index a5d5d46..17b60960 100644 --- a/content/browser/webid/federated_auth_request_impl.cc +++ b/content/browser/webid/federated_auth_request_impl.cc
@@ -294,9 +294,22 @@ void FederatedAuthRequestImpl::RequestToken( std::vector<IdentityProviderPtr> identity_provider_ptrs, bool prefer_auto_sign_in, + bool show_iframe_requester, RequestTokenCallback callback) { // TODO(crbug.com/1348262): Temporarily support only the first IDP, extend to // support multiple IDPs. + if (identity_provider_ptrs.empty()) { + std::move(callback).Run(RequestTokenStatus::kError, ""); + return; + } + + for (const auto& identity_provider : identity_provider_ptrs) { + if (!identity_provider) { + std::move(callback).Run(RequestTokenStatus::kError, ""); + return; + } + } + blink::mojom::IdentityProviderPtr identity_provider_ptr = std::move(identity_provider_ptrs[0]);
diff --git a/content/browser/webid/federated_auth_request_impl.h b/content/browser/webid/federated_auth_request_impl.h index 31bf3bf3..12ea322 100644 --- a/content/browser/webid/federated_auth_request_impl.h +++ b/content/browser/webid/federated_auth_request_impl.h
@@ -59,6 +59,7 @@ void RequestToken( std::vector<blink::mojom::IdentityProviderPtr> identity_provider_ptrs, bool prefer_auto_sign_in, + bool show_iframe_requester, RequestTokenCallback) override; void CancelTokenRequest() override; void LogoutRps(std::vector<blink::mojom::LogoutRpsRequestPtr> logout_requests,
diff --git a/content/browser/webid/federated_auth_request_impl_unittest.cc b/content/browser/webid/federated_auth_request_impl_unittest.cc index ff24b54..4460bdc 100644 --- a/content/browser/webid/federated_auth_request_impl_unittest.cc +++ b/content/browser/webid/federated_auth_request_impl_unittest.cc
@@ -717,8 +717,9 @@ std::vector<blink::mojom::IdentityProviderPtr> identity_provider_ptrs, bool prefer_auto_sign_in, bool wait_for_callback) { - request_remote_->RequestToken(std::move(identity_provider_ptrs), - prefer_auto_sign_in, auth_helper_.callback()); + request_remote_->RequestToken( + std::move(identity_provider_ptrs), prefer_auto_sign_in, + /*show_iframe_requester=*/false, auth_helper_.callback()); if (wait_for_callback) request_remote_.set_disconnect_handler(auth_helper_.quit_closure());
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc index f5795ad..ff08ce58 100644 --- a/content/gpu/gpu_child_thread.cc +++ b/content/gpu/gpu_child_thread.cc
@@ -89,6 +89,7 @@ deps.sync_point_manager = GetContentClient()->gpu()->GetSyncPointManager(); deps.shared_image_manager = GetContentClient()->gpu()->GetSharedImageManager(); + deps.scheduler = GetContentClient()->gpu()->GetScheduler(); deps.viz_compositor_thread_runner = GetContentClient()->gpu()->GetVizCompositorThreadRunner(); }
diff --git a/content/public/browser/render_frame_host.h b/content/public/browser/render_frame_host.h index c4123678..b0123f0 100644 --- a/content/public/browser/render_frame_host.h +++ b/content/public/browser/render_frame_host.h
@@ -11,6 +11,7 @@ #include "base/callback_forward.h" #include "base/containers/flat_set.h" +#include "base/functional/function_ref.h" #include "base/values.h" #include "build/build_config.h" #include "content/common/content_export.h" @@ -356,13 +357,10 @@ // Does not continue traversal. kStop }; - using FrameIterationCallback = - base::RepeatingCallback<FrameIterationAction(RenderFrameHost*)>; - using FrameIterationAlwaysContinueCallback = - base::RepeatingCallback<void(RenderFrameHost*)>; - virtual void ForEachRenderFrameHost(FrameIterationCallback on_frame) = 0; + virtual void ForEachRenderFrameHostWithAction( + base::FunctionRef<FrameIterationAction(RenderFrameHost*)> on_frame) = 0; virtual void ForEachRenderFrameHost( - FrameIterationAlwaysContinueCallback on_frame) = 0; + base::FunctionRef<void(RenderFrameHost*)> on_frame) = 0; // Returns the FrameTreeNode ID associated with this RenderFrameHost. This ID // is browser-global and uniquely identifies a browser-side concept of a frame
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h index 024cd37e..b4dda7c 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h
@@ -14,6 +14,7 @@ #include "base/callback_forward.h" #include "base/callback_helpers.h" +#include "base/functional/function_ref.h" #include "base/location.h" #include "base/memory/raw_ptr.h" #include "base/memory/scoped_refptr.h" @@ -433,10 +434,11 @@ // For callers only interested in the primary page, // |GetMainFrame()->ForEachRenderFrameHost()| can be used. // See |RenderFrameHost::ForEachRenderFrameHost| for details. + using FrameIterationAction = RenderFrameHost::FrameIterationAction; + virtual void ForEachRenderFrameHostWithAction( + base::FunctionRef<FrameIterationAction(RenderFrameHost*)> on_frame) = 0; virtual void ForEachRenderFrameHost( - RenderFrameHost::FrameIterationCallback on_frame) = 0; - virtual void ForEachRenderFrameHost( - RenderFrameHost::FrameIterationAlwaysContinueCallback on_frame) = 0; + base::FunctionRef<void(RenderFrameHost*)> on_frame) = 0; // Gets the current RenderViewHost for this tab. virtual RenderViewHost* GetRenderViewHost() = 0;
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index 0274e3bb..815bee2 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h
@@ -48,6 +48,7 @@ namespace blink { namespace mojom { class FileChooserParams; +class WindowFeatures; } } // namespace blink @@ -140,20 +141,22 @@ // security state changed and that security UI should be updated. virtual void VisibleSecurityStateChanged(WebContents* source) {} - // Creates a new tab with the already-created WebContents |new_contents|. + // Creates a new tab with the already-created WebContents `new_contents`. // The window for the added contents should be reparented correctly when this - // method returns. |target_url| is set to the value provided when - // |new_contents| was created. If |disposition| is NEW_POPUP, |initial_rect| - // should hold the initial position and size. If |was_blocked| is non-nullptr, - // then |*was_blocked| will be set to true if the popup gets blocked, and left + // method returns. `target_url` is set to the value provided when + // `new_contents` was created. If `disposition` is NEW_POPUP, + // `window_features` should hold the initial position, size and other + // properties of the window. If `was_blocked` is non-nullptr, then + // `*was_blocked` will be set to true if the popup gets blocked, and left // unchanged otherwise. - virtual void AddNewContents(WebContents* source, - std::unique_ptr<WebContents> new_contents, - const GURL& target_url, - WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, - bool user_gesture, - bool* was_blocked) {} + virtual void AddNewContents( + WebContents* source, + std::unique_ptr<WebContents> new_contents, + const GURL& target_url, + WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures& window_features, + bool user_gesture, + bool* was_blocked) {} // Selects the specified contents, bringing its container to the front. virtual void ActivateContents(WebContents* contents) {}
diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h index 718ea14..00ab55d04 100644 --- a/content/public/common/common_param_traits_macros.h +++ b/content/public/common/common_param_traits_macros.h
@@ -57,13 +57,10 @@ IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(blink::mojom::WindowFeatures) - IPC_STRUCT_TRAITS_MEMBER(x) + IPC_STRUCT_TRAITS_MEMBER(bounds) IPC_STRUCT_TRAITS_MEMBER(has_x) - IPC_STRUCT_TRAITS_MEMBER(y) IPC_STRUCT_TRAITS_MEMBER(has_y) - IPC_STRUCT_TRAITS_MEMBER(width) IPC_STRUCT_TRAITS_MEMBER(has_width) - IPC_STRUCT_TRAITS_MEMBER(height) IPC_STRUCT_TRAITS_MEMBER(has_height) IPC_STRUCT_TRAITS_MEMBER(menu_bar_visible) IPC_STRUCT_TRAITS_MEMBER(status_bar_visible)
diff --git a/content/public/gpu/content_gpu_client.cc b/content/public/gpu/content_gpu_client.cc index ef1b9c7..c0f60c6 100644 --- a/content/public/gpu/content_gpu_client.cc +++ b/content/public/gpu/content_gpu_client.cc
@@ -14,6 +14,10 @@ return nullptr; } +gpu::Scheduler* ContentGpuClient::GetScheduler() { + return nullptr; +} + viz::VizCompositorThreadRunner* ContentGpuClient::GetVizCompositorThreadRunner() { return nullptr;
diff --git a/content/public/gpu/content_gpu_client.h b/content/public/gpu/content_gpu_client.h index a5d868b..e7811da 100644 --- a/content/public/gpu/content_gpu_client.h +++ b/content/public/gpu/content_gpu_client.h
@@ -14,6 +14,7 @@ namespace gpu { struct GpuPreferences; class GpuDriverBugWorkarounds; +class Scheduler; class SharedImageManager; class SyncPointManager; } @@ -52,6 +53,7 @@ // internally create one. virtual gpu::SyncPointManager* GetSyncPointManager(); virtual gpu::SharedImageManager* GetSharedImageManager(); + virtual gpu::Scheduler* GetScheduler(); virtual viz::VizCompositorThreadRunner* GetVizCompositorThreadRunner(); };
diff --git a/content/public/renderer/window_features_converter.cc b/content/public/renderer/window_features_converter.cc index 49fd3e6..faf2248 100644 --- a/content/public/renderer/window_features_converter.cc +++ b/content/public/renderer/window_features_converter.cc
@@ -15,13 +15,13 @@ blink::mojom::WindowFeaturesPtr ConvertWebWindowFeaturesToMojoWindowFeatures( const blink::WebWindowFeatures& web_window_features) { blink::mojom::WindowFeaturesPtr result = blink::mojom::WindowFeatures::New(); - result->x = web_window_features.x; + result->bounds.set_x(web_window_features.x); result->has_x = web_window_features.x_set; - result->y = web_window_features.y; + result->bounds.set_y(web_window_features.y); result->has_y = web_window_features.y_set; - result->width = web_window_features.width; + result->bounds.set_width(web_window_features.width); result->has_width = web_window_features.width_set; - result->height = web_window_features.height; + result->bounds.set_height(web_window_features.height); result->has_height = web_window_features.height_set; result->menu_bar_visible = web_window_features.menu_bar_visible; result->status_bar_visible = web_window_features.status_bar_visible; @@ -33,13 +33,13 @@ blink::WebWindowFeatures ConvertMojoWindowFeaturesToWebWindowFeatures( const blink::mojom::WindowFeatures& window_features) { blink::WebWindowFeatures result; - result.x = window_features.x; + result.x = window_features.bounds.x(); result.x_set = window_features.has_x; - result.y = window_features.y; + result.y = window_features.bounds.y(); result.y_set = window_features.has_y; - result.width = window_features.width; + result.width = window_features.bounds.width(); result.width_set = window_features.has_width; - result.height = window_features.height; + result.height = window_features.bounds.height(); result.height_set = window_features.has_height; result.menu_bar_visible = window_features.menu_bar_visible; result.status_bar_visible = window_features.status_bar_visible;
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index 155ef2d..224e244 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc
@@ -844,18 +844,16 @@ void PrepContentsForBeforeUnloadTest(WebContents* web_contents, bool trigger_user_activation) { web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindRepeating( - [](bool trigger_user_activation, RenderFrameHost* render_frame_host) { - if (trigger_user_activation) { - render_frame_host->ExecuteJavaScriptWithUserGestureForTests( - std::u16string(), base::NullCallback()); - } + [trigger_user_activation](RenderFrameHost* render_frame_host) { + if (trigger_user_activation) { + render_frame_host->ExecuteJavaScriptWithUserGestureForTests( + std::u16string(), base::NullCallback()); + } - // Disable the hang monitor, otherwise there will be a race between - // the beforeunload dialog and the beforeunload hang timer. - render_frame_host->DisableBeforeUnloadHangMonitorForTesting(); - }, - trigger_user_activation)); + // Disable the hang monitor, otherwise there will be a race between + // the beforeunload dialog and the beforeunload hang timer. + render_frame_host->DisableBeforeUnloadHangMonitorForTesting(); + }); } bool IsLastCommittedEntryOfPageType(WebContents* web_contents, @@ -1904,22 +1902,15 @@ return result; } -namespace { -void AddToSetIfFrameMatchesPredicate( - std::set<RenderFrameHost*>* frame_set, - base::OnceCallback<bool(RenderFrameHost*)> predicate, - RenderFrameHost* host) { - if (std::move(predicate).Run(host)) - frame_set->insert(host); -} -} - RenderFrameHost* FrameMatchingPredicateOrNullptr( Page& page, base::RepeatingCallback<bool(RenderFrameHost*)> predicate) { std::set<RenderFrameHost*> frame_set; - page.GetMainDocument().ForEachRenderFrameHost(base::BindRepeating( - &AddToSetIfFrameMatchesPredicate, &frame_set, predicate)); + page.GetMainDocument().ForEachRenderFrameHost( + [&predicate, &frame_set](RenderFrameHost* rfh) { + if (predicate.Run(rfh)) + frame_set.insert(rfh); + }); EXPECT_LE(frame_set.size(), 1u); return frame_set.size() == 1 ? *frame_set.begin() : nullptr; } @@ -1963,8 +1954,8 @@ std::vector<RenderFrameHost*> CollectAllRenderFrameHosts( RenderFrameHost* starting_rfh) { std::vector<RenderFrameHost*> visited_frames; - starting_rfh->ForEachRenderFrameHost(base::BindLambdaForTesting( - [&](RenderFrameHost* rfh) { visited_frames.push_back(rfh); })); + starting_rfh->ForEachRenderFrameHost( + [&](RenderFrameHost* rfh) { visited_frames.push_back(rfh); }); return visited_frames; } @@ -1975,8 +1966,8 @@ std::vector<RenderFrameHost*> CollectAllRenderFrameHosts( WebContents* web_contents) { std::vector<RenderFrameHost*> visited_frames; - web_contents->ForEachRenderFrameHost(base::BindLambdaForTesting( - [&](RenderFrameHost* rfh) { visited_frames.push_back(rfh); })); + web_contents->ForEachRenderFrameHost( + [&](RenderFrameHost* rfh) { visited_frames.push_back(rfh); }); return visited_frames; }
diff --git a/content/renderer/media/render_media_client.cc b/content/renderer/media/render_media_client.cc index a0b9262..fe8bb10 100644 --- a/content/renderer/media/render_media_client.cc +++ b/content/renderer/media/render_media_client.cc
@@ -20,8 +20,9 @@ // Some clients need this knowledge synchronously, so we try to populate // it asynchronously ahead of time, but can fallback to a blocking call // when it's needed synchronously. -#if BUILDFLAG(ENABLE_PLATFORM_HEVC) && \ - (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)) +#if BUILDFLAG(ENABLE_PLATFORM_HEVC) && \ + (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || \ + BUILDFLAG(IS_MAC)) #define NEEDS_PROFILE_UPDATER 1 #else #define NEEDS_PROFILE_UPDATER 0
diff --git a/content/shell/browser/shell.cc b/content/shell/browser/shell.cc index 34fbcfc..a821192 100644 --- a/content/shell/browser/shell.cc +++ b/content/shell/browser/shell.cc
@@ -43,6 +43,7 @@ #include "media/media_buildflags.h" #include "third_party/blink/public/common/peerconnection/webrtc_ip_handling_policy.h" #include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" namespace content { @@ -293,11 +294,11 @@ std::unique_ptr<WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) { CreateShell( - std::move(new_contents), AdjustWindowSize(initial_rect.size()), + std::move(new_contents), AdjustWindowSize(window_features.bounds.size()), !delay_popup_contents_delegate_for_testing_ /* should_set_delegate */); }
diff --git a/content/shell/browser/shell.h b/content/shell/browser/shell.h index 799f31a..47ce9263 100644 --- a/content/shell/browser/shell.h +++ b/content/shell/browser/shell.h
@@ -116,7 +116,7 @@ std::unique_ptr<WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; void LoadingStateChanged(WebContents* source,
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 8a711ca..81a8349 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -2190,6 +2190,7 @@ "../browser/first_party_sets/addition_overlaps_union_find_unittest.cc", "../browser/first_party_sets/database/first_party_sets_database_unittest.cc", "../browser/first_party_sets/first_party_set_parser_unittest.cc", + "../browser/first_party_sets/first_party_sets_handler_database_helper_unittest.cc", "../browser/first_party_sets/first_party_sets_handler_impl_unittest.cc", "../browser/first_party_sets/first_party_sets_loader_unittest.cc", "../browser/font_access/font_access_manager_unittest.cc",
diff --git a/content/test/content_browser_test_utils_internal.cc b/content/test/content_browser_test_utils_internal.cc index 8183cb7..6db08b6 100644 --- a/content/test/content_browser_test_utils_internal.cc +++ b/content/test/content_browser_test_utils_internal.cc
@@ -162,8 +162,8 @@ std::vector<RenderFrameHostImpl*> CollectAllRenderFrameHosts( RenderFrameHostImpl* starting_rfh) { std::vector<RenderFrameHostImpl*> visited_frames; - starting_rfh->ForEachRenderFrameHost(base::BindLambdaForTesting( - [&](RenderFrameHostImpl* rfh) { visited_frames.push_back(rfh); })); + starting_rfh->ForEachRenderFrameHost( + [&](RenderFrameHostImpl* rfh) { visited_frames.push_back(rfh); }); return visited_frames; } @@ -172,16 +172,15 @@ RenderFrameHostImpl* starting_rfh) { std::vector<RenderFrameHostImpl*> visited_frames; starting_rfh->ForEachRenderFrameHostIncludingSpeculative( - base::BindLambdaForTesting( - [&](RenderFrameHostImpl* rfh) { visited_frames.push_back(rfh); })); + [&](RenderFrameHostImpl* rfh) { visited_frames.push_back(rfh); }); return visited_frames; } std::vector<RenderFrameHostImpl*> CollectAllRenderFrameHosts( WebContentsImpl* web_contents) { std::vector<RenderFrameHostImpl*> visited_frames; - web_contents->ForEachRenderFrameHost(base::BindLambdaForTesting( - [&](RenderFrameHostImpl* rfh) { visited_frames.push_back(rfh); })); + web_contents->ForEachRenderFrameHost( + [&](RenderFrameHostImpl* rfh) { visited_frames.push_back(rfh); }); return visited_frames; } @@ -189,8 +188,7 @@ CollectAllRenderFrameHostsIncludingSpeculative(WebContentsImpl* web_contents) { std::vector<RenderFrameHostImpl*> visited_frames; web_contents->ForEachRenderFrameHostIncludingSpeculative( - base::BindLambdaForTesting( - [&](RenderFrameHostImpl* rfh) { visited_frames.push_back(rfh); })); + [&](RenderFrameHostImpl* rfh) { visited_frames.push_back(rfh); }); return visited_frames; }
diff --git a/content/test/did_commit_navigation_interceptor.cc b/content/test/did_commit_navigation_interceptor.cc index fa345cb..a736ae27 100644 --- a/content/test/did_commit_navigation_interceptor.cc +++ b/content/test/did_commit_navigation_interceptor.cc
@@ -48,13 +48,11 @@ DidCommitNavigationInterceptor::DidCommitNavigationInterceptor( WebContents* web_contents) : WebContentsObserver(web_contents) { - web_contents->ForEachRenderFrameHost(base::BindRepeating( - [](DidCommitNavigationInterceptor* interceptor, - RenderFrameHost* render_frame_host) { + web_contents->ForEachRenderFrameHost( + [this](RenderFrameHost* render_frame_host) { if (render_frame_host->IsRenderFrameLive()) - interceptor->RenderFrameCreated(render_frame_host); - }, - this)); + RenderFrameCreated(render_frame_host); + }); } DidCommitNavigationInterceptor::~DidCommitNavigationInterceptor() = default;
diff --git a/content/test/frame_host_interceptor.cc b/content/test/frame_host_interceptor.cc index beebf24..4dd0156 100644 --- a/content/test/frame_host_interceptor.cc +++ b/content/test/frame_host_interceptor.cc
@@ -74,13 +74,11 @@ FrameHostInterceptor::FrameHostInterceptor(WebContents* web_contents) : WebContentsObserver(web_contents) { - web_contents->ForEachRenderFrameHost(base::BindRepeating( - [](FrameHostInterceptor* interceptor, - RenderFrameHost* render_frame_host) { + web_contents->ForEachRenderFrameHost( + [this](RenderFrameHost* render_frame_host) { if (render_frame_host->IsRenderFrameLive()) - interceptor->RenderFrameCreated(render_frame_host); - }, - this)); + RenderFrameCreated(render_frame_host); + }); } FrameHostInterceptor::~FrameHostInterceptor() = default;
diff --git a/content/test/test_web_contents.cc b/content/test/test_web_contents.cc index 1a64f30..7cf3c7df 100644 --- a/content/test/test_web_contents.cc +++ b/content/test/test_web_contents.cc
@@ -362,11 +362,12 @@ return nullptr; } -void TestWebContents::ShowCreatedWindow(RenderFrameHostImpl* opener, - int route_id, - WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, - bool user_gesture) {} +void TestWebContents::ShowCreatedWindow( + RenderFrameHostImpl* opener, + int route_id, + WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures& window_features, + bool user_gesture) {} void TestWebContents::ShowCreatedWidget(int process_id, int route_id,
diff --git a/content/test/test_web_contents.h b/content/test/test_web_contents.h index 6e9a4f4..95f95d2 100644 --- a/content/test/test_web_contents.h +++ b/content/test/test_web_contents.h
@@ -191,7 +191,7 @@ void ShowCreatedWindow(RenderFrameHostImpl* opener, int route_id, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture) override; void ShowCreatedWidget(int process_id, int route_id,
diff --git a/content/web_test/browser/web_test_control_host.cc b/content/web_test/browser/web_test_control_host.cc index d56151d..0586c5a 100644 --- a/content/web_test/browser/web_test_control_host.cc +++ b/content/web_test/browser/web_test_control_host.cc
@@ -459,10 +459,10 @@ // have a set of RenderFrames already, and we need to notify about them // here. web_contents->ForEachRenderFrameHost( - base::BindLambdaForTesting([&](RenderFrameHost* render_frame_host) { + [&](RenderFrameHost* render_frame_host) { if (render_frame_host->IsRenderFrameLive()) RenderFrameCreated(render_frame_host); - })); + }); } private: @@ -802,7 +802,7 @@ DCHECK_EQ(0, waiting_for_layout_dumps_); main_window_->web_contents()->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindLambdaForTesting([&](RenderFrameHost* render_frame_host) { + [&](RenderFrameHost* render_frame_host) { if (!render_frame_host->IsRenderFrameLive()) return; @@ -812,7 +812,7 @@ base::BindOnce(&WebTestControlHost::OnDumpFrameLayoutResponse, weak_factory_.GetWeakPtr(), render_frame_host->GetFrameTreeNodeId())); - })); + }); } if (capture_pixels) { @@ -942,10 +942,10 @@ // Collect all live frames in web_contents. std::vector<RenderFrameHost*> frames; web_contents->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindLambdaForTesting([&](RenderFrameHost* render_frame_host) { + [&](RenderFrameHost* render_frame_host) { if (render_frame_host->IsRenderFrameLive()) frames.push_back(render_frame_host); - })); + }); // Add all of the frames to storage. for (auto* frame : frames) { @@ -1276,13 +1276,13 @@ // Stitch the frame-specific results in the right order. std::string stitched_layout_dump; web_contents()->GetPrimaryMainFrame()->ForEachRenderFrameHost( - base::BindLambdaForTesting([&](RenderFrameHost* render_frame_host) { + [&](RenderFrameHost* render_frame_host) { auto it = frame_to_layout_dump_map_.find( render_frame_host->GetFrameTreeNodeId()); if (it != frame_to_layout_dump_map_.end()) { stitched_layout_dump.append(it->second); } - })); + }); layout_dump_.emplace(std::move(stitched_layout_dump)); ReportResults();
diff --git a/crypto/unexportable_key_win.cc b/crypto/unexportable_key_win.cc index c13f43d..6d09fa4 100644 --- a/crypto/unexportable_key_win.cc +++ b/crypto/unexportable_key_win.cc
@@ -19,6 +19,7 @@ #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/scoped_blocking_call.h" +#include "base/threading/scoped_thread_priority.h" #include "crypto/random.h" #include "crypto/sha2.h" #include "crypto/unexportable_key.h" @@ -85,6 +86,7 @@ continue; } + SCOPED_MAY_LOAD_LIBRARY_AT_BACKGROUND_PRIORITY(); if (!FAILED(NCryptIsAlgSupported(provider, *bcrypto_algo_name, /*flags=*/0))) { return algo; @@ -97,6 +99,7 @@ // GetKeyProperty returns the given NCrypt key property of |key|. absl::optional<std::vector<uint8_t>> GetKeyProperty(NCRYPT_KEY_HANDLE key, LPCWSTR property) { + SCOPED_MAY_LOAD_LIBRARY_AT_BACKGROUND_PRIORITY(); DWORD size; if (FAILED(NCryptGetProperty(key, property, nullptr, 0, &size, 0))) { return absl::nullopt; @@ -115,6 +118,7 @@ // ExportKey returns |key| exported in the given format or nullopt on error. absl::optional<std::vector<uint8_t>> ExportKey(NCRYPT_KEY_HANDLE key, LPCWSTR format) { + SCOPED_MAY_LOAD_LIBRARY_AT_BACKGROUND_PRIORITY(); DWORD output_size; if (FAILED(NCryptExportKey(key, 0, format, nullptr, nullptr, 0, &output_size, 0))) { @@ -254,10 +258,13 @@ // ECDSA. std::vector<uint8_t> sig(64); DWORD sig_size; - if (FAILED(NCryptSignHash(key_.get(), nullptr, digest.data(), digest.size(), - sig.data(), sig.size(), &sig_size, - NCRYPT_SILENT_FLAG))) { - return absl::nullopt; + { + SCOPED_MAY_LOAD_LIBRARY_AT_BACKGROUND_PRIORITY(); + if (FAILED(NCryptSignHash(key_.get(), nullptr, digest.data(), + digest.size(), sig.data(), sig.size(), + &sig_size, NCRYPT_SILENT_FLAG))) { + return absl::nullopt; + } } CHECK_EQ(sig.size(), sig_size); @@ -312,6 +319,7 @@ padding_info.pszAlgId = NCRYPT_SHA256_ALGORITHM; DWORD sig_size; + SCOPED_MAY_LOAD_LIBRARY_AT_BACKGROUND_PRIORITY(); if (FAILED(NCryptSignHash(key_.get(), &padding_info, digest.data(), digest.size(), nullptr, 0, &sig_size, NCRYPT_SILENT_FLAG | BCRYPT_PAD_PKCS1))) { @@ -346,13 +354,16 @@ base::span<const SignatureVerifier::SignatureAlgorithm> acceptable_algorithms) override { ScopedProvider provider; - if (FAILED(NCryptOpenStorageProvider( - ScopedProvider::Receiver(provider).get(), - MS_PLATFORM_CRYPTO_PROVIDER, /*flags=*/0))) { - // If the operation failed then |provider| doesn't have a valid handle in - // it and we shouldn't try to free it. - std::ignore = provider.release(); - return absl::nullopt; + { + SCOPED_MAY_LOAD_LIBRARY_AT_BACKGROUND_PRIORITY(); + if (FAILED(NCryptOpenStorageProvider( + ScopedProvider::Receiver(provider).get(), + MS_PLATFORM_CRYPTO_PROVIDER, /*flags=*/0))) { + // If the operation failed then |provider| doesn't have a valid handle + // in it and we shouldn't try to free it. + std::ignore = provider.release(); + return absl::nullopt; + } } return GetBestSupported(provider.get(), acceptable_algorithms); @@ -365,13 +376,16 @@ FROM_HERE, base::BlockingType::WILL_BLOCK); ScopedProvider provider; - if (FAILED(NCryptOpenStorageProvider( - ScopedProvider::Receiver(provider).get(), - MS_PLATFORM_CRYPTO_PROVIDER, /*flags=*/0))) { - // If the operation failed when |provider| doesn't have a valid handle in - // it and we shouldn't try to free it. - std::ignore = provider.release(); - return nullptr; + { + SCOPED_MAY_LOAD_LIBRARY_AT_BACKGROUND_PRIORITY(); + if (FAILED(NCryptOpenStorageProvider( + ScopedProvider::Receiver(provider).get(), + MS_PLATFORM_CRYPTO_PROVIDER, /*flags=*/0))) { + // If the operation failed when |provider| doesn't have a valid handle + // in it and we shouldn't try to free it. + std::ignore = provider.release(); + return nullptr; + } } absl::optional<SignatureVerifier::SignatureAlgorithm> algo = @@ -381,19 +395,22 @@ } ScopedKey key; - // An empty key name stops the key being persisted to disk. - if (FAILED(NCryptCreatePersistedKey( - provider.get(), ScopedKey::Receiver(key).get(), - BCryptAlgorithmFor(*algo).value(), /*pszKeyName=*/nullptr, - /*dwLegacyKeySpec=*/0, /*dwFlags=*/0))) { - // If the operation failed then |key| doesn't have a valid handle in it - // and we shouldn't try and free it. - std::ignore = key.release(); - return nullptr; - } + { + SCOPED_MAY_LOAD_LIBRARY_AT_BACKGROUND_PRIORITY(); + // An empty key name stops the key being persisted to disk. + if (FAILED(NCryptCreatePersistedKey( + provider.get(), ScopedKey::Receiver(key).get(), + BCryptAlgorithmFor(*algo).value(), /*pszKeyName=*/nullptr, + /*dwLegacyKeySpec=*/0, /*dwFlags=*/0))) { + // If the operation failed then |key| doesn't have a valid handle in it + // and we shouldn't try and free it. + std::ignore = key.release(); + return nullptr; + } - if (FAILED(NCryptFinalizeKey(key.get(), NCRYPT_SILENT_FLAG))) { - return nullptr; + if (FAILED(NCryptFinalizeKey(key.get(), NCRYPT_SILENT_FLAG))) { + return nullptr; + } } const absl::optional<std::vector<uint8_t>> wrapped_key = @@ -431,25 +448,28 @@ FROM_HERE, base::BlockingType::WILL_BLOCK); ScopedProvider provider; - if (FAILED(NCryptOpenStorageProvider( - ScopedProvider::Receiver(provider).get(), - MS_PLATFORM_CRYPTO_PROVIDER, /*flags=*/0))) { - // If the operation failed when |provider| doesn't have a valid handle in - // it and we shouldn't try to free it. - std::ignore = provider.release(); - return nullptr; - } - ScopedKey key; - if (FAILED(NCryptImportKey( - provider.get(), /*hImportKey=*/NULL, BCRYPT_OPAQUE_KEY_BLOB, - /*pParameterList=*/nullptr, ScopedKey::Receiver(key).get(), - const_cast<PBYTE>(wrapped.data()), wrapped.size(), - /*dwFlags=*/NCRYPT_SILENT_FLAG))) { - // If the operation failed then |key| doesn't have a valid handle in it - // and we shouldn't try and free it. - std::ignore = key.release(); - return nullptr; + { + SCOPED_MAY_LOAD_LIBRARY_AT_BACKGROUND_PRIORITY(); + if (FAILED(NCryptOpenStorageProvider( + ScopedProvider::Receiver(provider).get(), + MS_PLATFORM_CRYPTO_PROVIDER, /*flags=*/0))) { + // If the operation failed when |provider| doesn't have a valid handle + // in it and we shouldn't try to free it. + std::ignore = provider.release(); + return nullptr; + } + + if (FAILED(NCryptImportKey( + provider.get(), /*hImportKey=*/NULL, BCRYPT_OPAQUE_KEY_BLOB, + /*pParameterList=*/nullptr, ScopedKey::Receiver(key).get(), + const_cast<PBYTE>(wrapped.data()), wrapped.size(), + /*dwFlags=*/NCRYPT_SILENT_FLAG))) { + // If the operation failed then |key| doesn't have a valid handle in it + // and we shouldn't try and free it. + std::ignore = key.release(); + return nullptr; + } } const absl::optional<std::vector<uint8_t>> algo_bytes =
diff --git a/extensions/browser/api/messaging/extension_message_port.cc b/extensions/browser/api/messaging/extension_message_port.cc index 246f4f5..a69c9a11 100644 --- a/extensions/browser/api/messaging/extension_message_port.cc +++ b/extensions/browser/api/messaging/extension_message_port.cc
@@ -154,20 +154,16 @@ // prerender so make sure `include_child_frames` is only provided for // primary main frames. CHECK(rfh->IsInPrimaryMainFrame()); - rfh->ForEachRenderFrameHost(base::BindRepeating( - [](content::WebContents* tab_web_contents, - ExtensionMessagePort* message_port, content::RenderFrameHost* rfh) { - // RegisterFrame should only be called for frames associated with - // `tab` and not any inner WebContents. - if (content::WebContents::FromRenderFrameHost(rfh) != - tab_web_contents) { - return content::RenderFrameHost::FrameIterationAction:: - kSkipChildren; - } - message_port->RegisterFrame(rfh); - return content::RenderFrameHost::FrameIterationAction::kContinue; - }, - base::Unretained(tab), base::Unretained(this))); + rfh->ForEachRenderFrameHostWithAction([tab, this]( + content::RenderFrameHost* rfh) { + // RegisterFrame should only be called for frames associated with + // `tab` and not any inner WebContents. + if (content::WebContents::FromRenderFrameHost(rfh) != tab) { + return content::RenderFrameHost::FrameIterationAction::kSkipChildren; + } + RegisterFrame(rfh); + return content::RenderFrameHost::FrameIterationAction::kContinue; + }); } else { RegisterFrame(rfh); }
diff --git a/extensions/browser/app_window/app_delegate.h b/extensions/browser/app_window/app_delegate.h index dff0f18..accb09bf 100644 --- a/extensions/browser/app_window/app_delegate.h +++ b/extensions/browser/app_window/app_delegate.h
@@ -16,6 +16,7 @@ namespace blink { namespace mojom { class FileChooserParams; +class WindowFeatures; } } // namespace blink @@ -61,7 +62,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture) = 0; // Feature support.
diff --git a/extensions/browser/app_window/app_window.cc b/extensions/browser/app_window/app_window.cc index dbf392b..f43fa2b1 100644 --- a/extensions/browser/app_window/app_window.cc +++ b/extensions/browser/app_window/app_window.cc
@@ -361,16 +361,17 @@ return helper_->OpenURLFromTab(params); } -void AppWindow::AddNewContents(WebContents* source, - std::unique_ptr<WebContents> new_contents, - const GURL& target_url, - WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, - bool user_gesture, - bool* was_blocked) { +void AppWindow::AddNewContents( + WebContents* source, + std::unique_ptr<WebContents> new_contents, + const GURL& target_url, + WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures& window_features, + bool user_gesture, + bool* was_blocked) { DCHECK(new_contents->GetBrowserContext() == browser_context_); app_delegate_->AddNewContents(browser_context_, std::move(new_contents), - target_url, disposition, initial_rect, + target_url, disposition, window_features, user_gesture); }
diff --git a/extensions/browser/app_window/app_window.h b/extensions/browser/app_window/app_window.h index 1d3b30b..4fc114f 100644 --- a/extensions/browser/app_window/app_window.h +++ b/extensions/browser/app_window/app_window.h
@@ -431,7 +431,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
diff --git a/extensions/browser/content_script_matching_browsertest.cc b/extensions/browser/content_script_matching_browsertest.cc index 32175d1..e97d2051 100644 --- a/extensions/browser/content_script_matching_browsertest.cc +++ b/extensions/browser/content_script_matching_browsertest.cc
@@ -181,7 +181,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override { DCHECK_EQ(tab1_.get(), source);
diff --git a/extensions/browser/extension_host.cc b/extensions/browser/extension_host.cc index 04b9beb..bc24d172 100644 --- a/extensions/browser/extension_host.cc +++ b/extensions/browser/extension_host.cc
@@ -36,6 +36,7 @@ #include "extensions/common/extension_urls.h" #include "extensions/common/feature_switch.h" #include "extensions/common/manifest_handlers/background_info.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/window_open_disposition.h" @@ -368,13 +369,14 @@ return delegate_->GetJavaScriptDialogManager(); } -void ExtensionHost::AddNewContents(WebContents* source, - std::unique_ptr<WebContents> new_contents, - const GURL& target_url, - WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, - bool user_gesture, - bool* was_blocked) { +void ExtensionHost::AddNewContents( + WebContents* source, + std::unique_ptr<WebContents> new_contents, + const GURL& target_url, + WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures& window_features, + bool user_gesture, + bool* was_blocked) { // First, if the creating extension view was associated with a tab contents, // use that tab content's delegate. We must be careful here that the // associated tab contents has the same profile as the new tab contents. In @@ -391,7 +393,7 @@ WebContentsDelegate* delegate = associated_contents->GetDelegate(); if (delegate) { delegate->AddNewContents(associated_contents, std::move(new_contents), - target_url, disposition, initial_rect, + target_url, disposition, window_features, user_gesture, was_blocked); return; } @@ -399,7 +401,7 @@ } delegate_->CreateTab(std::move(new_contents), extension_id_, disposition, - initial_rect, user_gesture); + window_features.bounds, user_gesture); } void ExtensionHost::RenderFrameCreated(content::RenderFrameHost* frame_host) {
diff --git a/extensions/browser/extension_host.h b/extensions/browser/extension_host.h index 35f6735..221d7d3 100644 --- a/extensions/browser/extension_host.h +++ b/extensions/browser/extension_host.h
@@ -138,7 +138,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; void CloseContents(content::WebContents* contents) override;
diff --git a/extensions/browser/extension_web_contents_observer.cc b/extensions/browser/extension_web_contents_observer.cc index f5e2831..e127a57 100644 --- a/extensions/browser/extension_web_contents_observer.cc +++ b/extensions/browser/extension_web_contents_observer.cc
@@ -83,15 +83,13 @@ extension_frame_host_ = CreateExtensionFrameHost(web_contents()); - web_contents()->ForEachRenderFrameHost(base::BindRepeating( - [](ExtensionWebContentsObserver* observer, - content::RenderFrameHost* render_frame_host) { + web_contents()->ForEachRenderFrameHost( + [this](content::RenderFrameHost* render_frame_host) { // We only initialize the frame if the renderer counterpart is live; // otherwise we wait for the RenderFrameCreated notification. if (render_frame_host->IsRenderFrameLive()) - observer->InitializeRenderFrame(render_frame_host); - }, - this)); + InitializeRenderFrame(render_frame_host); + }); // It would be ideal if SessionTabHelper was created before this object, // because then we could start observing it here instead of needing to be @@ -381,14 +379,12 @@ } void ExtensionWebContentsObserver::OnWindowIdChanged(const SessionID& id) { - web_contents()->ForEachRenderFrameHost(base::BindRepeating( - [](int32_t window_id, ExtensionWebContentsObserver* observer, - content::RenderFrameHost* rfh) { - auto* local_frame = observer->GetLocalFrame(rfh); + web_contents()->ForEachRenderFrameHost( + [&id, this](content::RenderFrameHost* rfh) { + auto* local_frame = GetLocalFrame(rfh); if (local_frame) - local_frame->UpdateBrowserWindowId(window_id); - }, - id.id(), base::Unretained(this))); + local_frame->UpdateBrowserWindowId(id.id()); + }); } } // namespace extensions
diff --git a/extensions/browser/guest_view/extension_options/extension_options_guest.cc b/extensions/browser/guest_view/extension_options/extension_options_guest.cc index add3f3f..0549e437 100644 --- a/extensions/browser/guest_view/extension_options/extension_options_guest.cc +++ b/extensions/browser/guest_view/extension_options/extension_options_guest.cc
@@ -143,7 +143,7 @@ std::unique_ptr<WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) { // |new_contents| is potentially used as a non-embedded WebContents, so we @@ -155,7 +155,7 @@ return; embedder_web_contents()->GetDelegate()->AddNewContents( - source, std::move(new_contents), target_url, disposition, initial_rect, + source, std::move(new_contents), target_url, disposition, window_features, user_gesture, was_blocked); }
diff --git a/extensions/browser/guest_view/extension_options/extension_options_guest.h b/extensions/browser/guest_view/extension_options/extension_options_guest.h index f1c47414..33c6e87 100644 --- a/extensions/browser/guest_view/extension_options/extension_options_guest.h +++ b/extensions/browser/guest_view/extension_options/extension_options_guest.h
@@ -45,7 +45,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) final; content::WebContents* OpenURLFromTab(
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc index 3c35de83..54f7286 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest.cc +++ b/extensions/browser/guest_view/web_view/web_view_guest.cc
@@ -70,6 +70,7 @@ #include "third_party/blink/public/common/logging/logging_utils.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" #include "third_party/blink/public/common/page/page_zoom.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" #include "ui/base/models/simple_menu_model.h" #include "ui/events/keycodes/keyboard_codes.h" #include "url/url_constants.h" @@ -112,7 +113,7 @@ } std::string WindowOpenDispositionToString( - WindowOpenDisposition window_open_disposition) { + WindowOpenDisposition window_open_disposition) { switch (window_open_disposition) { case WindowOpenDisposition::IGNORE_ACTION: return "ignore"; @@ -283,9 +284,8 @@ const char WebViewGuest::Type[] = "webview"; // static -int WebViewGuest::GetOrGenerateRulesRegistryID( - int embedder_process_id, - int webview_instance_id) { +int WebViewGuest::GetOrGenerateRulesRegistryID(int embedder_process_id, + int webview_instance_id) { bool is_web_view = embedder_process_id && webview_instance_id; if (!is_web_view) return RulesRegistryService::kDefaultRulesRegistryID; @@ -296,9 +296,8 @@ return it->second; auto* rph = RenderProcessHost::FromID(embedder_process_id); - int rules_registry_id = - RulesRegistryService::Get(rph->GetBrowserContext())-> - GetNextRulesRegistryID(); + int rules_registry_id = RulesRegistryService::Get(rph->GetBrowserContext()) + ->GetNextRulesRegistryID(); web_view_key_to_id_map.Get()[key] = rules_registry_id; return rules_registry_id; } @@ -636,8 +635,7 @@ std::make_pair(new_guest, NewWindowInfo(params.url, std::string()))); // Request permission to show the new window. - RequestNewWindowPermission(params.disposition, - gfx::Rect(), + RequestNewWindowPermission(params.disposition, gfx::Rect(), new_guest->web_contents()); } @@ -1090,8 +1088,8 @@ bool WebViewGuest::HandleKeyboardShortcuts( const content::NativeWebKeyboardEvent& event) { // <webview> outside of Chrome Apps do not handle keyboard shortcuts. - if (!GuestViewManager::FromBrowserContext(browser_context())-> - IsOwnedByExtension(this)) { + if (!GuestViewManager::FromBrowserContext(browser_context()) + ->IsOwnedByExtension(this)) { return false; } @@ -1315,19 +1313,21 @@ return true; } -void WebViewGuest::AddNewContents(WebContents* source, - std::unique_ptr<WebContents> new_contents, - const GURL& target_url, - WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, - bool user_gesture, - bool* was_blocked) { - if (was_blocked) - *was_blocked = false; +void WebViewGuest::AddNewContents( + WebContents* source, + std::unique_ptr<WebContents> new_contents, + const GURL& target_url, + WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures& window_features, + bool user_gesture, + bool* was_blocked) { // This is the guest we created during CreateNewGuestWindow, which we now own. // TODO(erikchen): Fix ownership semantics for WebContents inside this class. // https://crbug.com/832879. - RequestNewWindowPermission(disposition, initial_rect, new_contents.release()); + if (was_blocked) + *was_blocked = false; + RequestNewWindowPermission(disposition, window_features.bounds, + new_contents.release()); } WebContents* WebViewGuest::OpenURLFromTab( @@ -1452,11 +1452,10 @@ base::Unretained(web_contents))); } -void WebViewGuest::LoadURLWithParams( - const GURL& url, - const content::Referrer& referrer, - ui::PageTransition transition_type, - bool force_navigation) { +void WebViewGuest::LoadURLWithParams(const GURL& url, + const content::Referrer& referrer, + ui::PageTransition transition_type, + bool force_navigation) { if (!url.is_valid()) { LoadAbort(true /* is_top_level */, url, net::ERR_INVALID_URL); NavigateGuest(url::kAboutBlankURL, false /* force_navigation */); @@ -1542,21 +1541,19 @@ } GURL WebViewGuest::ResolveURL(const std::string& src) { - if (!GuestViewManager::FromBrowserContext(browser_context())-> - IsOwnedByExtension(this)) { + if (!GuestViewManager::FromBrowserContext(browser_context()) + ->IsOwnedByExtension(this)) { return GURL(src); } - GURL default_url(base::StringPrintf("%s://%s/", - kExtensionScheme, - owner_host().c_str())); + GURL default_url( + base::StringPrintf("%s://%s/", kExtensionScheme, owner_host().c_str())); return default_url.Resolve(src); } -void WebViewGuest::OnWebViewNewWindowResponse( - int new_window_instance_id, - bool allow, - const std::string& user_input) { +void WebViewGuest::OnWebViewNewWindowResponse(int new_window_instance_id, + bool allow, + const std::string& user_input) { auto* guest = WebViewGuest::From( owner_web_contents()->GetPrimaryMainFrame()->GetProcess()->GetID(), new_window_instance_id);
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.h b/extensions/browser/guest_view/web_view/web_view_guest.h index 80f436e..7748695 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest.h +++ b/extensions/browser/guest_view/web_view/web_view_guest.h
@@ -224,7 +224,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) final; content::WebContents* OpenURLFromTab(
diff --git a/extensions/browser/script_executor.cc b/extensions/browser/script_executor.cc index 32c0914..b4774eda 100644 --- a/extensions/browser/script_executor.cc +++ b/extensions/browser/script_executor.cc
@@ -113,8 +113,9 @@ const size_t requested_frame_count = pending_render_frames_.size(); for (size_t i = 0; i < requested_frame_count; ++i) { pending_render_frames_.at(i)->ForEachRenderFrameHost( - base::BindRepeating(&Handler::MaybeAddSubFrame, - base::Unretained(this))); + [this](content::RenderFrameHost* frame) { + MaybeAddSubFrame(frame); + }); } }
diff --git a/extensions/browser/view_type_utils.cc b/extensions/browser/view_type_utils.cc index f668561..cb3ab5e 100644 --- a/extensions/browser/view_type_utils.cc +++ b/extensions/browser/view_type_utils.cc
@@ -45,15 +45,12 @@ ExtensionsBrowserClient::Get()->AttachExtensionTaskManagerTag(tab, type); - auto send_view_type_to_renderer = [](ExtensionWebContentsObserver* ewco, - mojom::ViewType type, - content::RenderFrameHost* frame_host) { - if (mojom::LocalFrame* local_frame = ewco->GetLocalFrame(frame_host)) - local_frame->NotifyRenderViewType(type); - }; if (auto* ewco = ExtensionWebContentsObserver::GetForWebContents(tab)) { tab->ForEachRenderFrameHost( - base::BindRepeating(send_view_type_to_renderer, ewco, type)); + [ewco, type](content::RenderFrameHost* frame_host) { + if (mojom::LocalFrame* local_frame = ewco->GetLocalFrame(frame_host)) + local_frame->NotifyRenderViewType(type); + }); } }
diff --git a/extensions/shell/browser/shell_app_delegate.cc b/extensions/shell/browser/shell_app_delegate.cc index 69d783f..0a7ffbfd 100644 --- a/extensions/shell/browser/shell_app_delegate.cc +++ b/extensions/shell/browser/shell_app_delegate.cc
@@ -54,7 +54,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture) { NOTIMPLEMENTED(); }
diff --git a/extensions/shell/browser/shell_app_delegate.h b/extensions/shell/browser/shell_app_delegate.h index 87825dd..35f7bec 100644 --- a/extensions/shell/browser/shell_app_delegate.h +++ b/extensions/shell/browser/shell_app_delegate.h
@@ -34,7 +34,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture) override; void RunFileChooser(content::RenderFrameHost* render_frame_host, scoped_refptr<content::FileSelectListener> listener,
diff --git a/fuchsia_web/runners/cast/cast_runner_integration_test_cfv1.cc b/fuchsia_web/runners/cast/cast_runner_integration_test_cfv1.cc index 63181c1..6969858 100644 --- a/fuchsia_web/runners/cast/cast_runner_integration_test_cfv1.cc +++ b/fuchsia_web/runners/cast/cast_runner_integration_test_cfv1.cc
@@ -61,7 +61,7 @@ // whether the service capability is still valid. // The second is the test's connection to the shim Runner. RunUntilRequestsReceived(2u); -}; +} // Ensure that CFv1 "shim" mode tears down the Runner component if the // underlying service capability disconnects it. This is required in order to @@ -83,4 +83,4 @@ quit_loop.Run(); }); loop.Run(); -}; +}
diff --git a/fuchsia_web/webengine/browser/frame_impl.cc b/fuchsia_web/webengine/browser/frame_impl.cc index b9e2161..ef6a4b1 100644 --- a/fuchsia_web/webengine/browser/frame_impl.cc +++ b/fuchsia_web/webengine/browser/frame_impl.cc
@@ -438,7 +438,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) { DCHECK_EQ(source, web_contents_.get());
diff --git a/fuchsia_web/webengine/browser/frame_impl.h b/fuchsia_web/webengine/browser/frame_impl.h index 0661fd64..93fb793 100644 --- a/fuchsia_web/webengine/browser/frame_impl.h +++ b/fuchsia_web/webengine/browser/frame_impl.h
@@ -322,7 +322,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; void RequestMediaAccessPermission(
diff --git a/gpu/command_buffer/client/gl_helper.cc b/gpu/command_buffer/client/gl_helper.cc index 0f14a4e..50a13d0 100644 --- a/gpu/command_buffer/client/gl_helper.cc +++ b/gpu/command_buffer/client/gl_helper.cc
@@ -12,6 +12,7 @@ #include <utility> #include "base/bind.h" +#include "base/bits.h" #include "base/callback_helpers.h" #include "base/check_op.h" #include "base/containers/queue.h" @@ -151,6 +152,8 @@ GLenum texture_target, const gfx::Size& dst_size, unsigned char* out, + size_t row_stride_bytes, + bool flip_y, GLenum format, base::OnceCallback<void(bool)> callback); @@ -163,6 +166,7 @@ GLenum format, GLenum type, size_t bytes_per_pixel, + bool flip_y, base::OnceCallback<void(bool)> callback); void ReadbackPlane(const gfx::Size& texture_size, @@ -187,28 +191,31 @@ // must be deleted by the main thread gl. struct Request { Request(const gfx::Size& size_, + size_t bytes_per_pixel_, size_t bytes_per_row_, size_t row_stride_bytes_, unsigned char* pixels_, + bool flip_y_, base::OnceCallback<void(bool)> callback_) - : done(false), - size(size_), + : size(size_), + bytes_per_pixel(bytes_per_pixel_), bytes_per_row(bytes_per_row_), row_stride_bytes(row_stride_bytes_), pixels(pixels_), - callback(std::move(callback_)), - buffer(0), - query(0) {} + flip_y(flip_y_), + callback(std::move(callback_)) {} - bool done; - bool result; + bool done = false; + bool result = false; gfx::Size size; + size_t bytes_per_pixel; size_t bytes_per_row; size_t row_stride_bytes; raw_ptr<unsigned char> pixels; + bool flip_y; base::OnceCallback<void(bool)> callback; - GLuint buffer; - GLuint query; + GLuint buffer = 0; + GLuint query = 0; }; // We must take care to call the callbacks last, as they may @@ -292,7 +299,7 @@ ScopedFramebuffer v_readback_framebuffer_; }; - void ReadbackDone(Request* request, size_t bytes_per_pixel); + void ReadbackDone(Request* request); void FinishRequest(Request* request, bool result, FinishRequestHelper* helper); @@ -346,10 +353,12 @@ GLenum format, GLenum type, size_t bytes_per_pixel, + bool flip_y, base::OnceCallback<void(bool)> callback) { TRACE_EVENT0("gpu.capture", "GLHelper::CopyTextureToImpl::ReadbackAsync"); - Request* request = new Request(dst_size, bytes_per_row, row_stride_bytes, out, - std::move(callback)); + Request* request = + new Request(dst_size, bytes_per_pixel, bytes_per_row, row_stride_bytes, + out, flip_y, std::move(callback)); request_queue_.push(request); request->buffer = 0u; @@ -367,8 +376,8 @@ gl_->EndQueryEXT(GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM); gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0); context_support_->SignalQuery( - request->query, base::BindOnce(&CopyTextureToImpl::ReadbackDone, - AsWeakPtr(), request, bytes_per_pixel)); + request->query, + base::BindOnce(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(), request)); } void GLHelper::CopyTextureToImpl::ReadbackTextureAsync( @@ -376,9 +385,12 @@ GLenum texture_target, const gfx::Size& dst_size, unsigned char* out, + size_t row_stride_bytes, + bool flip_y, GLenum format, base::OnceCallback<void(bool)> callback) { constexpr size_t kBytesPerPixel = 4; + const size_t kBytesPerRow = dst_size.width() * kBytesPerPixel; // Note: It's possible the GL implementation supports other readback // types. However, as of this writing, no caller of this method will @@ -396,14 +408,12 @@ gl_->BindTexture(texture_target, texture); gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture_target, texture, 0); - ReadbackAsync(dst_size, dst_size.width() * kBytesPerPixel, - dst_size.width() * kBytesPerPixel, out, format, - GL_UNSIGNED_BYTE, kBytesPerPixel, std::move(callback)); + ReadbackAsync(dst_size, kBytesPerRow, row_stride_bytes, out, format, + GL_UNSIGNED_BYTE, kBytesPerPixel, flip_y, std::move(callback)); gl_->BindTexture(texture_target, 0); } -void GLHelper::CopyTextureToImpl::ReadbackDone(Request* finished_request, - size_t bytes_per_pixel) { +void GLHelper::CopyTextureToImpl::ReadbackDone(Request* finished_request) { TRACE_EVENT0("gpu.capture", "GLHelper::CopyTextureToImpl::CheckReadbackFramebufferComplete"); finished_request->done = true; @@ -421,21 +431,24 @@ bool result = false; if (request->buffer != 0) { gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, request->buffer); - unsigned char* data = static_cast<unsigned char*>(gl_->MapBufferCHROMIUM( + unsigned char* src = static_cast<unsigned char*>(gl_->MapBufferCHROMIUM( GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, GL_READ_ONLY)); - if (data) { + if (src) { result = true; - if (request->bytes_per_row == request->size.width() * bytes_per_pixel && - request->bytes_per_row == request->row_stride_bytes) { - memcpy(request->pixels, data, - request->size.GetArea() * bytes_per_pixel); - } else { - unsigned char* out = request->pixels; - for (int y = 0; y < request->size.height(); y++) { - memcpy(out, data, request->bytes_per_row); - out += request->row_stride_bytes; - data += request->size.width() * bytes_per_pixel; - } + int dst_stride = base::saturated_cast<int>(request->row_stride_bytes); + int src_stride = base::saturated_cast<int>(request->bytes_per_pixel * + request->size.width()); + size_t bytes_to_copy = + std::min(request->row_stride_bytes, request->bytes_per_row); + unsigned char* dst = request->pixels; + if (request->flip_y && request->size.height() > 1) { + dst += dst_stride * (request->size.height() - 1); + dst_stride = -dst_stride; + } + for (int y = 0; y < request->size.height(); y++) { + memcpy(dst, src, bytes_to_copy); + dst += dst_stride; + src += src_stride; } gl_->UnmapBufferCHROMIUM(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM); } @@ -498,11 +511,14 @@ GLenum texture_target, const gfx::Size& dst_size, unsigned char* out, + size_t row_stride_bytes, + bool flip_y, GLenum format, base::OnceCallback<void(bool)> callback) { InitCopyTextToImpl(); copy_texture_to_impl_->ReadbackTextureAsync(texture, texture_target, dst_size, - out, format, std::move(callback)); + out, row_stride_bytes, flip_y, + format, std::move(callback)); } void GLHelper::InitCopyTextToImpl() { @@ -546,10 +562,14 @@ base::OnceCallback<void(bool)> callback) { const size_t offset = row_stride_bytes * (paste_rect.y() >> size_shift) + (paste_rect.x() >> size_shift); - ReadbackAsync(texture_size, paste_rect.width() >> size_shift, - row_stride_bytes, data + offset, + + // We already flipped rows vertically, converting single RGB plane to + // multiple YUV planes. + const bool kFlipY = false; + size_t bytes_per_row = paste_rect.width() >> size_shift; + ReadbackAsync(texture_size, bytes_per_row, row_stride_bytes, data + offset, (swizzle == kSwizzleBGRA) ? GL_BGRA_EXT : GL_RGBA, - GL_UNSIGNED_BYTE, 4, std::move(callback)); + GL_UNSIGNED_BYTE, 4, kFlipY, std::move(callback)); } I420Converter::I420Converter() = default;
diff --git a/gpu/command_buffer/client/gl_helper.h b/gpu/command_buffer/client/gl_helper.h index 246eb06..6b285e9 100644 --- a/gpu/command_buffer/client/gl_helper.h +++ b/gpu/command_buffer/client/gl_helper.h
@@ -164,6 +164,8 @@ GLenum texture_target, const gfx::Size& dst_size, unsigned char* out, + size_t row_stride_bytes, + bool flip_y, GLenum format, base::OnceCallback<void(bool)> callback);
diff --git a/gpu/command_buffer/client/raster_implementation.cc b/gpu/command_buffer/client/raster_implementation.cc index 04c8e48..cb5c19d 100644 --- a/gpu/command_buffer/client/raster_implementation.cc +++ b/gpu/command_buffer/client/raster_implementation.cc
@@ -372,13 +372,12 @@ } struct RasterImplementation::AsyncARGBReadbackRequest { - AsyncARGBReadbackRequest( - void* dst_pixels, - GLuint dst_size, - GLuint pixels_offset, - GLuint finished_query, - std::unique_ptr<ScopedMappedMemoryPtr> shared_memory, - base::OnceCallback<void(GrSurfaceOrigin, bool)> callback) + AsyncARGBReadbackRequest(void* dst_pixels, + GLuint dst_size, + GLuint pixels_offset, + GLuint finished_query, + std::unique_ptr<ScopedMappedMemoryPtr> shared_memory, + base::OnceCallback<void(bool)> callback) : dst_pixels(dst_pixels), dst_size(dst_size), pixels_offset(pixels_offset), @@ -387,17 +386,13 @@ query(finished_query), done(false), readback_successful(false) {} - ~AsyncARGBReadbackRequest() { - // RasterDecoder::ReadbackImagePixels always stores the result pixels with - // top left origin. - std::move(callback).Run(kTopLeft_GrSurfaceOrigin, readback_successful); - } + ~AsyncARGBReadbackRequest() { std::move(callback).Run(readback_successful); } raw_ptr<void> dst_pixels; GLuint dst_size; GLuint pixels_offset; std::unique_ptr<ScopedMappedMemoryPtr> shared_memory; - base::OnceCallback<void(GrSurfaceOrigin, bool)> callback; + base::OnceCallback<void(bool)> callback; GLuint query; bool done; bool readback_successful; @@ -927,7 +922,6 @@ FlushHelper(); } - void RasterImplementation::FlushHelper() { // Flush our command buffer // (tell the service to execute up to the flush cmd.) @@ -1445,7 +1439,7 @@ GLuint dst_row_bytes, int src_x, int src_y, - base::OnceCallback<void(GrSurfaceOrigin, bool)> readback_done, + base::OnceCallback<void(bool)> readback_done, void* dst_pixels) { DCHECK_GE(dst_row_bytes, dst_info.minRowBytes()); @@ -1477,7 +1471,7 @@ if (!scoped_shared_memory->valid()) { // Note, that this runs callback out of order. if (readback_done) - std::move(readback_done).Run(kTopLeft_GrSurfaceOrigin, /*success=*/false); + std::move(readback_done).Run(/*success=*/false); return; } @@ -1592,7 +1586,7 @@ const SkImageInfo& dst_info, GLuint dst_row_bytes, unsigned char* out, - base::OnceCallback<void(GrSurfaceOrigin, bool)> readback_done) { + base::OnceCallback<void(bool)> readback_done) { TRACE_EVENT0("gpu", "RasterImplementation::ReadbackARGBPixelsAsync"); DCHECK(!!readback_done); // Note: It's possible the GL implementation supports other readback @@ -1601,8 +1595,7 @@ // format). if (dst_info.colorType() != kRGBA_8888_SkColorType && dst_info.colorType() != kBGRA_8888_SkColorType) { - std::move(readback_done) - .Run(kTopLeft_GrSurfaceOrigin, /*readback_sucess=*/false); + std::move(readback_done).Run(/*readback_sucess=*/false); return; } @@ -1618,9 +1611,9 @@ int src_y, void* dst_pixels) { TRACE_EVENT0("gpu", "RasterImplementation::ReadbackImagePixels"); - ReadbackImagePixelsINTERNAL( - source_mailbox, dst_info, dst_row_bytes, src_x, src_y, - base::OnceCallback<void(GrSurfaceOrigin, bool)>(), dst_pixels); + ReadbackImagePixelsINTERNAL(source_mailbox, dst_info, dst_row_bytes, src_x, + src_y, base::OnceCallback<void(bool)>(), + dst_pixels); } void RasterImplementation::ReadbackYUVPixelsAsync(
diff --git a/gpu/command_buffer/client/raster_implementation.h b/gpu/command_buffer/client/raster_implementation.h index a1b47e6..3ae6a767 100644 --- a/gpu/command_buffer/client/raster_implementation.h +++ b/gpu/command_buffer/client/raster_implementation.h
@@ -178,7 +178,8 @@ const SkImageInfo& dst_info, GLuint dst_row_bytes, unsigned char* out, - base::OnceCallback<void(GrSurfaceOrigin, bool)> readback_done) override; + base::OnceCallback<void(bool)> readback_done) override; + void ReadbackYUVPixelsAsync( const gpu::Mailbox& source_mailbox, GLenum source_target, @@ -338,14 +339,13 @@ SyncToken* decode_sync_token, ClientDiscardableHandle handle); - void ReadbackImagePixelsINTERNAL( - const gpu::Mailbox& source_mailbox, - const SkImageInfo& dst_info, - GLuint dst_row_bytes, - int src_x, - int src_y, - base::OnceCallback<void(GrSurfaceOrigin, bool)> readback_done, - void* dst_pixels); + void ReadbackImagePixelsINTERNAL(const gpu::Mailbox& source_mailbox, + const SkImageInfo& dst_info, + GLuint dst_row_bytes, + int src_x, + int src_y, + base::OnceCallback<void(bool)> readback_done, + void* dst_pixels); struct AsyncARGBReadbackRequest; void OnAsyncARGBReadbackDone(AsyncARGBReadbackRequest* request);
diff --git a/gpu/command_buffer/client/raster_implementation_gles.cc b/gpu/command_buffer/client/raster_implementation_gles.cc index 973eec6..d905521 100644 --- a/gpu/command_buffer/client/raster_implementation_gles.cc +++ b/gpu/command_buffer/client/raster_implementation_gles.cc
@@ -267,7 +267,7 @@ const SkImageInfo& dst_info, GLuint dst_row_bytes, unsigned char* out, - base::OnceCallback<void(GrSurfaceOrigin, bool)> readback_done) { + base::OnceCallback<void(bool)> readback_done) { DCHECK(!readback_done.is_null()); DCHECK(dst_info.colorType() == kRGBA_8888_SkColorType || dst_info.colorType() == kBGRA_8888_SkColorType); @@ -278,23 +278,35 @@ BeginSharedImageAccessDirectCHROMIUM( texture_id, GL_SHARED_IMAGE_ACCESS_MODE_READ_CHROMIUM); + // Convert bottom-left GL coordinates to top-left coordinates expected + // by RI clients. + bool flip_y; + switch (src_origin) { + case kTopLeft_GrSurfaceOrigin: + flip_y = false; + break; + case kBottomLeft_GrSurfaceOrigin: + flip_y = true; + break; + } + GetGLHelper()->ReadbackTextureAsync( - texture_id, source_target, dst_gfx_size, out, format, + texture_id, source_target, dst_gfx_size, out, dst_row_bytes, flip_y, + format, base::BindOnce(&RasterImplementationGLES::OnReadARGBPixelsAsync, weak_ptr_factory_.GetWeakPtr(), texture_id, - std::move(readback_done), src_origin)); + std::move(readback_done))); } void RasterImplementationGLES::OnReadARGBPixelsAsync( GLuint texture_id, - base::OnceCallback<void(GrSurfaceOrigin, bool)> readback_done, - GrSurfaceOrigin source_origin, + base::OnceCallback<void(bool)> readback_done, bool success) { DCHECK(texture_id); EndSharedImageAccessDirectCHROMIUM(texture_id); DeleteGpuRasterTexture(texture_id); - std::move(readback_done).Run(source_origin, success); + std::move(readback_done).Run(success); } void RasterImplementationGLES::ReadbackYUVPixelsAsync(
diff --git a/gpu/command_buffer/client/raster_implementation_gles.h b/gpu/command_buffer/client/raster_implementation_gles.h index d153133..c5a81ce4 100644 --- a/gpu/command_buffer/client/raster_implementation_gles.h +++ b/gpu/command_buffer/client/raster_implementation_gles.h
@@ -125,7 +125,7 @@ const SkImageInfo& dst_info, GLuint dst_row_bytes, unsigned char* out, - base::OnceCallback<void(GrSurfaceOrigin, bool)> readback_done) override; + base::OnceCallback<void(bool)> readback_done) override; void ReadbackYUVPixelsAsync( const gpu::Mailbox& source_mailbox, @@ -178,11 +178,9 @@ private: GLHelper* GetGLHelper(); - void OnReadARGBPixelsAsync( - GLuint texture_id, - base::OnceCallback<void(GrSurfaceOrigin, bool)> callback, - GrSurfaceOrigin result_origin, - bool success); + void OnReadARGBPixelsAsync(GLuint texture_id, + base::OnceCallback<void(bool)> callback, + bool success); void OnReadYUVPixelsAsync(GLuint copy_texture_id, base::OnceCallback<void()> on_release_mailbox, base::OnceCallback<void(bool)> readback_done,
diff --git a/gpu/command_buffer/client/raster_interface.h b/gpu/command_buffer/client/raster_interface.h index e814b95..cccd5f2b 100644 --- a/gpu/command_buffer/client/raster_interface.h +++ b/gpu/command_buffer/client/raster_interface.h
@@ -127,11 +127,16 @@ bool needs_mips) = 0; // Starts an asynchronous readback of |source_mailbox| into caller-owned - // memory |out|. Currently supports the kRGBA_8888_SkColorType and - // kBGRA_8888_SkColorType color types. |out| must remain valid - // until |readback_done| is called with the origin of the pixels in |out| and - // a bool indicating if the readback was successful. On success |out| will - // contain the pixel data copied back from the GPU process. + // memory |out|. + // |dst_row_bytes| is a per row stride expected in the |out| buffer. + // |source_origin| specifies texture coordinate directions, but + // pixels in |out| laid out with top-left origin. + // Currently supports the kRGBA_8888_SkColorType and + // kBGRA_8888_SkColorType color types. + // |out| must remain valid until |readback_done| is called with + // a bool indicating if the readback was successful. + // On success |out| will contain the pixel data copied back from the GPU + // process. virtual void ReadbackARGBPixelsAsync( const gpu::Mailbox& source_mailbox, GLenum source_target, @@ -139,7 +144,7 @@ const SkImageInfo& dst_info, GLuint dst_row_bytes, unsigned char* out, - base::OnceCallback<void(GrSurfaceOrigin, bool)> readback_done) = 0; + base::OnceCallback<void(bool)> readback_done) = 0; // Starts an asynchronus readback and translation of RGBA |source_mailbox| // into caller-owned |[yuv]_plane_data|. All provided pointers must remain
diff --git a/gpu/command_buffer/common/shared_image_trace_utils.h b/gpu/command_buffer/common/shared_image_trace_utils.h index 6562a5e..a7efd3f 100644 --- a/gpu/command_buffer/common/shared_image_trace_utils.h +++ b/gpu/command_buffer/common/shared_image_trace_utils.h
@@ -5,13 +5,16 @@ #ifndef GPU_COMMAND_BUFFER_COMMON_SHARED_IMAGE_TRACE_UTILS_H_ #define GPU_COMMAND_BUFFER_COMMON_SHARED_IMAGE_TRACE_UTILS_H_ -#include "base/trace_event/memory_allocator_dump.h" +#include "base/trace_event/memory_allocator_dump_guid.h" #include "gpu/gpu_export.h" namespace gpu { struct Mailbox; +// Generates a memory tracing GUID for `mailbox` to be used for shared +// MemoryAllocatorDump. This allows GPU clients and service to link together +// memory dumps for the shared image. GPU_EXPORT base::trace_event::MemoryAllocatorDumpGuid GetSharedImageGUIDForTracing(const Mailbox& mailbox);
diff --git a/gpu/command_buffer/service/scheduler.cc b/gpu/command_buffer/service/scheduler.cc index 2acd932..d35896e 100644 --- a/gpu/command_buffer/service/scheduler.cc +++ b/gpu/command_buffer/service/scheduler.cc
@@ -53,6 +53,17 @@ default; Scheduler::SchedulingState::~SchedulingState() = default; +Scheduler::ScopedAddWaitingPriority::ScopedAddWaitingPriority( + Scheduler* scheduler, + SequenceId sequence_id, + SchedulingPriority priority) + : scheduler_(scheduler), sequence_id_(sequence_id), priority_(priority) { + scheduler_->AddWaitingPriority(sequence_id_, priority_); +} +Scheduler::ScopedAddWaitingPriority::~ScopedAddWaitingPriority() { + scheduler_->RemoveWaitingPriority(sequence_id_, priority_); +} + void Scheduler::SchedulingState::WriteIntoTrace( perfetto::TracedValue context) const { auto dict = std::move(context).WriteDictionary(); @@ -324,6 +335,8 @@ sequence_id_.GetUnsafeValue(), "new_priority", SchedulingPriorityToString(priority)); + scheduler_->lock_.AssertAcquired(); + waiting_priority_counts_[static_cast<int>(priority)]++; if (priority < current_priority_) { @@ -337,7 +350,7 @@ TRACE_EVENT2("gpu", "Scheduler::Sequence::RemoveWaitingPriority", "sequence_id", sequence_id_.GetUnsafeValue(), "new_priority", SchedulingPriorityToString(priority)); - + scheduler_->lock_.AssertAcquired(); DCHECK(waiting_priority_counts_[static_cast<int>(priority)] > 0); waiting_priority_counts_[static_cast<int>(priority)]--; @@ -538,6 +551,22 @@ return running_sequence->ShouldYieldTo(next_sequence); } +void Scheduler::AddWaitingPriority(SequenceId sequence_id, + SchedulingPriority priority) { + base::AutoLock auto_lock(lock_); + Sequence* sequence = GetSequence(sequence_id); + if (sequence) + sequence->AddWaitingPriority(priority); +} + +void Scheduler::RemoveWaitingPriority(SequenceId sequence_id, + SchedulingPriority priority) { + base::AutoLock auto_lock(lock_); + Sequence* sequence = GetSequence(sequence_id); + if (sequence) + sequence->RemoveWaitingPriority(priority); +} + void Scheduler::SyncTokenFenceReleased(const SyncToken& sync_token, uint32_t order_num, SequenceId release_sequence_id,
diff --git a/gpu/command_buffer/service/scheduler.h b/gpu/command_buffer/service/scheduler.h index 439de2b..49fa27e 100644 --- a/gpu/command_buffer/service/scheduler.h +++ b/gpu/command_buffer/service/scheduler.h
@@ -56,6 +56,19 @@ ReportingCallback report_callback; }; + struct ScopedAddWaitingPriority { + public: + ScopedAddWaitingPriority(Scheduler* scheduler, + SequenceId sequence_id, + SchedulingPriority priority); + ~ScopedAddWaitingPriority(); + + private: + const raw_ptr<Scheduler> scheduler_; + const SequenceId sequence_id_; + const SchedulingPriority priority_; + }; + Scheduler(SyncPointManager* sync_point_manager, const GpuPreferences& gpu_preferences); @@ -349,6 +362,10 @@ base::flat_set<CommandBufferId> client_waits_; }; + void AddWaitingPriority(SequenceId sequence_id, SchedulingPriority priority); + void RemoveWaitingPriority(SequenceId sequence_id, + SchedulingPriority priority); + void SyncTokenFenceReleased(const SyncToken& sync_token, uint32_t order_num, SequenceId release_sequence_id,
diff --git a/gpu/command_buffer/service/shared_image/angle_vulkan_image_backing_factory.cc b/gpu/command_buffer/service/shared_image/angle_vulkan_image_backing_factory.cc index 84a6495..81a740af 100644 --- a/gpu/command_buffer/service/shared_image/angle_vulkan_image_backing_factory.cc +++ b/gpu/command_buffer/service/shared_image/angle_vulkan_image_backing_factory.cc
@@ -156,31 +156,6 @@ NOTREACHED(); } - void OnMemoryDump(const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, - base::trace_event::ProcessMemoryDump* pmd, - uint64_t client_tracing_id) override { - if (auto tracing_id = GrBackendTextureTracingID(backend_texture_)) { - // Add a |service_guid| which expresses shared ownership between the - // various GPU dumps. - auto client_guid = GetSharedImageGUIDForTracing(mailbox()); - auto service_guid = gl::GetGLTextureServiceGUIDForTracing(tracing_id); - pmd->CreateSharedGlobalAllocatorDump(service_guid); - - std::string format_dump_name = - base::StringPrintf("%s/format=%d", dump_name.c_str(), format()); - base::trace_event::MemoryAllocatorDump* format_dump = - pmd->CreateAllocatorDump(format_dump_name); - format_dump->AddScalar( - base::trace_event::MemoryAllocatorDump::kNameSize, - base::trace_event::MemoryAllocatorDump::kUnitsBytes, - static_cast<uint64_t>(EstimatedSizeForMemTracking())); - - int importance = 2; // This client always owns the ref. - pmd->AddOwnershipEdge(client_guid, service_guid, importance); - } - } - std::unique_ptr<GLTexturePassthroughImageRepresentation> ProduceGLTexturePassthrough(SharedImageManager* manager, MemoryTypeTracker* tracker) override {
diff --git a/gpu/command_buffer/service/shared_image/compound_image_backing.cc b/gpu/command_buffer/service/shared_image/compound_image_backing.cc index f5f135f..9c8eca1 100644 --- a/gpu/command_buffer/service/shared_image/compound_image_backing.cc +++ b/gpu/command_buffer/service/shared_image/compound_image_backing.cc
@@ -6,6 +6,7 @@ #include "base/logging.h" #include "base/memory/scoped_refptr.h" +#include "base/trace_event/memory_allocator_dump_guid.h" #include "base/trace_event/process_memory_dump.h" #include "components/viz/common/resources/resource_format.h" #include "components/viz/common/resources/resource_format_utils.h" @@ -50,6 +51,15 @@ return true; } +// Unique GUIDs for child backings. +base::trace_event::MemoryAllocatorDumpGuid GetSubBackingGUIDForTracing( + const Mailbox& mailbox, + int backing_index) { + return base::trace_event::MemoryAllocatorDumpGuid( + base::StringPrintf("gpu-shared-image/%s/sub-backing/%d", + mailbox.ToDebugString().c_str(), backing_index)); +} + } // namespace // Wrapped representation types are not in the anonymous namespace because they @@ -306,17 +316,19 @@ } auto shm_backing = std::make_unique<SharedMemoryImageBacking>( - gpu::Mailbox(), format, size, color_space, surface_origin, alpha_type, + mailbox, format, size, color_space, surface_origin, alpha_type, SHARED_IMAGE_USAGE_CPU_WRITE, std::move(shm_wrapper)); + shm_backing->SetNotReferencedCounted(); auto gpu_backing = gpu_backing_factory->CreateSharedImage( - gpu::Mailbox(), format, surface_handle, size, color_space, surface_origin, + mailbox, format, surface_handle, size, color_space, surface_origin, alpha_type, usage | SHARED_IMAGE_USAGE_CPU_UPLOAD, /*is_thread_safe=*/false); if (!gpu_backing) { DLOG(ERROR) << "Failed to create GPU backing"; return nullptr; } + gpu_backing->SetNotReferencedCounted(); return std::make_unique<CompoundImageBacking>( mailbox, format, size, color_space, surface_origin, alpha_type, usage, @@ -469,11 +481,42 @@ void CompoundImageBacking::OnMemoryDump( const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, + base::trace_event::MemoryAllocatorDumpGuid client_guid, base::trace_event::ProcessMemoryDump* pmd, uint64_t client_tracing_id) { - shm_backing_.get()->OnMemoryDump(dump_name, dump, pmd, client_tracing_id); - gpu_backing_->OnMemoryDump(dump_name, dump, pmd, client_tracing_id); + // Create dump but don't add scalar size. The size will be inferred from the + // sizes of the sub-backings. + base::trace_event::MemoryAllocatorDump* dump = + pmd->CreateAllocatorDump(dump_name); + + dump->AddString("type", "", GetName()); + dump->AddString("dimensions", "", size().ToString()); + dump->AddString("format", "", viz::ResourceFormatToString(format())); + dump->AddString("usage", "", CreateLabelForSharedImageUsage(usage())); + + // Add ownership edge to `client_guid` which expresses shared ownership with + // the client process for the top level dump. + pmd->CreateSharedGlobalAllocatorDump(client_guid); + pmd->AddOwnershipEdge(dump->guid(), client_guid, kNonOwningEdgeImportance); + + // Add dumps nested under `dump_name` for child backings owned by compound + // image. These get different shared GUIDs to add ownership edges with GPU + // texture or shared memory. + auto shm_client_guid = GetSubBackingGUIDForTracing(mailbox(), 1); + std::string shm_dump_name = + base::StringPrintf("%s/shared_memory", dump_name.c_str()); + shm_backing_->OnMemoryDump(shm_dump_name, shm_client_guid, pmd, + client_tracing_id); + + auto gpu_client_guid = GetSubBackingGUIDForTracing(mailbox(), 2); + std::string gpu_dump_name = base::StringPrintf("%s/gpu", dump_name.c_str()); + gpu_backing_->OnMemoryDump(gpu_dump_name, gpu_client_guid, pmd, + client_tracing_id); +} + +size_t CompoundImageBacking::EstimatedSizeForMemTracking() const { + return shm_backing_->EstimatedSizeForMemTracking() + + gpu_backing_->EstimatedSizeForMemTracking(); } } // namespace gpu
diff --git a/gpu/command_buffer/service/shared_image/compound_image_backing.h b/gpu/command_buffer/service/shared_image/compound_image_backing.h index 71a04d4..3bd6bab 100644 --- a/gpu/command_buffer/service/shared_image/compound_image_backing.h +++ b/gpu/command_buffer/service/shared_image/compound_image_backing.h
@@ -105,9 +105,10 @@ friend class CompoundImageBackingTest; void OnMemoryDump(const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, + base::trace_event::MemoryAllocatorDumpGuid client_guid, base::trace_event::ProcessMemoryDump* pmd, uint64_t client_tracing_id) override; + size_t EstimatedSizeForMemTracking() const override; std::unique_ptr<SharedImageBacking> shm_backing_; std::unique_ptr<SharedImageBacking> gpu_backing_;
diff --git a/gpu/command_buffer/service/shared_image/d3d_image_backing.cc b/gpu/command_buffer/service/shared_image/d3d_image_backing.cc index 9a7eab4..de2ff26 100644 --- a/gpu/command_buffer/service/shared_image/d3d_image_backing.cc +++ b/gpu/command_buffer/service/shared_image/d3d_image_backing.cc
@@ -682,19 +682,20 @@ #endif // BUILDFLAG(USE_DAWN) } -void D3DImageBacking::OnMemoryDump(const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, - base::trace_event::ProcessMemoryDump* pmd, - uint64_t client_tracing_id) { +void D3DImageBacking::OnMemoryDump( + const std::string& dump_name, + base::trace_event::MemoryAllocatorDumpGuid client_guid, + base::trace_event::ProcessMemoryDump* pmd, + uint64_t client_tracing_id) { + SharedImageBacking::OnMemoryDump(dump_name, client_guid, pmd, + client_tracing_id); + // Add a |service_guid| which expresses shared ownership between the // various GPU dumps. - auto client_guid = GetSharedImageGUIDForTracing(mailbox()); base::trace_event::MemoryAllocatorDumpGuid service_guid = gl::GetGLTextureServiceGUIDForTracing(gl_texture_->service_id()); pmd->CreateSharedGlobalAllocatorDump(service_guid); - - int importance = 2; // This client always owns the ref. - pmd->AddOwnershipEdge(client_guid, service_guid, importance); + pmd->AddOwnershipEdge(client_guid, service_guid, kOwningEdgeImportance); // Swap chain textures only have one level backed by an image. GetGLImage()->OnMemoryDump(pmd, client_tracing_id, dump_name);
diff --git a/gpu/command_buffer/service/shared_image/d3d_image_backing.h b/gpu/command_buffer/service/shared_image/d3d_image_backing.h index b656816..7be0e49 100644 --- a/gpu/command_buffer/service/shared_image/d3d_image_backing.h +++ b/gpu/command_buffer/service/shared_image/d3d_image_backing.h
@@ -116,7 +116,7 @@ WGPUDevice device, WGPUBackendType backend_type) override; void OnMemoryDump(const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, + base::trace_event::MemoryAllocatorDumpGuid client_guid, base::trace_event::ProcessMemoryDump* pmd, uint64_t client_tracing_id) override;
diff --git a/gpu/command_buffer/service/shared_image/gl_image_backing.cc b/gpu/command_buffer/service/shared_image/gl_image_backing.cc index 2b8605b..47fa643 100644 --- a/gpu/command_buffer/service/shared_image/gl_image_backing.cc +++ b/gpu/command_buffer/service/shared_image/gl_image_backing.cc
@@ -455,19 +455,20 @@ return image_->GetNativePixmap(); } -void GLImageBacking::OnMemoryDump(const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, - base::trace_event::ProcessMemoryDump* pmd, - uint64_t client_tracing_id) { +void GLImageBacking::OnMemoryDump( + const std::string& dump_name, + base::trace_event::MemoryAllocatorDumpGuid client_guid, + base::trace_event::ProcessMemoryDump* pmd, + uint64_t client_tracing_id) { + SharedImageBacking::OnMemoryDump(dump_name, client_guid, pmd, + client_tracing_id); + // Add a |service_guid| which expresses shared ownership between the // various GPU dumps. - auto client_guid = GetSharedImageGUIDForTracing(mailbox()); if (auto service_id = GetGLServiceId()) { auto service_guid = gl::GetGLTextureServiceGUIDForTracing(GetGLServiceId()); pmd->CreateSharedGlobalAllocatorDump(service_guid); - // TODO(piman): coalesce constant with TextureManager::DumpTextureRef. - int importance = 2; // This client always owns the ref. - pmd->AddOwnershipEdge(client_guid, service_guid, importance); + pmd->AddOwnershipEdge(client_guid, service_guid, kOwningEdgeImportance); } image_->OnMemoryDump(pmd, client_tracing_id, dump_name); }
diff --git a/gpu/command_buffer/service/shared_image/gl_image_backing.h b/gpu/command_buffer/service/shared_image/gl_image_backing.h index d179099..103ad1af 100644 --- a/gpu/command_buffer/service/shared_image/gl_image_backing.h +++ b/gpu/command_buffer/service/shared_image/gl_image_backing.h
@@ -203,7 +203,7 @@ // SharedImageBacking: scoped_refptr<gfx::NativePixmap> GetNativePixmap() override; void OnMemoryDump(const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, + base::trace_event::MemoryAllocatorDumpGuid client_guid, base::trace_event::ProcessMemoryDump* pmd, uint64_t client_tracing_id) override; SharedImageBackingType GetType() const override;
diff --git a/gpu/command_buffer/service/shared_image/gl_texture_image_backing.cc b/gpu/command_buffer/service/shared_image/gl_texture_image_backing.cc index b7927e8..0a13761 100644 --- a/gpu/command_buffer/service/shared_image/gl_texture_image_backing.cc +++ b/gpu/command_buffer/service/shared_image/gl_texture_image_backing.cc
@@ -122,15 +122,17 @@ void GLTextureImageBacking::OnMemoryDump( const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, + base::trace_event::MemoryAllocatorDumpGuid client_guid, base::trace_event::ProcessMemoryDump* pmd, uint64_t client_tracing_id) { - const auto client_guid = GetSharedImageGUIDForTracing(mailbox()); + SharedImageBacking::OnMemoryDump(dump_name, client_guid, pmd, + client_tracing_id); + if (!IsPassthrough()) { const auto service_guid = gl::GetGLTextureServiceGUIDForTracing(texture_->service_id()); pmd->CreateSharedGlobalAllocatorDump(service_guid); - pmd->AddOwnershipEdge(client_guid, service_guid, /* importance */ 2); + pmd->AddOwnershipEdge(client_guid, service_guid, kOwningEdgeImportance); texture_->DumpLevelMemory(pmd, client_tracing_id, dump_name); } }
diff --git a/gpu/command_buffer/service/shared_image/gl_texture_image_backing.h b/gpu/command_buffer/service/shared_image/gl_texture_image_backing.h index a1938fd..6f585cb2 100644 --- a/gpu/command_buffer/service/shared_image/gl_texture_image_backing.h +++ b/gpu/command_buffer/service/shared_image/gl_texture_image_backing.h
@@ -42,7 +42,7 @@ private: // SharedImageBacking: void OnMemoryDump(const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, + base::trace_event::MemoryAllocatorDumpGuid client_guid, base::trace_event::ProcessMemoryDump* pmd, uint64_t client_tracing_id) override; SharedImageBackingType GetType() const override;
diff --git a/gpu/command_buffer/service/shared_image/raw_draw_image_backing.cc b/gpu/command_buffer/service/shared_image/raw_draw_image_backing.cc index 640f1f0..a03267e 100644 --- a/gpu/command_buffer/service/shared_image/raw_draw_image_backing.cc +++ b/gpu/command_buffer/service/shared_image/raw_draw_image_backing.cc
@@ -143,32 +143,30 @@ void RawDrawImageBacking::OnMemoryDump( const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, + base::trace_event::MemoryAllocatorDumpGuid client_guid, base::trace_event::ProcessMemoryDump* pmd, uint64_t client_tracing_id) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); AutoLock auto_lock(this); + + SharedImageBacking::OnMemoryDump(dump_name, client_guid, pmd, + client_tracing_id); + if (auto tracing_id = GrBackendTextureTracingID(backend_texture_)) { // Add a |service_guid| which expresses shared ownership between the // various GPU dumps. - auto client_guid = GetSharedImageGUIDForTracing(mailbox()); auto service_guid = gl::GetGLTextureServiceGUIDForTracing(tracing_id); pmd->CreateSharedGlobalAllocatorDump(service_guid); - - std::string format_dump_name = - base::StringPrintf("%s/format=%d", dump_name.c_str(), format()); - base::trace_event::MemoryAllocatorDump* format_dump = - pmd->CreateAllocatorDump(format_dump_name); - format_dump->AddScalar( - base::trace_event::MemoryAllocatorDump::kNameSize, - base::trace_event::MemoryAllocatorDump::kUnitsBytes, - static_cast<uint64_t>(EstimatedSize(format(), size()))); - - int importance = 2; // This client always owns the ref. - pmd->AddOwnershipEdge(client_guid, service_guid, importance); + pmd->AddOwnershipEdge(client_guid, service_guid, kOwningEdgeImportance); } } +size_t RawDrawImageBacking::EstimatedSizeForMemTracking() const { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + AutoLock auto_lock(this); + return backend_texture_.isValid() ? EstimatedSize(format(), size()) : 0u; +} + std::unique_ptr<RasterImageRepresentation> RawDrawImageBacking::ProduceRaster( SharedImageManager* manager, MemoryTypeTracker* tracker) { @@ -227,6 +225,9 @@ } promise_texture_ = SkPromiseImageTexture::Make(backend_texture_); + // TODO(crbug.com/1353911): The estimated size recorded with GPU memory + // tracker should be updated after `backend_texture_` is allocated. + auto surface = SkSurface::MakeFromBackendTexture( context_state_->gr_context(), backend_texture_, surface_origin(), final_msaa_count_, sk_color, color_space().ToSkColorSpace(),
diff --git a/gpu/command_buffer/service/shared_image/raw_draw_image_backing.h b/gpu/command_buffer/service/shared_image/raw_draw_image_backing.h index 1cb6998a..225bfd9 100644 --- a/gpu/command_buffer/service/shared_image/raw_draw_image_backing.h +++ b/gpu/command_buffer/service/shared_image/raw_draw_image_backing.h
@@ -37,9 +37,10 @@ bool ProduceLegacyMailbox(MailboxManager* mailbox_manager) override; void Update(std::unique_ptr<gfx::GpuFence> in_fence) override; void OnMemoryDump(const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, + base::trace_event::MemoryAllocatorDumpGuid client_guid, base::trace_event::ProcessMemoryDump* pmd, uint64_t client_tracing_id) override; + size_t EstimatedSizeForMemTracking() const override; protected: std::unique_ptr<RasterImageRepresentation> ProduceRaster(
diff --git a/gpu/command_buffer/service/shared_image/shared_image_backing.cc b/gpu/command_buffer/service/shared_image/shared_image_backing.cc index 8737f2d..b3577fbf 100644 --- a/gpu/command_buffer/service/shared_image/shared_image_backing.cc +++ b/gpu/command_buffer/service/shared_image/shared_image_backing.cc
@@ -5,8 +5,11 @@ #include "gpu/command_buffer/service/shared_image/shared_image_backing.h" #include "base/notreached.h" +#include "base/trace_event/process_memory_dump.h" #include "build/build_config.h" #include "components/viz/common/resources/resource_format_utils.h" +#include "gpu/command_buffer/common/shared_image_trace_utils.h" +#include "gpu/command_buffer/common/shared_image_usage.h" #include "gpu/command_buffer/service/memory_tracking.h" #include "gpu/command_buffer/service/shared_context_state.h" #include "gpu/command_buffer/service/shared_image/shared_image_factory.h" @@ -105,10 +108,24 @@ void SharedImageBacking::OnMemoryDump( const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, + base::trace_event::MemoryAllocatorDumpGuid client_guid, base::trace_event::ProcessMemoryDump* pmd, uint64_t client_tracing_id) { - NOTIMPLEMENTED(); + base::trace_event::MemoryAllocatorDump* dump = + pmd->CreateAllocatorDump(dump_name); + dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, + base::trace_event::MemoryAllocatorDump::kUnitsBytes, + EstimatedSizeForMemTracking()); + + dump->AddString("type", "", GetName()); + dump->AddString("dimensions", "", size().ToString()); + dump->AddString("format", "", viz::ResourceFormatToString(format())); + dump->AddString("usage", "", CreateLabelForSharedImageUsage(usage())); + + // Add ownership edge to `client_guid` which expresses shared ownership with + // the client process. + pmd->CreateSharedGlobalAllocatorDump(client_guid); + pmd->AddOwnershipEdge(dump->guid(), client_guid, kNonOwningEdgeImportance); } std::unique_ptr<GLTextureImageRepresentation> @@ -177,8 +194,14 @@ } #endif +void SharedImageBacking::SetNotReferencedCounted() { + DCHECK(!HasAnyRefs()); + is_ref_counted_ = false; +} + void SharedImageBacking::AddRef(SharedImageRepresentation* representation) { AutoLock auto_lock(this); + DCHECK(is_ref_counted_); bool first_ref = refs_.empty(); refs_.push_back(representation); @@ -190,6 +213,7 @@ void SharedImageBacking::ReleaseRef(SharedImageRepresentation* representation) { AutoLock auto_lock(this); + DCHECK(is_ref_counted_); auto found = std::find(refs_.begin(), refs_.end(), representation); DCHECK(found != refs_.end());
diff --git a/gpu/command_buffer/service/shared_image/shared_image_backing.h b/gpu/command_buffer/service/shared_image/shared_image_backing.h index ce81623..2a7ff7a 100644 --- a/gpu/command_buffer/service/shared_image/shared_image_backing.h +++ b/gpu/command_buffer/service/shared_image/shared_image_backing.h
@@ -14,6 +14,7 @@ #include "base/metrics/histogram_macros.h" #include "base/synchronization/lock.h" #include "base/threading/thread_checker.h" +#include "base/trace_event/memory_allocator_dump_guid.h" #include "build/build_config.h" #include "components/viz/common/resources/resource_format.h" #include "gpu/command_buffer/common/mailbox.h" @@ -30,7 +31,6 @@ namespace base { namespace trace_event { class ProcessMemoryDump; -class MemoryAllocatorDump; } // namespace trace_event } // namespace base @@ -99,11 +99,17 @@ const Mailbox& mailbox() const { return mailbox_; } size_t estimated_size() const { return estimated_size_; } bool is_thread_safe() const { return !!lock_; } + bool is_ref_counted() const { return is_ref_counted_; } + void OnContextLost(); // Creates SkImageInfo matching backing size, format, alpha and color space. SkImageInfo AsSkImageInfo() const; + // Disables reference counting for backing. No references should be added, + // either before or after this is called. + void SetNotReferencedCounted(); + // Concrete functions to manage a ref count. void AddRef(SharedImageRepresentation* representation); void ReleaseRef(SharedImageRepresentation* representation); @@ -151,12 +157,16 @@ virtual void MarkForDestruction() {} - // Allows the backing to attach additional data to the dump or dump - // additional sub paths. - virtual void OnMemoryDump(const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, - base::trace_event::ProcessMemoryDump* pmd, - uint64_t client_tracing_id); + // Produces a MemoryAllocatorDump with `dump_name` and creates a shared + // ownership edge to `client_guid`. Subclasses can extend this function to + // add additional ownership edges linked to `client_guid` but they must call + // SharedImageBacking::OnMemoryDump() first (or do something equivalent) to + // create a MemoryAllocatorDump and ownership edge. + virtual void OnMemoryDump( + const std::string& dump_name, + base::trace_event::MemoryAllocatorDumpGuid client_guid, + base::trace_event::ProcessMemoryDump* pmd, + uint64_t client_tracing_id); // Prepares the backing for use with the legacy mailbox system. // TODO(ericrk): Remove this once the new codepath is complete. @@ -181,6 +191,10 @@ friend class SharedImageManager; friend class CompoundImageBacking; + // Memory dump importance values for shared ownership edges. + static constexpr int kNonOwningEdgeImportance = 0; + static constexpr int kOwningEdgeImportance = 2; + virtual std::unique_ptr<GLTextureImageRepresentation> ProduceGLTexture( SharedImageManager* manager, MemoryTypeTracker* tracker); @@ -277,6 +291,8 @@ const uint32_t usage_; const size_t estimated_size_; + bool is_ref_counted_ = true; + raw_ptr<SharedImageFactory> factory_ = nullptr; // Bound to the thread on which the backing is created. The |factory_|
diff --git a/gpu/command_buffer/service/shared_image/shared_image_factory.cc b/gpu/command_buffer/service/shared_image/shared_image_factory.cc index 01473b3..aeb8bfaa 100644 --- a/gpu/command_buffer/service/shared_image/shared_image_factory.cc +++ b/gpu/command_buffer/service/shared_image/shared_image_factory.cc
@@ -674,11 +674,11 @@ bool SharedImageFactory::OnMemoryDump( const base::trace_event::MemoryDumpArgs& args, base::trace_event::ProcessMemoryDump* pmd, - int client_id, + const std::string& dump_base_name, uint64_t client_tracing_id) { for (const auto& shared_image : shared_images_) { - shared_image_manager_->OnMemoryDump(shared_image->mailbox(), pmd, client_id, - client_tracing_id); + shared_image_manager_->OnMemoryDump(shared_image->mailbox(), pmd, + dump_base_name, client_tracing_id); } return true;
diff --git a/gpu/command_buffer/service/shared_image/shared_image_factory.h b/gpu/command_buffer/service/shared_image/shared_image_factory.h index 5e02995..dfeb767 100644 --- a/gpu/command_buffer/service/shared_image/shared_image_factory.h +++ b/gpu/command_buffer/service/shared_image/shared_image_factory.h
@@ -116,7 +116,7 @@ bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, base::trace_event::ProcessMemoryDump* pmd, - int client_id, + const std::string& dump_base_name, uint64_t client_tracing_id); bool RegisterBacking(std::unique_ptr<SharedImageBacking> backing, bool allow_legacy_mailbox);
diff --git a/gpu/command_buffer/service/shared_image/shared_image_manager.cc b/gpu/command_buffer/service/shared_image/shared_image_manager.cc index b944f0b..4e9214f 100644 --- a/gpu/command_buffer/service/shared_image/shared_image_manager.cc +++ b/gpu/command_buffer/service/shared_image/shared_image_manager.cc
@@ -16,8 +16,8 @@ #include "base/trace_event/process_memory_dump.h" #include "base/trace_event/trace_event.h" #include "build/build_config.h" +#include "components/viz/common/resources/resource_format_utils.h" #include "gpu/command_buffer/common/shared_image_trace_utils.h" -#include "gpu/command_buffer/common/shared_image_usage.h" #include "gpu/command_buffer/service/shared_context_state.h" #include "gpu/command_buffer/service/shared_image/shared_image_representation.h" #include "ui/gl/trace_util.h" @@ -396,7 +396,7 @@ void SharedImageManager::OnMemoryDump(const Mailbox& mailbox, base::trace_event::ProcessMemoryDump* pmd, - int client_id, + const std::string& dump_base_name, uint64_t client_tracing_id) { CALLED_ON_VALID_THREAD(); @@ -414,31 +414,16 @@ return; // Unique name in the process. - std::string dump_name = - base::StringPrintf("gpu/shared_images/client_0x%" PRIX32 "/mailbox_%s", - client_id, mailbox.ToDebugString().c_str()); + std::string dump_name = base::StringPrintf( + "%s/mailbox_%s", dump_base_name.c_str(), mailbox.ToDebugString().c_str()); - base::trace_event::MemoryAllocatorDump* dump = - pmd->CreateAllocatorDump(dump_name); - dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, - base::trace_event::MemoryAllocatorDump::kUnitsBytes, - estimated_size); - // Usage is optional, but |CreateLabelForSharedImageUsage()| expects one to be - // set. - if (backing->usage()) { - dump->AddString("usage", "", - CreateLabelForSharedImageUsage(backing->usage())); - } - // Add a mailbox guid which expresses shared ownership with the client - // process. - // This must match the client-side. - auto client_guid = GetSharedImageGUIDForTracing(mailbox); - pmd->CreateSharedGlobalAllocatorDump(client_guid); - pmd->AddOwnershipEdge(dump->guid(), client_guid); + // GUID which expresses shared ownership with the client process. This must + // match the client-side GUID for mailbox. + auto client_guid = GetSharedImageGUIDForTracing(backing->mailbox()); - // Allow the SharedImageBacking to attach additional data to the dump - // or dump additional sub-paths. - backing->OnMemoryDump(dump_name, dump, pmd, client_tracing_id); + // Backing will produce dump with relevant information along with ownership + // edge to `client_guid`. + backing->OnMemoryDump(dump_name, client_guid, pmd, client_tracing_id); } scoped_refptr<gfx::NativePixmap> SharedImageManager::GetNativePixmap(
diff --git a/gpu/command_buffer/service/shared_image/shared_image_manager.h b/gpu/command_buffer/service/shared_image/shared_image_manager.h index 5b4a42c..a32fdda 100644 --- a/gpu/command_buffer/service/shared_image/shared_image_manager.h +++ b/gpu/command_buffer/service/shared_image/shared_image_manager.h
@@ -101,7 +101,7 @@ // Dump memory for the given mailbox. void OnMemoryDump(const Mailbox& mailbox, base::trace_event::ProcessMemoryDump* pmd, - int client_id, + const std::string& dump_base_name, uint64_t client_tracing_id); bool is_thread_safe() const { return !!lock_; }
diff --git a/gpu/command_buffer/service/shared_image/shared_image_representation.cc b/gpu/command_buffer/service/shared_image/shared_image_representation.cc index 55ba754..bb73504 100644 --- a/gpu/command_buffer/service/shared_image/shared_image_representation.cc +++ b/gpu/command_buffer/service/shared_image/shared_image_representation.cc
@@ -27,9 +27,7 @@ // TODO(hitawala): Rewrite the reference counting so that // SharedImageRepresentation does not need manager and manager attaches to // backing in Register(). - // If mailbox is zero this is owned by a compound backing and not reference - // counted. - if (manager_ && !backing_->mailbox().IsZero()) { + if (manager_ && backing_->is_ref_counted()) { backing_->AddRef(this); } } @@ -39,9 +37,7 @@ // error is. CHECK(!has_scoped_access_) << "Destroying a SharedImageRepresentation with " "outstanding Scoped*Access objects."; - // If mailbox is zero this is owned by a compound backing and not reference - // counted. - if (manager_ && !backing_->mailbox().IsZero()) { + if (manager_ && backing_->is_ref_counted()) { manager_->OnRepresentationDestroyed(backing_->mailbox(), this); } }
diff --git a/gpu/command_buffer/service/shared_image/shared_memory_image_backing.cc b/gpu/command_buffer/service/shared_image/shared_memory_image_backing.cc index 809a4253..20a6225 100644 --- a/gpu/command_buffer/service/shared_image/shared_memory_image_backing.cc +++ b/gpu/command_buffer/service/shared_image/shared_memory_image_backing.cc
@@ -149,16 +149,18 @@ void SharedMemoryImageBacking::OnMemoryDump( const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, + base::trace_event::MemoryAllocatorDumpGuid client_guid, base::trace_event::ProcessMemoryDump* pmd, uint64_t client_tracing_id) { + SharedImageBacking::OnMemoryDump(dump_name, client_guid, pmd, + client_tracing_id); + // Add a |shared_memory_guid| which expresses shared ownership between the // various GPU dumps. auto shared_memory_guid = shared_memory_wrapper_.GetMappingGuid(); if (!shared_memory_guid.is_empty()) { - auto client_guid = GetSharedImageGUIDForTracing(mailbox()); pmd->CreateSharedMemoryOwnershipEdge(client_guid, shared_memory_guid, - 0 /* importance */); + kNonOwningEdgeImportance); } }
diff --git a/gpu/command_buffer/service/shared_image/shared_memory_image_backing.h b/gpu/command_buffer/service/shared_image/shared_memory_image_backing.h index 48e52063..6822a43a 100644 --- a/gpu/command_buffer/service/shared_image/shared_memory_image_backing.h +++ b/gpu/command_buffer/service/shared_image/shared_memory_image_backing.h
@@ -71,7 +71,7 @@ private: void OnMemoryDump(const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, + base::trace_event::MemoryAllocatorDumpGuid client_guid, base::trace_event::ProcessMemoryDump* pmd, uint64_t client_tracing_id) override;
diff --git a/gpu/command_buffer/service/shared_image/test_image_backing.h b/gpu/command_buffer/service/shared_image/test_image_backing.h index a9db0e859..84a8527 100644 --- a/gpu/command_buffer/service/shared_image/test_image_backing.h +++ b/gpu/command_buffer/service/shared_image/test_image_backing.h
@@ -45,7 +45,7 @@ bool UploadFromMemory(const SkPixmap& pixmap) override; bool ProduceLegacyMailbox(MailboxManager* mailbox_manager) override; void OnMemoryDump(const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, + base::trace_event::MemoryAllocatorDumpGuid client_guid, base::trace_event::ProcessMemoryDump* pmd, uint64_t client_tracing_id) override {}
diff --git a/gpu/command_buffer/service/shared_image/wrapped_sk_image_backing_factory.cc b/gpu/command_buffer/service/shared_image/wrapped_sk_image_backing_factory.cc index 9f30728..e35760c 100644 --- a/gpu/command_buffer/service/shared_image/wrapped_sk_image_backing_factory.cc +++ b/gpu/command_buffer/service/shared_image/wrapped_sk_image_backing_factory.cc
@@ -164,27 +164,17 @@ } void OnMemoryDump(const std::string& dump_name, - base::trace_event::MemoryAllocatorDump* dump, + base::trace_event::MemoryAllocatorDumpGuid client_guid, base::trace_event::ProcessMemoryDump* pmd, uint64_t client_tracing_id) override { + SharedImageBacking::OnMemoryDump(dump_name, client_guid, pmd, + client_tracing_id); + // Add a |service_guid| which expresses shared ownership between the // various GPU dumps. - auto client_guid = GetSharedImageGUIDForTracing(mailbox()); auto service_guid = gl::GetGLTextureServiceGUIDForTracing(tracing_id_); pmd->CreateSharedGlobalAllocatorDump(service_guid); - - std::string format_dump_name = - base::StringPrintf("%s/format=%d", dump_name.c_str(), format()); - base::trace_event::MemoryAllocatorDump* format_dump = - pmd->CreateAllocatorDump(format_dump_name); - format_dump->AddScalar( - base::trace_event::MemoryAllocatorDump::kNameSize, - base::trace_event::MemoryAllocatorDump::kUnitsBytes, - static_cast<uint64_t>(EstimatedSizeForMemTracking())); - - // TODO(piman): coalesce constant with TextureManager::DumpTextureRef. - int importance = 2; // This client always owns the ref. - pmd->AddOwnershipEdge(client_guid, service_guid, importance); + pmd->AddOwnershipEdge(client_guid, service_guid, kOwningEdgeImportance); } SkColorType GetSkColorType() {
diff --git a/gpu/command_buffer/tests/gl_helper_unittest.cc b/gpu/command_buffer/tests/gl_helper_unittest.cc index 570e9e3..8081969 100644 --- a/gpu/command_buffer/tests/gl_helper_unittest.cc +++ b/gpu/command_buffer/tests/gl_helper_unittest.cc
@@ -677,14 +677,10 @@ SkImageInfo::Make(scaled_size.width(), scaled_size.height(), kRGBA_8888_SkColorType, kPremul_SkAlphaType)); - EXPECT_TRUE( - ReadBackTexture(dst_texture, scaled_size, - static_cast<unsigned char*>(output_pixels.getPixels()), - kRGBA_8888_SkColorType)); - if (flip_output) { - // Flip the pixels back. - FlipSKBitmap(&output_pixels); - } + EXPECT_TRUE(ReadBackTexture( + dst_texture, scaled_size, + static_cast<unsigned char*>(output_pixels.getPixels()), + output_pixels.rowBytes(), flip_output, kRGBA_8888_SkColorType)); // If the bitmap shouldn't have changed - compare against input. if (source_rect == gfx::Rect(scaled_size)) { @@ -766,10 +762,10 @@ entire_output_size.width(), entire_output_size.height(), kRGBA_8888_SkColorType, kPremul_SkAlphaType)); - EXPECT_TRUE( - ReadBackTexture(dst_texture, entire_output_size, - static_cast<unsigned char*>(entire_output.getPixels()), - kRGBA_8888_SkColorType)); + EXPECT_TRUE(ReadBackTexture( + dst_texture, entire_output_size, + static_cast<unsigned char*>(entire_output.getPixels()), + entire_output.rowBytes(), /*flip_y=*/false, kRGBA_8888_SkColorType)); const std::string human_readable_test_params = base::StringPrintf( "scale from: %s " @@ -812,7 +808,7 @@ EXPECT_TRUE(ReadBackTexture( dst_texture, patch_size, static_cast<unsigned char*>(patch_output.getPixels()), - kRGBA_8888_SkColorType)); + patch_output.rowBytes(), /*flip_y=*/false, kRGBA_8888_SkColorType)); SkBitmap expected; SkIRect expected_subrect{patch_rect.x(), patch_rect.y(), patch_rect.right(), patch_rect.bottom()}; @@ -856,6 +852,7 @@ EXPECT_TRUE(ReadBackTexture( dst_texture, patch_size, static_cast<unsigned char*>(patch_output.getPixels()), + patch_output.rowBytes(), /*flip_y=*/false, kRGBA_8888_SkColorType)); Compare(&expected, &patch_output, 2, test_bitmap.get(), stages, "METHOD2 " + human_readable_test_params + @@ -1008,6 +1005,8 @@ bool ReadBackTexture(GLuint src_texture, const gfx::Size& src_size, unsigned char* pixels, + size_t pixels_stride, + bool flip_y, SkColorType color_type) { DCHECK(color_type == kRGBA_8888_SkColorType || color_type == kBGRA_8888_SkColorType); @@ -1020,7 +1019,8 @@ format = GL_BGRA_EXT; helper_->ReadbackTextureAsync( - src_texture, GL_TEXTURE_2D, src_size, pixels, format, + src_texture, GL_TEXTURE_2D, src_size, pixels, pixels_stride, flip_y, + format, base::BindOnce( [](bool* success, base::OnceClosure callback, bool result) { *success = result; @@ -1051,7 +1051,9 @@ // When the readback is over output bitmap should have the red color. output_pixels.eraseColor(SK_ColorGREEN); uint8_t* pixels = static_cast<uint8_t*>(output_pixels.getPixels()); - if (!ReadBackTexture(src_texture, src_size, pixels, color_type) || + if (!ReadBackTexture(src_texture, src_size, pixels, + output_pixels.rowBytes(), /*flip_y=*/false, + color_type) || !IsEqual(input_pixels, output_pixels)) { LOG(ERROR) << "Bitmap comparison failure Pattern-1"; return false; @@ -1063,7 +1065,9 @@ src_grid_pitch, src_grid_width, input_pixels); BindAndAttachTextureWithPixels(src_texture, color_type, src_size, input_pixels); - if (!ReadBackTexture(src_texture, src_size, pixels, color_type) || + if (!ReadBackTexture(src_texture, src_size, pixels, + output_pixels.rowBytes(), /*flip_y=*/false, + color_type) || !IsEqual(input_pixels, output_pixels)) { LOG(ERROR) << "Bitmap comparison failure Pattern-2"; return false; @@ -1073,7 +1077,9 @@ rect_w, rect_h, input_pixels); BindAndAttachTextureWithPixels(src_texture, color_type, src_size, input_pixels); - if (!ReadBackTexture(src_texture, src_size, pixels, color_type) || + if (!ReadBackTexture(src_texture, src_size, pixels, + output_pixels.rowBytes(), /*flip_y=*/false, + color_type) || !IsEqual(input_pixels, output_pixels)) { LOG(ERROR) << "Bitmap comparison failure Pattern-3"; return false;
diff --git a/gpu/config/gpu_finch_features.cc b/gpu/config/gpu_finch_features.cc index ced976d..4cbe33f8 100644 --- a/gpu/config/gpu_finch_features.cc +++ b/gpu/config/gpu_finch_features.cc
@@ -145,7 +145,7 @@ // Enables the use of out of process rasterization for canvas. const base::Feature kCanvasOopRasterization { "CanvasOopRasterization", -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || \ +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || \ (BUILDFLAG(IS_MAC) && defined(ARCH_CPU_ARM64)) || BUILDFLAG(IS_FUCHSIA) base::FEATURE_ENABLED_BY_DEFAULT #else
diff --git a/gpu/ipc/service/shared_image_stub.cc b/gpu/ipc/service/shared_image_stub.cc index 6d779c8..b70273b1 100644 --- a/gpu/ipc/service/shared_image_stub.cc +++ b/gpu/ipc/service/shared_image_stub.cc
@@ -549,10 +549,11 @@ if (!factory_) return true; + std::string dump_name = + base::StringPrintf("gpu/shared_images/client_0x%" PRIX32, ClientId()); + if (args.level_of_detail == base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND) { - std::string dump_name = - base::StringPrintf("gpu/shared_images/client_0x%" PRIX32, ClientId()); base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, @@ -562,7 +563,7 @@ return true; } - return factory_->OnMemoryDump(args, pmd, ClientId(), ClientTracingId()); + return factory_->OnMemoryDump(args, pmd, dump_name, ClientTracingId()); } SharedImageStub::SharedImageDestructionCallback
diff --git a/gpu/vulkan/vulkan_device_queue.cc b/gpu/vulkan/vulkan_device_queue.cc index 45049c7..6c9396ca 100644 --- a/gpu/vulkan/vulkan_device_queue.cc +++ b/gpu/vulkan/vulkan_device_queue.cc
@@ -47,6 +47,8 @@ DCHECK_EQ(static_cast<VkDevice>(VK_NULL_HANDLE), owned_vk_device_); DCHECK_EQ(static_cast<VkDevice>(VK_NULL_HANDLE), vk_device_); DCHECK_EQ(static_cast<VkQueue>(VK_NULL_HANDLE), vk_queue_); + DCHECK_EQ(static_cast<VmaAllocator>(VK_NULL_HANDLE), owned_vma_allocator_); + DCHECK_EQ(static_cast<VmaAllocator>(VK_NULL_HANDLE), vma_allocator_); if (VK_NULL_HANDLE == vk_instance_) return false; @@ -302,7 +304,9 @@ VK_MAX_MEMORY_HEAPS, heap_memory_limit ? heap_memory_limit : VK_WHOLE_SIZE); vma::CreateAllocator(vk_physical_device_, vk_device_, vk_instance_, - heap_size_limit.data(), &vma_allocator_); + heap_size_limit.data(), &owned_vma_allocator_); + vma_allocator_ = owned_vma_allocator_; + cleanup_helper_ = std::make_unique<VulkanFenceHelper>(this); allow_protected_memory_ = allow_protected_memory; @@ -318,6 +322,7 @@ DCHECK_EQ(static_cast<VkDevice>(VK_NULL_HANDLE), owned_vk_device_); DCHECK_EQ(static_cast<VkDevice>(VK_NULL_HANDLE), vk_device_); DCHECK_EQ(static_cast<VkQueue>(VK_NULL_HANDLE), vk_queue_); + DCHECK_EQ(static_cast<VmaAllocator>(VK_NULL_HANDLE), owned_vma_allocator_); vk_physical_device_ = vk_physical_device; vk_device_ = vk_device; @@ -325,8 +330,11 @@ vk_queue_index_ = vk_queue_index; enabled_extensions_ = std::move(enabled_extensions); - vma::CreateAllocator(vk_physical_device_, vk_device_, vk_instance_, nullptr, - &vma_allocator_); + if (vma_allocator_ == VK_NULL_HANDLE) { + vma::CreateAllocator(vk_physical_device_, vk_device_, vk_instance_, nullptr, + &owned_vma_allocator_); + vma_allocator_ = owned_vma_allocator_; + } cleanup_helper_ = std::make_unique<VulkanFenceHelper>(this); return true; @@ -391,7 +399,8 @@ VkQueue vk_queue, uint32_t vk_queue_index, gfx::ExtensionSet enabled_extensions, - const VkPhysicalDeviceFeatures2& vk_physical_device_features2) { + const VkPhysicalDeviceFeatures2& vk_physical_device_features2, + VmaAllocator vma_allocator) { // Currently VulkanDeviceQueue for drdc thread(aka CompositorGpuThread) uses // the same vulkan queue as the gpu main thread. Now since both gpu main and // drdc threads would be accessing/submitting work to the same queue, all the @@ -407,6 +416,9 @@ GetVulkanFunctionPointers()->per_queue_lock_map[vk_queue] = std::make_unique<base::Lock>(); enabled_device_features_2_ = vk_physical_device_features2; + + // Note that CompositorGpuThread uses same vma allocator as gpu main thread. + vma_allocator_ = vma_allocator; return InitCommon(vk_physical_device, vk_device, vk_queue, vk_queue_index, enabled_extensions); } @@ -417,12 +429,12 @@ cleanup_helper_.reset(); } - if (vma_allocator_ != VK_NULL_HANDLE) { - vma::DestroyAllocator(vma_allocator_); - vma_allocator_ = VK_NULL_HANDLE; + if (owned_vma_allocator_ != VK_NULL_HANDLE) { + vma::DestroyAllocator(owned_vma_allocator_); + owned_vma_allocator_ = VK_NULL_HANDLE; } - if (VK_NULL_HANDLE != owned_vk_device_) { + if (owned_vk_device_ != VK_NULL_HANDLE) { vkDestroyDevice(owned_vk_device_, nullptr); owned_vk_device_ = VK_NULL_HANDLE; @@ -439,6 +451,7 @@ vk_queue_ = VK_NULL_HANDLE; vk_queue_index_ = 0; vk_physical_device_ = VK_NULL_HANDLE; + vma_allocator_ = VK_NULL_HANDLE; } std::unique_ptr<VulkanCommandPool> VulkanDeviceQueue::CreateCommandPool() {
diff --git a/gpu/vulkan/vulkan_device_queue.h b/gpu/vulkan/vulkan_device_queue.h index fb19191..35ad1bf 100644 --- a/gpu/vulkan/vulkan_device_queue.h +++ b/gpu/vulkan/vulkan_device_queue.h
@@ -71,7 +71,8 @@ VkQueue vk_queue, uint32_t vk_queue_index, gfx::ExtensionSet enabled_extensions, - const VkPhysicalDeviceFeatures2& vk_physical_device_features2); + const VkPhysicalDeviceFeatures2& vk_physical_device_features2, + VmaAllocator vma_allocator); const gfx::ExtensionSet& enabled_extensions() const { return enabled_extensions_; @@ -146,6 +147,7 @@ uint32_t vk_queue_index_ = 0; VkInstance vk_instance_ = VK_NULL_HANDLE; raw_ptr<VulkanInstance> instance_ = nullptr; + VmaAllocator owned_vma_allocator_ = VK_NULL_HANDLE; VmaAllocator vma_allocator_ = VK_NULL_HANDLE; std::unique_ptr<VulkanFenceHelper> cleanup_helper_; VkPhysicalDeviceFeatures2 enabled_device_features_2_{
diff --git a/headless/lib/browser/DEPS b/headless/lib/browser/DEPS index aba14f0..07c36fc 100644 --- a/headless/lib/browser/DEPS +++ b/headless/lib/browser/DEPS
@@ -39,6 +39,7 @@ ], "headless_web_contents_impl.cc": [ "+components/printing/browser/print_to_pdf", + "+third_party/blink/public/mojom/window_features", ], "headless_select_file_dialog_factory.*": [ "+ui/shell_dialogs",
diff --git a/headless/lib/browser/headless_web_contents_impl.cc b/headless/lib/browser/headless_web_contents_impl.cc index aa48857..1c1425f 100644 --- a/headless/lib/browser/headless_web_contents_impl.cc +++ b/headless/lib/browser/headless_web_contents_impl.cc
@@ -44,6 +44,7 @@ #include "headless/lib/browser/protocol/headless_handler.h" #include "printing/buildflags/buildflags.h" #include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/base/ui_base_features.h" @@ -119,7 +120,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override { DCHECK(new_contents->GetBrowserContext() == @@ -134,7 +135,9 @@ const gfx::Rect default_rect( headless_web_contents_->browser()->options()->window_size); - const gfx::Rect rect = initial_rect.IsEmpty() ? default_rect : initial_rect; + const gfx::Rect rect = window_features.bounds.IsEmpty() + ? default_rect + : window_features.bounds; raw_child_contents->SetBounds(rect); } @@ -278,13 +281,11 @@ // We want to iterate all frame trees because RenderFrameCreated gets called // for any RenderFrame created. base::Unretained is safe here because // ForEachRenderFrameHost is synchronous. - child->web_contents_->ForEachRenderFrameHost(base::BindRepeating( - [](HeadlessWebContentsImpl* child, - content::RenderFrameHost* render_frame_host) { + child->web_contents_->ForEachRenderFrameHost( + [&child](content::RenderFrameHost* render_frame_host) { if (render_frame_host->IsRenderFrameLive()) child->RenderFrameCreated(render_frame_host); - }, - child.get())); + }); return child; }
diff --git a/infra/config/generated/builders/ci/ios16-sdk-simulator/properties.json b/infra/config/generated/builders/ci/ios16-sdk-simulator/properties.json index a7e9bb75..8e113c5 100644 --- a/infra/config/generated/builders/ci/ios16-sdk-simulator/properties.json +++ b/infra/config/generated/builders/ci/ios16-sdk-simulator/properties.json
@@ -59,5 +59,5 @@ }, "builder_group": "chromium.fyi", "recipe": "chromium", - "xcode_build_version": "14a5294e" + "xcode_build_version": "14a5294g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios16-sdk-simulator/properties.json b/infra/config/generated/builders/try/ios16-sdk-simulator/properties.json index 0347bc18..e949e1f 100644 --- a/infra/config/generated/builders/try/ios16-sdk-simulator/properties.json +++ b/infra/config/generated/builders/try/ios16-sdk-simulator/properties.json
@@ -53,5 +53,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5294e" + "xcode_build_version": "14a5294g" } \ No newline at end of file
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index a1e7375..b07d3e8 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -33780,8 +33780,8 @@ '}' execution_timeout_secs: 36000 caches { - name: "xcode_ios_14a5294e" - path: "xcode_ios_14a5294e.app" + name: "xcode_ios_14a5294g" + path: "xcode_ios_14a5294g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -66907,8 +66907,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5294e" - path: "xcode_ios_14a5294e.app" + name: "xcode_ios_14a5294g" + path: "xcode_ios_14a5294g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com"
diff --git a/infra/config/lib/builders.star b/infra/config/lib/builders.star index bead632..de784296 100644 --- a/infra/config/lib/builders.star +++ b/infra/config/lib/builders.star
@@ -188,7 +188,7 @@ # Xcode14 beta 5 will be used to build Main iOS x14main = xcode_enum("14a5294e"), # A newer Xcode 14 version used on beta bots. - x14betabots = xcode_enum("14a5294e"), + x14betabots = xcode_enum("14a5294g"), # in use by ios-webkit-tot x13wk = xcode_enum("13a1030dwk"), )
diff --git a/infra/config/lib/orchestrator.star b/infra/config/lib/orchestrator.star index e97f58d7..1dfef159 100644 --- a/infra/config/lib/orchestrator.star +++ b/infra/config/lib/orchestrator.star
@@ -24,6 +24,19 @@ # Nodes for the definition of a compilator builder _COMPILATOR = nodes.create_node_type_with_builder_ref("compilator") +# We want to be able to set up experimental orchestrator builders that mirror an +# orchestrator without having to set up a separate pool of compilators, so this +# provides a means of doing so that can't is unlikely to be done inadvertently. +# Experimental orchestrators must have the same properties as the +# non-experimental orchestrator associated with the compilator. +# +# The keys are the bucket-qualified name of a compilator (e.g. +# "try/linux-rel-compilator"), with the values being a container of +# bucket-qualified names of the experimental orchestrators that can use the +# compilator. +_EXPERIMENTAL_ORCHESTRATOR_NAMES_BY_COMPILATOR_NAME = { +} + def register_orchestrator(bucket, name, builder_group, compilator): key = _ORCHESTRATOR.add(bucket, name, props = { "bucket": bucket, @@ -105,10 +118,19 @@ if not node: return None + compilator_name = _builder_name(node) + orchestrator_nodes = [] for r in graph.parents(node.key, _COMPILATOR.ref_kind): orchestrator_nodes.extend(graph.parents(r.key, _ORCHESTRATOR.kind)) + experimental_orchestrator_names = _EXPERIMENTAL_ORCHESTRATOR_NAMES_BY_COMPILATOR_NAME.get(compilator_name, ()) + orchestrator_nodes = [ + n + for n in orchestrator_nodes + if _builder_name(n) not in experimental_orchestrator_names + ] + if len(orchestrator_nodes) != 1: fail("compilator should have exactly 1 referring orchestrator, got: {}".format( _builder_name(node), @@ -116,12 +138,18 @@ )) return struct( - name = _builder_name(node), + name = compilator_name, builder = builder, bucket = bucket_name, simple_name = builder.name, ) +def _builder_link(builder_details): + return "<a href=\"{}\">{}</a>".format( + builder_url(builder_details.bucket, builder_details.simple_name), + builder_details.simple_name, + ) + def _get_orchestrators_and_compilators(ctx): """Get the details of the orchestrator and compilator builders. @@ -129,12 +157,16 @@ fail will be called if they don't satisfy the necessary constraints. Returns: - A 2-tuple: - * A list of details for orchestrator builders. See the return value of - _get_orchestrator for more information. - * A dict mapping bucket-qualified name (e.g. "try/linux-rel-compilator") - of compilator builders to the details for that builder. See the return + A list where each element is a struct for a compilator with the + attributes: + * compilator: The details for the compilator. See the return value of _get_compilator for more information. + * orchestrator: The details for the non-experimental orchestrator + associated with the compilator. See the return value of + _get_orchestrator for more information. + * experimental_orchestrators: A list of details for any experimental + orchestrators associated with the compilator. See the return value of + _get_orchestrator for more information. """ cfg = None for f in ctx.output: @@ -144,29 +176,47 @@ if cfg == None: fail("There is no buildbucket configuration file to update properties") - orchestrators = [] - compilator_by_name = {} + compilators = [] + orchestrators_by_compilator_name = {} + experimental_orchestrators_by_compilator_name = {} for bucket in cfg.buckets: bucket_name = bucket.name for builder in bucket.swarming.builders: compilator = _get_compilator(bucket_name, builder) if compilator: - compilator_by_name[compilator.name] = compilator + compilators.append(compilator) continue orchestrator = _get_orchestrator(bucket_name, builder) if orchestrator: - orchestrators.append(orchestrator) + compilator_name = orchestrator.compilator_name + if orchestrator.name in _EXPERIMENTAL_ORCHESTRATOR_NAMES_BY_COMPILATOR_NAME.get(compilator_name, ()): + experimental_orchestrators_by_compilator_name.setdefault(compilator_name, []).append(orchestrator) + else: + orchestrators_by_compilator_name[compilator_name] = orchestrator - return orchestrators, compilator_by_name + return [struct( + compilator = c, + orchestrator = orchestrators_by_compilator_name[c.name], + experimental_orchestrators = experimental_orchestrators_by_compilator_name.get(c.name, []), + ) for c in compilators] def _set_orchestrator_properties(ctx): - orchestrators, compilators_by_name = _get_orchestrators_and_compilators(ctx) - for orchestrator in orchestrators: + details = _get_orchestrators_and_compilators(ctx) + for d in details: + orchestrator = d.orchestrator orchestrator_properties = json.decode(orchestrator.builder.properties) - compilator = compilators_by_name[orchestrator.compilator_name] + for o in d.experimental_orchestrators: + o_properties = json.decode(o.builder.properties) + if o_properties != orchestrator_properties: + message = ["experimental orchestrator {!r} must have properties equal to those of {!r}".format(o.name, orchestrator.name)] + message.append("properties of {!r}: {}".format(o.name, json.indent(json.encode(o_properties), indent = 2))) + message.append("properties of {!r}: {}".format(orchestrator.name, json.indent(json.encode(orchestrator_properties), indent = 2))) + fail("\n".join(message)) + + compilator = d.compilator compilator_properties = dict(orchestrator_properties) compilator_properties.update(json.decode(compilator.builder.properties)) compilator.builder.properties = json.encode(compilator_properties) @@ -183,14 +233,23 @@ "compilator": compilator.simple_name, "compilator_watcher_git_revision": _COMPILATOR_WATCHER_GIT_REVISION, } - orchestrator.builder.properties = json.encode(orchestrator_properties) + encoded_orchestrator_properties = json.encode(orchestrator_properties) + orchestrator.builder.properties = encoded_orchestrator_properties _update_description( orchestrator.builder, ("This is the orchestrator half of an orchestrator + compilator pair of builders." + - " The compilator is <a href=\"{}\">{}</a>.".format( - builder_url(compilator.bucket, compilator.simple_name), - compilator.simple_name, - )), + " The compilator is {}.".format(_builder_link(compilator))), ) + for o in d.experimental_orchestrators: + o.builder.properties = encoded_orchestrator_properties + _update_description( + o.builder, + "This is an experimental orchestrator making use of compilator {}.".format(_builder_link(compilator)), + ) + _update_description( + compilator.builder, + "It is also the compilator for experimental orchestrator {}.".format(_builder_link(o)), + ) + lucicfg.generator(_set_orchestrator_properties)
diff --git a/ios/chrome/browser/flags/about_flags.mm b/ios/chrome/browser/flags/about_flags.mm index 704b6bb..28de182 100644 --- a/ios/chrome/browser/flags/about_flags.mm +++ b/ios/chrome/browser/flags/about_flags.mm
@@ -1057,6 +1057,10 @@ {"omnibox-https-upgrades", flag_descriptions::kOmniboxHttpsUpgradesName, flag_descriptions::kOmniboxHttpsUpgradesDescription, flags_ui::kOsIos, FEATURE_VALUE_TYPE(omnibox::kDefaultTypedNavigationsToHttps)}, + {"smart-sorting-new-destinations", + flag_descriptions::kSmartSortingNewDestinationsName, + flag_descriptions::kSmartSortingNewDestinationsDescription, + flags_ui::kOsIos, FEATURE_VALUE_TYPE(kSmartSortingNewDestinations)}, {"smart-sorting-new-overflow-menu", flag_descriptions::kSmartSortingNewOverflowMenuName, flag_descriptions::kSmartSortingNewOverflowMenuDescription,
diff --git a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc index 8b51231..2c2207af 100644 --- a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc +++ b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc
@@ -624,6 +624,11 @@ "Annotates web forms with Autofill field type predictions as placeholder " "text."; +const char kSmartSortingNewDestinationsName[] = + "Smart Sorting new destinations added to the overflow menu."; +const char kSmartSortingNewDestinationsDescription[] = + "Enables smart sorting new destinations added to the overflow menu."; + const char kSmartSortingNewOverflowMenuName[] = "Smart Sorting the new Overflow Menu"; const char kSmartSortingNewOverflowMenuDescription[] =
diff --git a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h index fcd0b25..1107594c 100644 --- a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h +++ b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h
@@ -567,6 +567,11 @@ extern const char kShowAutofillTypePredictionsName[]; extern const char kShowAutofillTypePredictionsDescription[]; +// Title and description for the flag to enable smart sorting new destinations +// added to the overflow menu. +extern const char kSmartSortingNewDestinationsName[]; +extern const char kSmartSortingNewDestinationsDescription[]; + // Title and description for the flag to enable smart sorting the new overflow // menu. extern const char kSmartSortingNewOverflowMenuName[];
diff --git a/ios/chrome/browser/ui/popup_menu/overflow_menu/feature_flags.h b/ios/chrome/browser/ui/popup_menu/overflow_menu/feature_flags.h index 9f35d0a8..ff1ecf56 100644 --- a/ios/chrome/browser/ui/popup_menu/overflow_menu/feature_flags.h +++ b/ios/chrome/browser/ui/popup_menu/overflow_menu/feature_flags.h
@@ -22,6 +22,10 @@ // Feature to enable smart sorting the new overflow menu. extern const base::Feature kSmartSortingNewOverflowMenu; +// Feature to enable smart sorting new destinations added to the new overflow +// menu. +extern const base::Feature kSmartSortingNewDestinations; + // Feature to add a "Share Chrome App" action to the overflow menu extern const base::Feature kNewOverflowMenuShareChromeAction; @@ -43,6 +47,9 @@ // Whether the new Google Password Manager branding is enabled. bool IsPasswordManagerBrandingUpdateEnabled(); +// Whether smart sorting for new destinations is enabled. +bool IsSmartSortingNewDestinationsEnabled(); + // Whether smart sorting the new overflow menu is enabled. bool IsSmartSortingNewOverflowMenuEnabled();
diff --git a/ios/chrome/browser/ui/popup_menu/overflow_menu/feature_flags.mm b/ios/chrome/browser/ui/popup_menu/overflow_menu/feature_flags.mm index 493cfc15..52885b1 100644 --- a/ios/chrome/browser/ui/popup_menu/overflow_menu/feature_flags.mm +++ b/ios/chrome/browser/ui/popup_menu/overflow_menu/feature_flags.mm
@@ -25,6 +25,9 @@ const base::Feature kSmartSortingNewOverflowMenu{ "kSmartSortingNewOverflowMenu", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kSmartSortingNewDestinations{ + "SmartSortingNewDestinations", base::FEATURE_DISABLED_BY_DEFAULT}; + const base::Feature kNewOverflowMenuShareChromeAction{ "kNewOverflowMenuShareChromeAction", base::FEATURE_DISABLED_BY_DEFAULT}; @@ -61,6 +64,11 @@ return false; } +bool IsSmartSortingNewDestinationsEnabled() { + return IsSmartSortingNewOverflowMenuEnabled() && + base::FeatureList::IsEnabled(kSmartSortingNewDestinations); +} + bool IsSmartSortingNewOverflowMenuEnabled() { return IsNewOverflowMenuEnabled() && base::FeatureList::IsEnabled(kSmartSortingNewOverflowMenu);
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 index 9dc810cc..6a0e48cc0 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -c8fa523c5be19caedcb30309b37ea96adc673785 \ No newline at end of file +cd55353fe397f0ce6f11c6f83a8a29bfb8fe82cf \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 index 7f51aae..f1d9683 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -f01a41b543379faf34c271f39cc37b537827103b \ No newline at end of file +e4c7d86dbb61261692912552d739b5c3d5860762 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 index d3442b7e..1175f1d 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -c811c91643039bfc59c98dda3623b267c787facd \ No newline at end of file +8bd703066ead68c28f0e932f49d8382fa568e947 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 index e663c1d..fa96c04 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -44cc04e450b4325b9cb289337a3990daac31b228 \ No newline at end of file +e3de4c67a6af987197c7b17857c88fefd74b07e4 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 index c7c2c88..cdecaeb 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -6472eb12a0bab9b8dc61c6f50f858c2268ed2a90 \ No newline at end of file +5a882f272b14c24227a1cec74ddd8aa94bb067a5 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 index ff7cc4c..6fb4e78 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -83dc14d3e4aed93b3402519b37da62a77c5e04db \ No newline at end of file +62a63e78758dee6c34d8619ff97023778d0cf6c4 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 index 0a7cdd3c..a23a163b 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -3f3c45fe7f9c9fd63ea1428e6764f75727488a72 \ No newline at end of file +30a1984f104154e3fba7de15bfea65cdf1adfab6 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 index ea448a98..85fcf40 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -a65f1e8b34a0762064210562bfb45218375b3b66 \ No newline at end of file +22fb101fb7794aeb1761127e750e18cfdfe95284 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 index af910e8..b384956b 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -59eea02b89b972cdea8476d043ff737120f64c00 \ No newline at end of file +2026e6191430a49706e46683a1d1d3007d2da1fe \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 index 7bdfd4ee..61c02d91 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -c1cbfa97520fbc4307559b06256af483ea4ca21e \ No newline at end of file +9f3b08af60be55eab2b12a214431efa27454a4bb \ No newline at end of file
diff --git a/media/base/supported_types.cc b/media/base/supported_types.cc index c2efcdbb..287af88e 100644 --- a/media/base/supported_types.cc +++ b/media/base/supported_types.cc
@@ -205,7 +205,8 @@ return false; #if BUILDFLAG(ENABLE_PLATFORM_HEVC) -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || \ + BUILDFLAG(IS_MAC) #if BUILDFLAG(IS_CHROMEOS_LACROS) // TODO(b/171813538): For Lacros, the supplemental profile cache will be // asking lacros-gpu, but we will be doing decoding in ash-gpu. Until the @@ -217,14 +218,6 @@ } #endif // BUILDFLAG(IS_CHROMEOS_LACROS) return GetSupplementalProfileCache()->IsProfileSupported(type.profile); -#elif BUILDFLAG(IS_MAC) - if (__builtin_available(macOS 11.0, *)) - return base::FeatureList::IsEnabled(kPlatformHEVCDecoderSupport) && - (type.profile == HEVCPROFILE_MAIN || - type.profile == HEVCPROFILE_MAIN10 || - type.profile == HEVCPROFILE_MAIN_STILL_PICTURE || - type.profile == HEVCPROFILE_REXT); - return false; #elif BUILDFLAG(IS_ANDROID) // Technically android 5.0 mandates support for only HEVC main profile, // however some platforms (like chromecast) have had more profiles supported
diff --git a/media/base/video_types.cc b/media/base/video_types.cc index e1d35c4..0631516 100644 --- a/media/base/video_types.cc +++ b/media/base/video_types.cc
@@ -166,51 +166,6 @@ return false; } -bool IsRGB(VideoPixelFormat format) { - switch (format) { - case PIXEL_FORMAT_ARGB: - case PIXEL_FORMAT_XRGB: - case PIXEL_FORMAT_RGB24: - case PIXEL_FORMAT_ABGR: - case PIXEL_FORMAT_XBGR: - case PIXEL_FORMAT_XR30: - case PIXEL_FORMAT_XB30: - case PIXEL_FORMAT_BGRA: - case PIXEL_FORMAT_RGBAF16: - return true; - - case PIXEL_FORMAT_UNKNOWN: - case PIXEL_FORMAT_I420: - case PIXEL_FORMAT_YV12: - case PIXEL_FORMAT_I422: - case PIXEL_FORMAT_I420A: - case PIXEL_FORMAT_I444: - case PIXEL_FORMAT_NV12: - case PIXEL_FORMAT_NV21: - case PIXEL_FORMAT_UYVY: - case PIXEL_FORMAT_YUY2: - case PIXEL_FORMAT_MJPEG: - case PIXEL_FORMAT_YUV420P9: - case PIXEL_FORMAT_YUV420P10: - case PIXEL_FORMAT_YUV422P9: - case PIXEL_FORMAT_YUV422P10: - case PIXEL_FORMAT_YUV444P9: - case PIXEL_FORMAT_YUV444P10: - case PIXEL_FORMAT_YUV420P12: - case PIXEL_FORMAT_YUV422P12: - case PIXEL_FORMAT_YUV444P12: - case PIXEL_FORMAT_Y16: - case PIXEL_FORMAT_P016LE: - case PIXEL_FORMAT_I422A: - case PIXEL_FORMAT_I444A: - case PIXEL_FORMAT_YUV420AP10: - case PIXEL_FORMAT_YUV422AP10: - case PIXEL_FORMAT_YUV444AP10: - return false; - } - return false; -} - bool IsOpaque(VideoPixelFormat format) { switch (format) { case PIXEL_FORMAT_UNKNOWN:
diff --git a/media/base/video_types.h b/media/base/video_types.h index 53ae6dd..2ac3fb5a 100644 --- a/media/base/video_types.h +++ b/media/base/video_types.h
@@ -127,9 +127,6 @@ // Returns true if |format| is a YUV format with multiple planes. MEDIA_SHMEM_EXPORT bool IsYuvPlanar(VideoPixelFormat format); -// Returns true if |format| is an RGB format. -MEDIA_SHMEM_EXPORT bool IsRGB(VideoPixelFormat format); - // Returns true if |format| has no Alpha channel (hence is always opaque). MEDIA_SHMEM_EXPORT bool IsOpaque(VideoPixelFormat format);
diff --git a/media/capture/mojom/video_capture_types.mojom b/media/capture/mojom/video_capture_types.mojom index d9be2ad4..b9c3f9a 100644 --- a/media/capture/mojom/video_capture_types.mojom +++ b/media/capture/mojom/video_capture_types.mojom
@@ -379,7 +379,7 @@ }; // The result of an attempt by the client to start/stop cropping. -// TODO(crbug.com/1247761): Remove kNotImplemented. +// TODO(crbug.com/1264849): Remove kNotImplemented. enum CropRequestResult { kSuccess, kErrorGeneric,
diff --git a/media/capture/video/fuchsia/video_capture_device_factory_fuchsia_test.cc b/media/capture/video/fuchsia/video_capture_device_factory_fuchsia_test.cc index 8527d732..0453ed5 100644 --- a/media/capture/video/fuchsia/video_capture_device_factory_fuchsia_test.cc +++ b/media/capture/video/fuchsia/video_capture_device_factory_fuchsia_test.cc
@@ -107,7 +107,7 @@ ++num_events_; } - size_t num_events() { return num_events_; }; + size_t num_events() { return num_events_; } private: size_t num_events_ = 0;
diff --git a/media/gpu/command_buffer_helper.cc b/media/gpu/command_buffer_helper.cc index 175adf5..2fcd447 100644 --- a/media/gpu/command_buffer_helper.cc +++ b/media/gpu/command_buffer_helper.cc
@@ -184,19 +184,6 @@ return decoder_helper_->CreateMailbox(textures_[service_id].get()); } - void ProduceTexture(const gpu::Mailbox& mailbox, GLuint service_id) override { - DVLOG(2) << __func__ << "(" << mailbox.ToDebugString() << ", " << service_id - << ")"; - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - - if (!decoder_helper_) - return; - - DCHECK(textures_.count(service_id)); - return decoder_helper_->ProduceTexture(mailbox, - textures_[service_id].get()); - } - void WaitForSyncToken(gpu::SyncToken sync_token, base::OnceClosure done_cb) override { DVLOG(2) << __func__;
diff --git a/media/gpu/command_buffer_helper.h b/media/gpu/command_buffer_helper.h index 1b45ba34..c7591d181 100644 --- a/media/gpu/command_buffer_helper.h +++ b/media/gpu/command_buffer_helper.h
@@ -122,11 +122,6 @@ // be to add a HasStub() method, and not define behavior when it is false. virtual gpu::Mailbox CreateMailbox(GLuint service_id) = 0; - // Produce a texture into a mailbox. The context does not have to be current. - // However, this will fail if the stub has been destroyed. - virtual void ProduceTexture(const gpu::Mailbox& mailbox, - GLuint service_id) = 0; - // Waits for a SyncToken, then runs |done_cb|. // // |done_cb| may be destructed without running if the stub is destroyed.
diff --git a/media/gpu/gles2_decoder_helper.cc b/media/gpu/gles2_decoder_helper.cc index 8d6317d5..9e9e0b7 100644 --- a/media/gpu/gles2_decoder_helper.cc +++ b/media/gpu/gles2_decoder_helper.cc
@@ -88,12 +88,6 @@ return mailbox; } - void ProduceTexture(const gpu::Mailbox& mailbox, - AbstractTexture* texture) override { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - mailbox_manager_->ProduceTexture(mailbox, texture->GetTextureBase()); - } - private: raw_ptr<gpu::DecoderContext> decoder_; raw_ptr<gpu::MailboxManager> mailbox_manager_;
diff --git a/media/gpu/gles2_decoder_helper.h b/media/gpu/gles2_decoder_helper.h index 0c84e31..35b12a1 100644 --- a/media/gpu/gles2_decoder_helper.h +++ b/media/gpu/gles2_decoder_helper.h
@@ -61,10 +61,6 @@ // Creates a mailbox for a texture. virtual gpu::Mailbox CreateMailbox( gpu::gles2::AbstractTexture* texture_ref) = 0; - - // Produce a texture into a mailbox. - virtual void ProduceTexture(const gpu::Mailbox& mailbox, - gpu::gles2::AbstractTexture* texture_ref) = 0; }; } // namespace media
diff --git a/media/gpu/test/fake_command_buffer_helper.cc b/media/gpu/test/fake_command_buffer_helper.cc index ccc16a2..6d2b5d6 100644 --- a/media/gpu/test/fake_command_buffer_helper.cc +++ b/media/gpu/test/fake_command_buffer_helper.cc
@@ -150,13 +150,6 @@ return gpu::Mailbox::Generate(); } -void FakeCommandBufferHelper::ProduceTexture(const gpu::Mailbox& mailbox, - GLuint service_id) { - DVLOG(2) << __func__ << "(" << service_id << ")"; - DCHECK(task_runner_->BelongsToCurrentThread()); - DCHECK(service_ids_.count(service_id)); -} - void FakeCommandBufferHelper::WaitForSyncToken(gpu::SyncToken sync_token, base::OnceClosure done_cb) { DVLOG(2) << __func__;
diff --git a/media/gpu/test/fake_command_buffer_helper.h b/media/gpu/test/fake_command_buffer_helper.h index 3ee6c96e..c17b0c3 100644 --- a/media/gpu/test/fake_command_buffer_helper.h +++ b/media/gpu/test/fake_command_buffer_helper.h
@@ -63,7 +63,6 @@ gl::GLImage* image, bool client_managed) override; gpu::Mailbox CreateMailbox(GLuint service_id) override; - void ProduceTexture(const gpu::Mailbox& mailbox, GLuint service_id) override; void WaitForSyncToken(gpu::SyncToken sync_token, base::OnceClosure done_cb) override; void SetWillDestroyStubCB(WillDestroyStubCB will_destroy_stub_cb) override;
diff --git a/media/renderers/video_resource_updater.cc b/media/renderers/video_resource_updater.cc index 4bb99ac..1b1ed92 100644 --- a/media/renderers/video_resource_updater.cc +++ b/media/renderers/video_resource_updater.cc
@@ -877,10 +877,9 @@ << VideoPixelFormatToString(video_frame->format()); return external_resources; } - if ((external_resources.type == VideoFrameResourceType::RGB || - external_resources.type == VideoFrameResourceType::RGBA || - external_resources.type == VideoFrameResourceType::RGBA_PREMULTIPLIED) && - IsRGB(video_frame->format())) { + if (external_resources.type == VideoFrameResourceType::RGB || + external_resources.type == VideoFrameResourceType::RGBA || + external_resources.type == VideoFrameResourceType::RGBA_PREMULTIPLIED) { resource_color_space = resource_color_space.GetAsFullRangeRGB(); }
diff --git a/remoting/protocol/audio_decode_scheduler.cc b/remoting/protocol/audio_decode_scheduler.cc index 12d6cfa..f3a7492c 100644 --- a/remoting/protocol/audio_decode_scheduler.cc +++ b/remoting/protocol/audio_decode_scheduler.cc
@@ -14,8 +14,7 @@ #include "remoting/proto/audio.pb.h" #include "remoting/protocol/audio_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { AudioDecodeScheduler::AudioDecodeScheduler( scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner, @@ -24,12 +23,12 @@ audio_consumer_(audio_consumer) {} AudioDecodeScheduler::~AudioDecodeScheduler() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); audio_decode_task_runner_->DeleteSoon(FROM_HERE, decoder_.release()); } void AudioDecodeScheduler::Initialize(const protocol::SessionConfig& config) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(!decoder_); decoder_ = AudioDecoder::CreateAudioDecoder(config); } @@ -37,7 +36,7 @@ void AudioDecodeScheduler::ProcessAudioPacket( std::unique_ptr<AudioPacket> packet, base::OnceClosure done) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); base::PostTaskAndReplyWithResult( audio_decode_task_runner_.get(), FROM_HERE, @@ -50,7 +49,7 @@ void AudioDecodeScheduler::ProcessDecodedPacket( base::OnceClosure done, std::unique_ptr<AudioPacket> packet) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (!packet || !audio_consumer_) { std::move(done).Run(); @@ -60,5 +59,4 @@ audio_consumer_->ProcessAudioPacket(std::move(packet), std::move(done)); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/audio_decode_scheduler.h b/remoting/protocol/audio_decode_scheduler.h index deb90d3..7819f04 100644 --- a/remoting/protocol/audio_decode_scheduler.h +++ b/remoting/protocol/audio_decode_scheduler.h
@@ -54,7 +54,7 @@ // Decoder used on the audio thread. std::unique_ptr<AudioDecoder> decoder_; - base::ThreadChecker thread_checker_; + THREAD_CHECKER(thread_checker_); base::WeakPtrFactory<AudioDecodeScheduler> weak_factory_{this}; };
diff --git a/remoting/protocol/audio_decode_scheduler_unittest.cc b/remoting/protocol/audio_decode_scheduler_unittest.cc index 5d8b68b..1e05906 100644 --- a/remoting/protocol/audio_decode_scheduler_unittest.cc +++ b/remoting/protocol/audio_decode_scheduler_unittest.cc
@@ -17,8 +17,7 @@ #include "remoting/protocol/session_config.h" #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -124,9 +123,8 @@ audio_scheduler.reset(); audio_consumer.reset(); - // TODO(nicholss): This test does not really test anything. Add a way to get - // a count of the calls to AddAudioPacket. + // TODO(nicholss): This test does not really test anything. Add a way to get a + // count of the calls to AddAudioPacket. } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/audio_pump.cc b/remoting/protocol/audio_pump.cc index 32d86de6..db172c3c 100644 --- a/remoting/protocol/audio_pump.cc +++ b/remoting/protocol/audio_pump.cc
@@ -83,8 +83,7 @@ } // namespace -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Limit the data stored in the pending send buffers to 250ms. const int kMaxBufferedIntervalMs = 250; @@ -110,8 +109,6 @@ void EncodeAudioPacket(std::unique_ptr<AudioPacket> packet); - base::ThreadChecker thread_checker_; - base::WeakPtr<AudioPump> pump_; scoped_refptr<base::SingleThreadTaskRunner> pump_task_runner_; @@ -127,6 +124,8 @@ std::unique_ptr<media::ChannelMixer> mixer_; media::ChannelLayout mixer_input_layout_ = media::CHANNEL_LAYOUT_NONE; + + THREAD_CHECKER(thread_checker_); }; AudioPump::Core::Core(base::WeakPtr<AudioPump> pump, @@ -138,35 +137,35 @@ audio_encoder_(std::move(audio_encoder)), enabled_(true), bytes_pending_(0) { - thread_checker_.DetachFromThread(); + DETACH_FROM_THREAD(thread_checker_); } AudioPump::Core::~Core() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } void AudioPump::Core::Start() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); audio_source_->Start( base::BindRepeating(&Core::EncodeAudioPacket, base::Unretained(this))); } void AudioPump::Core::Pause(bool pause) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); enabled_ = !pause; } void AudioPump::Core::OnPacketSent(int size) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); bytes_pending_ -= size; DCHECK_GE(bytes_pending_, 0); } void AudioPump::Core::EncodeAudioPacket(std::unique_ptr<AudioPacket> packet) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(packet); int max_buffered_bytes = @@ -197,7 +196,7 @@ std::unique_ptr<AudioPacket> AudioPump::Core::Downmix( std::unique_ptr<AudioPacket> packet) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(packet); DCHECK_EQ(packet->data_size(), 1); DCHECK_EQ(packet->bytes_per_sample(), AudioPacket::BYTES_PER_SAMPLE_2); @@ -241,13 +240,13 @@ } AudioPump::~AudioPump() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); audio_task_runner_->DeleteSoon(FROM_HERE, core_.release()); } void AudioPump::Pause(bool pause) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); audio_task_runner_->PostTask( FROM_HERE, @@ -255,7 +254,7 @@ } void AudioPump::SendAudioPacket(std::unique_ptr<AudioPacket> packet, int size) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(packet); audio_stub_->ProcessAudioPacket( @@ -269,5 +268,4 @@ base::BindOnce(&Core::OnPacketSent, base::Unretained(core_.get()), size)); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/audio_pump.h b/remoting/protocol/audio_pump.h index c1f4f59..b6988b6 100644 --- a/remoting/protocol/audio_pump.h +++ b/remoting/protocol/audio_pump.h
@@ -27,10 +27,10 @@ class AudioStub; class AudioSource; -// AudioPump is responsible for fetching audio data from the AudioCapturer -// and encoding it before passing it to the AudioStub for delivery to the -// client. Audio data will be downmixed to stereo if needed. Audio is captured -// and encoded on the audio thread and then passed to AudioStub on the network +// AudioPump is responsible for fetching audio data from the AudioCapturer and +// encoding it before passing it to the AudioStub for delivery to the client. +// Audio data will be downmixed to stereo if needed. Audio is captured and +// encoded on the audio thread and then passed to AudioStub on the network // thread. class AudioPump : public AudioStream { public: @@ -58,13 +58,13 @@ // Callback for BufferedSocketWriter. void OnPacketSent(int size); - base::ThreadChecker thread_checker_; - scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; raw_ptr<AudioStub> audio_stub_; std::unique_ptr<Core> core_; + THREAD_CHECKER(thread_checker_); + base::WeakPtrFactory<AudioPump> weak_factory_{this}; };
diff --git a/remoting/protocol/audio_pump_unittest.cc b/remoting/protocol/audio_pump_unittest.cc index b432cba4..55b412d 100644 --- a/remoting/protocol/audio_pump_unittest.cc +++ b/remoting/protocol/audio_pump_unittest.cc
@@ -21,12 +21,11 @@ #include "remoting/protocol/fake_audio_source.h" #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { -// Creates a dummy packet with 1k data +// Creates a dummy packet with 1k data. std::unique_ptr<AudioPacket> MakeAudioPacket(int channel_count = 2) { std::unique_ptr<AudioPacket> packet(new AudioPacket); packet->add_data()->resize(1024); @@ -186,5 +185,4 @@ ASSERT_EQ(sent_packets_.size(), std::size(kChannels)); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/audio_reader.cc b/remoting/protocol/audio_reader.cc index 59390fc5..da4c333 100644 --- a/remoting/protocol/audio_reader.cc +++ b/remoting/protocol/audio_reader.cc
@@ -15,8 +15,7 @@ #include "remoting/protocol/session.h" #include "remoting/protocol/session_config.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { AudioReader::AudioReader(AudioStub* audio_stub) : ChannelDispatcherBase(kAudioChannelName), audio_stub_(audio_stub) {} @@ -31,5 +30,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/audio_reader.h b/remoting/protocol/audio_reader.h index d119f501..9487015e 100644 --- a/remoting/protocol/audio_reader.h +++ b/remoting/protocol/audio_reader.h
@@ -9,8 +9,7 @@ #include "base/memory/raw_ptr.h" #include "remoting/protocol/channel_dispatcher_base.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class AudioStub; @@ -29,7 +28,6 @@ raw_ptr<AudioStub> audio_stub_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_AUDIO_READER_H_
diff --git a/remoting/protocol/audio_stream.h b/remoting/protocol/audio_stream.h index 3dd312d..2ad303c 100644 --- a/remoting/protocol/audio_stream.h +++ b/remoting/protocol/audio_stream.h
@@ -5,15 +5,14 @@ #ifndef REMOTING_PROTOCOL_AUDIO_STREAM_H_ #define REMOTING_PROTOCOL_AUDIO_STREAM_H_ -namespace remoting { -namespace protocol { +namespace remoting::protocol { -// AudioStream is responsible for fetching audio data from an AudioSource, -// and sending it to the client. +// AudioStream is responsible for fetching audio data from an AudioSource, and +// sending it to the client. class AudioStream { public: - AudioStream() {} - virtual ~AudioStream() {} + AudioStream() = default; + virtual ~AudioStream() = default; // Pauses or resumes audio on a running session. This leaves the audio // capturer running, and only affects whether or not the captured audio is @@ -21,7 +20,6 @@ virtual void Pause(bool pause) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_AUDIO_STREAM_H_
diff --git a/remoting/protocol/audio_writer.cc b/remoting/protocol/audio_writer.cc index b3b4c27..b7ed864 100644 --- a/remoting/protocol/audio_writer.cc +++ b/remoting/protocol/audio_writer.cc
@@ -16,8 +16,7 @@ #include "remoting/protocol/session.h" #include "remoting/protocol/session_config.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { AudioWriter::AudioWriter() : ChannelDispatcherBase(kAudioChannelName) {} AudioWriter::~AudioWriter() = default; @@ -38,5 +37,4 @@ LOG(ERROR) << "Received unexpected message on the audio channel."; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/audio_writer.h b/remoting/protocol/audio_writer.h index 7cf63dcd..b8b9d1f 100644 --- a/remoting/protocol/audio_writer.h +++ b/remoting/protocol/audio_writer.h
@@ -13,8 +13,7 @@ #include "remoting/protocol/audio_stub.h" #include "remoting/protocol/channel_dispatcher_base.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class SessionConfig; @@ -40,7 +39,6 @@ void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) override; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_AUDIO_WRITER_H_
diff --git a/remoting/protocol/auth_util.cc b/remoting/protocol/auth_util.cc index d7eba4d..3a910e0c 100644 --- a/remoting/protocol/auth_util.cc +++ b/remoting/protocol/auth_util.cc
@@ -12,8 +12,7 @@ #include "net/base/net_errors.h" #include "net/socket/ssl_socket.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { const char kClientAuthSslExporterLabel[] = "EXPORTER-remoting-channel-auth-client"; @@ -65,5 +64,4 @@ return std::string(out_bytes, out_bytes + kAuthDigestLength); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/auth_util.h b/remoting/protocol/auth_util.h index 772d1cb..df414554 100644 --- a/remoting/protocol/auth_util.h +++ b/remoting/protocol/auth_util.h
@@ -15,8 +15,7 @@ class SSLSocket; } // namespace net -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Labels for use when exporting the SSL shared secret. extern const char kClientAuthSslExporterLabel[]; @@ -41,7 +40,6 @@ const base::StringPiece& label, const base::StringPiece& shared_secret); -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_AUTH_UTIL_H_
diff --git a/remoting/protocol/authenticator.cc b/remoting/protocol/authenticator.cc index cbefd5a..648e760 100644 --- a/remoting/protocol/authenticator.cc +++ b/remoting/protocol/authenticator.cc
@@ -7,8 +7,7 @@ #include "remoting/base/constants.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { const jingle_xmpp::StaticQName kAuthenticationQName = { kChromotingXmlNamespace, @@ -32,5 +31,4 @@ return message->FirstNamed(kAuthenticationQName); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/authenticator.h b/remoting/protocol/authenticator.h index e9c3301..c970fa41 100644 --- a/remoting/protocol/authenticator.h +++ b/remoting/protocol/authenticator.h
@@ -14,8 +14,7 @@ class XmlElement; } // namespace jingle_xmpp -namespace remoting { -namespace protocol { +namespace remoting::protocol { class Authenticator; class ChannelAuthenticator; @@ -161,7 +160,6 @@ const std::string& remote_jid) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_AUTHENTICATOR_H_
diff --git a/remoting/protocol/authenticator_test_base.cc b/remoting/protocol/authenticator_test_base.cc index e72584e5..4b3ef66f 100644 --- a/remoting/protocol/authenticator_test_base.cc +++ b/remoting/protocol/authenticator_test_base.cc
@@ -27,8 +27,7 @@ using testing::_; using testing::SaveArg; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -179,5 +178,4 @@ client_socket_ = std::move(socket); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/capability_names.h b/remoting/protocol/capability_names.h index 2b1bec7..ef7186e 100644 --- a/remoting/protocol/capability_names.h +++ b/remoting/protocol/capability_names.h
@@ -5,8 +5,7 @@ #ifndef REMOTING_PROTOCOL_CAPABILITY_NAMES_H_ #define REMOTING_PROTOCOL_CAPABILITY_NAMES_H_ -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Used for negotiating client-host capabilities for touch events. constexpr char kTouchEventsCapability[] = "touchEvents"; @@ -35,7 +34,6 @@ // implemented and working on the host side. constexpr char kMultiStreamCapability[] = "multiStream_inProgress"; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CAPABILITY_NAMES_H_
diff --git a/remoting/protocol/capture_scheduler.cc b/remoting/protocol/capture_scheduler.cc index 178cfaa14..767709f 100644 --- a/remoting/protocol/capture_scheduler.cc +++ b/remoting/protocol/capture_scheduler.cc
@@ -40,8 +40,7 @@ } // namespace -namespace remoting { -namespace protocol { +namespace remoting::protocol { // We assume that the number of available cores is constant. CaptureScheduler::CaptureScheduler( @@ -62,17 +61,17 @@ } CaptureScheduler::~CaptureScheduler() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } void CaptureScheduler::Start() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); ScheduleNextCapture(); } void CaptureScheduler::Pause(bool pause) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (is_paused_ != pause) { is_paused_ = pause; @@ -86,7 +85,7 @@ } void CaptureScheduler::OnCaptureCompleted() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); capture_pending_ = false; capture_time_.Record( @@ -98,7 +97,7 @@ } void CaptureScheduler::OnFrameEncoded(VideoPacket* packet) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // Set packet_id for the outgoing packet. packet->set_frame_id(next_frame_id_); @@ -114,13 +113,13 @@ } void CaptureScheduler::OnFrameSent() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); ScheduleNextCapture(); } void CaptureScheduler::ProcessVideoAck(std::unique_ptr<VideoAck> video_ack) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); --num_unacknowledged_frames_; DCHECK_GE(num_unacknowledged_frames_, 0); @@ -142,7 +141,7 @@ } void CaptureScheduler::ScheduleNextCapture() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (is_paused_ || capture_pending_ || num_encoding_frames_ >= kMaxFramesInEncodingQueue) { @@ -172,7 +171,7 @@ } void CaptureScheduler::CaptureNextFrame() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(!is_paused_); DCHECK(!capture_pending_); @@ -181,5 +180,4 @@ capture_closure_.Run(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/capture_scheduler.h b/remoting/protocol/capture_scheduler.h index d79cafc..006f39b 100644 --- a/remoting/protocol/capture_scheduler.h +++ b/remoting/protocol/capture_scheduler.h
@@ -112,7 +112,7 @@ // Frame ID to be assigned to the next outgoing video frame. uint32_t next_frame_id_; - base::ThreadChecker thread_checker_; + THREAD_CHECKER(thread_checker_); }; } // namespace protocol
diff --git a/remoting/protocol/capture_scheduler_unittest.cc b/remoting/protocol/capture_scheduler_unittest.cc index d9a8930..2777793 100644 --- a/remoting/protocol/capture_scheduler_unittest.cc +++ b/remoting/protocol/capture_scheduler_unittest.cc
@@ -18,8 +18,7 @@ #include "remoting/proto/video.pb.h" #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { static const int kTestInputs[] = { 100, 50, 30, 20, 10, 30, 60, 80 }; static const int kMinumumFrameIntervalMs = 50; @@ -196,5 +195,4 @@ EXPECT_TRUE(capture_timer_->IsRunning()); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/channel_authenticator.h b/remoting/protocol/channel_authenticator.h index 8da6fad..ea6c780 100644 --- a/remoting/protocol/channel_authenticator.h +++ b/remoting/protocol/channel_authenticator.h
@@ -9,8 +9,7 @@ #include "base/callback_forward.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class P2PStreamSocket; @@ -32,7 +31,6 @@ DoneCallback done_callback) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CHANNEL_AUTHENTICATOR_H_
diff --git a/remoting/protocol/channel_dispatcher_base.cc b/remoting/protocol/channel_dispatcher_base.cc index a6d0909..f2e3af4 100644 --- a/remoting/protocol/channel_dispatcher_base.cc +++ b/remoting/protocol/channel_dispatcher_base.cc
@@ -11,8 +11,7 @@ #include "remoting/protocol/message_channel_factory.h" #include "remoting/protocol/message_pipe.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { ChannelDispatcherBase::ChannelDispatcherBase(const std::string& channel_name) : channel_name_(channel_name) {} @@ -62,5 +61,4 @@ event_handler_->OnChannelClosed(this); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/channel_multiplexer.cc b/remoting/protocol/channel_multiplexer.cc index 0b6df46..be37477 100644 --- a/remoting/protocol/channel_multiplexer.cc +++ b/remoting/protocol/channel_multiplexer.cc
@@ -21,8 +21,7 @@ #include "remoting/protocol/message_serialization.h" #include "remoting/protocol/p2p_stream_socket.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { const int kChannelIdUnknown = -1; @@ -473,5 +472,4 @@ traffic_annotation); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/channel_multiplexer.h b/remoting/protocol/channel_multiplexer.h index 44dd65bc..5003f48d 100644 --- a/remoting/protocol/channel_multiplexer.h +++ b/remoting/protocol/channel_multiplexer.h
@@ -15,8 +15,7 @@ #include "remoting/protocol/message_reader.h" #include "remoting/protocol/stream_channel_factory.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class ChannelMultiplexer : public StreamChannelFactory { public: @@ -92,8 +91,6 @@ base::WeakPtrFactory<ChannelMultiplexer> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting - +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_
diff --git a/remoting/protocol/channel_multiplexer_unittest.cc b/remoting/protocol/channel_multiplexer_unittest.cc index 9874bcc..4d4776c 100644 --- a/remoting/protocol/channel_multiplexer_unittest.cc +++ b/remoting/protocol/channel_multiplexer_unittest.cc
@@ -30,8 +30,7 @@ using testing::AtMost; using testing::InvokeWithoutArgs; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -341,5 +340,4 @@ base::RunLoop().RunUntilIdle(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/channel_socket_adapter.cc b/remoting/protocol/channel_socket_adapter.cc index 945a963e..ac31f44 100644 --- a/remoting/protocol/channel_socket_adapter.cc +++ b/remoting/protocol/channel_socket_adapter.cc
@@ -11,12 +11,11 @@ #include "net/base/io_buffer.h" #include "net/base/net_errors.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { TransportChannelSocketAdapter::TransportChannelSocketAdapter( cricket::IceTransportInternal* ice_transport) - : channel_(ice_transport), closed_error_code_(net::OK) { + : channel_(ice_transport) { DCHECK(channel_); channel_->SignalReadPacket.connect( @@ -28,7 +27,7 @@ } TransportChannelSocketAdapter::~TransportChannelSocketAdapter() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (destruction_callback_) std::move(destruction_callback_).Run(); } @@ -42,7 +41,7 @@ const scoped_refptr<net::IOBuffer>& buf, int buffer_size, const net::CompletionRepeatingCallback& callback) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(buf); DCHECK(!callback.is_null()); CHECK(read_callback_.is_null()); @@ -63,7 +62,7 @@ const scoped_refptr<net::IOBuffer>& buffer, int buffer_size, const net::CompletionRepeatingCallback& callback) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(buffer); DCHECK(!callback.is_null()); CHECK(write_callback_.is_null()); @@ -98,7 +97,7 @@ } void TransportChannelSocketAdapter::Close(int error_code) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (!channel_) // Already closed. return; @@ -130,7 +129,7 @@ size_t data_size, const int64_t& packet_time, int flags) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_EQ(transport, channel_); if (!read_callback_.is_null()) { DCHECK(read_buffer_.get()); @@ -156,7 +155,7 @@ void TransportChannelSocketAdapter::OnWritableState( rtc::PacketTransportInternal* transport) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // Try to send the packet if there is a pending write. if (!write_callback_.is_null()) { rtc::PacketOptions options; @@ -177,10 +176,9 @@ void TransportChannelSocketAdapter::OnChannelDestroyed( cricket::IceTransportInternal* channel) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_EQ(channel, channel_); Close(net::ERR_CONNECTION_ABORTED); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/channel_socket_adapter.h b/remoting/protocol/channel_socket_adapter.h index 5a08994..aafd741 100644 --- a/remoting/protocol/channel_socket_adapter.h +++ b/remoting/protocol/channel_socket_adapter.h
@@ -11,6 +11,7 @@ #include "base/compiler_specific.h" #include "base/memory/raw_ptr.h" #include "base/threading/thread_checker.h" +#include "net/base/net_errors.h" #include "remoting/protocol/p2p_datagram_socket.h" // TODO(zhihuang):Replace #include by forward declaration once proper // inheritance is defined for cricket::IceTransportInternal and @@ -24,8 +25,7 @@ #include "third_party/webrtc/rtc_base/socket_address.h" #include "third_party/webrtc/rtc_base/third_party/sigslot/sigslot.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // TransportChannelSocketAdapter implements P2PDatagramSocket interface on // top of cricket::IceTransportInternal. It is used by IceTransport to provide @@ -33,7 +33,7 @@ class TransportChannelSocketAdapter : public P2PDatagramSocket, public sigslot::has_slots<> { public: - // Doesn't take ownership of the |channel|. The |channel| must outlive + // Doesn't take ownership of |ice_transport|. |ice_transport| must outlive // this adapter. explicit TransportChannelSocketAdapter( cricket::IceTransportInternal* ice_transport); @@ -71,8 +71,6 @@ void OnWritableState(rtc::PacketTransportInternal* transport); void OnChannelDestroyed(cricket::IceTransportInternal* ice_transport); - base::ThreadChecker thread_checker_; - raw_ptr<cricket::IceTransportInternal> channel_; base::OnceClosure destruction_callback_; @@ -85,10 +83,11 @@ scoped_refptr<net::IOBuffer> write_buffer_; int write_buffer_size_; - int closed_error_code_; + int closed_error_code_ = net::OK; + + THREAD_CHECKER(thread_checker_); }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CHANNEL_SOCKET_ADAPTER_H_
diff --git a/remoting/protocol/channel_socket_adapter_unittest.cc b/remoting/protocol/channel_socket_adapter_unittest.cc index 715a08d..f10baaa3 100644 --- a/remoting/protocol/channel_socket_adapter_unittest.cc +++ b/remoting/protocol/channel_socket_adapter_unittest.cc
@@ -24,8 +24,7 @@ using testing::_; using testing::Return; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { const int kBufferSize = 4096; @@ -114,5 +113,4 @@ ASSERT_EQ(net::OK, result); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/chromium_port_allocator_factory.cc b/remoting/protocol/chromium_port_allocator_factory.cc index 525d77cb..71d4e81 100644 --- a/remoting/protocol/chromium_port_allocator_factory.cc +++ b/remoting/protocol/chromium_port_allocator_factory.cc
@@ -9,8 +9,7 @@ #include "remoting/protocol/port_allocator.h" #include "remoting/protocol/transport_context.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { ChromiumPortAllocatorFactory::ChromiumPortAllocatorFactory() = default; ChromiumPortAllocatorFactory::~ChromiumPortAllocatorFactory() = default; @@ -28,5 +27,4 @@ transport_context); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/chromium_port_allocator_factory.h b/remoting/protocol/chromium_port_allocator_factory.h index 6803c0e..6c4ad69 100644 --- a/remoting/protocol/chromium_port_allocator_factory.h +++ b/remoting/protocol/chromium_port_allocator_factory.h
@@ -11,8 +11,7 @@ #include "base/memory/ref_counted.h" #include "remoting/protocol/port_allocator_factory.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class ChromiumPortAllocatorFactory : public PortAllocatorFactory { public: @@ -30,7 +29,6 @@ base::WeakPtr<SessionOptionsProvider> session_options_provider) override; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CHROMIUM_PORT_ALLOCATOR_FACTORY_H_
diff --git a/remoting/protocol/chromium_socket_factory.cc b/remoting/protocol/chromium_socket_factory.cc index 44bc2e5..e4c2e69 100644 --- a/remoting/protocol/chromium_socket_factory.cc +++ b/remoting/protocol/chromium_socket_factory.cc
@@ -31,8 +31,7 @@ #include "third_party/webrtc/rtc_base/net_helpers.h" #include "third_party/webrtc/rtc_base/socket.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -463,5 +462,4 @@ return new rtc::AsyncResolver(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/chromium_socket_factory.h b/remoting/protocol/chromium_socket_factory.h index 0871e8a0..616fc530 100644 --- a/remoting/protocol/chromium_socket_factory.h +++ b/remoting/protocol/chromium_socket_factory.h
@@ -11,8 +11,7 @@ #include "base/memory/weak_ptr.h" #include "third_party/webrtc/api/packet_socket_factory.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class SessionOptionsProvider; @@ -48,7 +47,6 @@ base::WeakPtr<SessionOptionsProvider> session_options_provider_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CHROMIUM_SOCKET_FACTORY_H_
diff --git a/remoting/protocol/chromium_socket_factory_unittest.cc b/remoting/protocol/chromium_socket_factory_unittest.cc index 5eb2d9a..75d27dd 100644 --- a/remoting/protocol/chromium_socket_factory_unittest.cc +++ b/remoting/protocol/chromium_socket_factory_unittest.cc
@@ -21,8 +21,7 @@ #include "third_party/webrtc/rtc_base/socket_address.h" #include "third_party/webrtc/rtc_base/time_utils.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -191,5 +190,4 @@ ASSERT_EQ(last_packet_time_, rtc::TimeMicros()); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/client_authentication_config.cc b/remoting/protocol/client_authentication_config.cc index a0b49687..fbd5925 100644 --- a/remoting/protocol/client_authentication_config.cc +++ b/remoting/protocol/client_authentication_config.cc
@@ -4,13 +4,11 @@ #include "remoting/protocol/client_authentication_config.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { ClientAuthenticationConfig::ClientAuthenticationConfig() = default; ClientAuthenticationConfig::ClientAuthenticationConfig( const ClientAuthenticationConfig& other) = default; ClientAuthenticationConfig::~ClientAuthenticationConfig() = default; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/client_authentication_config.h b/remoting/protocol/client_authentication_config.h index f18a1c1..791e6a582 100644 --- a/remoting/protocol/client_authentication_config.h +++ b/remoting/protocol/client_authentication_config.h
@@ -10,8 +10,7 @@ #include "base/callback.h" #include "remoting/protocol/token_validator.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { typedef base::RepeatingCallback<void(const std::string& secret)> SecretFetchedCallback; @@ -61,7 +60,6 @@ FetchThirdPartyTokenCallback fetch_third_party_token_callback; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CLIENT_AUTHENTICATION_CONFIG_H_
diff --git a/remoting/protocol/client_control_dispatcher.cc b/remoting/protocol/client_control_dispatcher.cc index 6341cee1..5889397 100644 --- a/remoting/protocol/client_control_dispatcher.cc +++ b/remoting/protocol/client_control_dispatcher.cc
@@ -17,8 +17,7 @@ #include "remoting/protocol/message_pipe.h" #include "remoting/protocol/message_serialization.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -153,5 +152,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/client_control_dispatcher.h b/remoting/protocol/client_control_dispatcher.h index b49c2ce..c40c8b49 100644 --- a/remoting/protocol/client_control_dispatcher.h +++ b/remoting/protocol/client_control_dispatcher.h
@@ -12,8 +12,7 @@ #include "remoting/protocol/cursor_shape_stub.h" #include "remoting/protocol/host_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class ClientStub; @@ -63,7 +62,6 @@ raw_ptr<ClipboardStub> clipboard_stub_ = nullptr; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CLIENT_CONTROL_DISPATCHER_H_
diff --git a/remoting/protocol/client_event_dispatcher.cc b/remoting/protocol/client_event_dispatcher.cc index 1250088..639d6f3 100644 --- a/remoting/protocol/client_event_dispatcher.cc +++ b/remoting/protocol/client_event_dispatcher.cc
@@ -12,8 +12,7 @@ #include "remoting/proto/internal.pb.h" #include "remoting/protocol/message_pipe.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { ClientEventDispatcher::ClientEventDispatcher() : ChannelDispatcherBase(kEventChannelName) {} @@ -55,5 +54,4 @@ LOG(ERROR) << "Received unexpected message on the event channel."; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/client_event_dispatcher.h b/remoting/protocol/client_event_dispatcher.h index acd39dc..d1bfcc7 100644 --- a/remoting/protocol/client_event_dispatcher.h +++ b/remoting/protocol/client_event_dispatcher.h
@@ -9,8 +9,7 @@ #include "remoting/protocol/channel_dispatcher_base.h" #include "remoting/protocol/input_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // ClientEventDispatcher manages the event channel on the client // side. It implements InputStub for outgoing input messages. @@ -33,7 +32,6 @@ void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) override; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CLIENT_EVENT_DISPATCHER_H_
diff --git a/remoting/protocol/client_stub.h b/remoting/protocol/client_stub.h index db8e309..dbb85b4 100644 --- a/remoting/protocol/client_stub.h +++ b/remoting/protocol/client_stub.h
@@ -14,8 +14,7 @@ #include "remoting/protocol/cursor_shape_stub.h" #include "remoting/protocol/keyboard_layout_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class Capabilities; class ExtensionMessage; @@ -50,7 +49,6 @@ virtual void SetTransportInfo(const TransportInfo& transport_info) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CLIENT_STUB_H_
diff --git a/remoting/protocol/client_video_dispatcher.cc b/remoting/protocol/client_video_dispatcher.cc index 40eaac9..ac3a520 100644 --- a/remoting/protocol/client_video_dispatcher.cc +++ b/remoting/protocol/client_video_dispatcher.cc
@@ -18,8 +18,7 @@ #include "remoting/protocol/message_serialization.h" #include "remoting/protocol/video_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { struct ClientVideoDispatcher::PendingFrame { PendingFrame(int frame_id) @@ -113,5 +112,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/client_video_dispatcher.h b/remoting/protocol/client_video_dispatcher.h index 34d40f3..a158a18 100644 --- a/remoting/protocol/client_video_dispatcher.h +++ b/remoting/protocol/client_video_dispatcher.h
@@ -14,8 +14,7 @@ #include "remoting/protocol/channel_dispatcher_base.h" #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class ClientStub; class VideoStub; @@ -50,7 +49,6 @@ base::WeakPtrFactory<ClientVideoDispatcher> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CLIENT_VIDEO_DISPATCHER_H_
diff --git a/remoting/protocol/client_video_dispatcher_unittest.cc b/remoting/protocol/client_video_dispatcher_unittest.cc index 349358e..dccd2ec 100644 --- a/remoting/protocol/client_video_dispatcher_unittest.cc +++ b/remoting/protocol/client_video_dispatcher_unittest.cc
@@ -23,8 +23,7 @@ #include "remoting/protocol/video_stub.h" #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class ClientVideoDispatcherTest : public testing::Test, public VideoStub, @@ -235,5 +234,4 @@ EXPECT_EQ(kTestFrameId + 1, ack_messages_[1]->frame_id()); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/client_video_stats_dispatcher.cc b/remoting/protocol/client_video_stats_dispatcher.cc index 12e76d80..a984c021 100644 --- a/remoting/protocol/client_video_stats_dispatcher.cc +++ b/remoting/protocol/client_video_stats_dispatcher.cc
@@ -16,8 +16,7 @@ #include "remoting/protocol/message_serialization.h" #include "remoting/protocol/video_stats_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { ClientVideoStatsDispatcher::ClientVideoStatsDispatcher( const std::string& stream_name, @@ -43,5 +42,4 @@ HostFrameStats::FromFrameStatsMessage(*stats_proto)); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/client_video_stats_dispatcher.h b/remoting/protocol/client_video_stats_dispatcher.h index a571ac9c..74f684c 100644 --- a/remoting/protocol/client_video_stats_dispatcher.h +++ b/remoting/protocol/client_video_stats_dispatcher.h
@@ -12,8 +12,7 @@ #include "remoting/protocol/channel_dispatcher_base.h" #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class VideoStatsStub; @@ -34,7 +33,6 @@ raw_ptr<VideoStatsStub> video_stats_stub_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CLIENT_VIDEO_STATS_DISPATCHER_H_
diff --git a/remoting/protocol/clipboard_echo_filter.cc b/remoting/protocol/clipboard_echo_filter.cc index 1827530..0eddcf2e 100644 --- a/remoting/protocol/clipboard_echo_filter.cc +++ b/remoting/protocol/clipboard_echo_filter.cc
@@ -6,8 +6,7 @@ #include "remoting/proto/event.pb.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { ClipboardEchoFilter::ClipboardEchoFilter() : host_stub_(nullptr), @@ -73,5 +72,4 @@ filter_->InjectClipboardEventToHost(event); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/clipboard_echo_filter.h b/remoting/protocol/clipboard_echo_filter.h index 82999bc50..4605c9c 100644 --- a/remoting/protocol/clipboard_echo_filter.h +++ b/remoting/protocol/clipboard_echo_filter.h
@@ -12,11 +12,10 @@ #include "base/memory/raw_ptr.h" #include "remoting/protocol/clipboard_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { -// ClipboardEchoFilter stops the host sending a clipboard item to the -// client, if that item was the latest item received from the client. +// ClipboardEchoFilter stops the host sending a clipboard item to the client, if +// that item was the latest item received from the client. class ClipboardEchoFilter { public: ClipboardEchoFilter(); @@ -72,7 +71,6 @@ std::string client_latest_data_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CLIPBOARD_ECHO_FILTER_H_
diff --git a/remoting/protocol/clipboard_echo_filter_unittest.cc b/remoting/protocol/clipboard_echo_filter_unittest.cc index d92dc5c..07187c4b 100644 --- a/remoting/protocol/clipboard_echo_filter_unittest.cc +++ b/remoting/protocol/clipboard_echo_filter_unittest.cc
@@ -13,8 +13,7 @@ using ::testing::_; using ::testing::InSequence; -namespace remoting { -namespace protocol { +namespace remoting::protocol { using test::EqualsClipboardEvent; @@ -106,5 +105,4 @@ filter.client_filter()->InjectClipboardEvent(event); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/clipboard_filter.cc b/remoting/protocol/clipboard_filter.cc index 12ce370..70b987b 100644 --- a/remoting/protocol/clipboard_filter.cc +++ b/remoting/protocol/clipboard_filter.cc
@@ -6,8 +6,7 @@ #include "remoting/proto/internal.pb.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { ClipboardFilter::ClipboardFilter() = default; @@ -38,5 +37,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/clipboard_filter.h b/remoting/protocol/clipboard_filter.h index 6dadbbf5..0514e30 100644 --- a/remoting/protocol/clipboard_filter.h +++ b/remoting/protocol/clipboard_filter.h
@@ -10,8 +10,7 @@ #include "remoting/protocol/clipboard_stub.h" #include "third_party/abseil-cpp/absl/types/optional.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Forwards clipboard events to |clipboard_stub|, if configured. Event // forwarding may also be disabled independently of the configured @@ -46,7 +45,6 @@ absl::optional<size_t> max_size_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CLIPBOARD_FILTER_H_
diff --git a/remoting/protocol/clipboard_filter_unittest.cc b/remoting/protocol/clipboard_filter_unittest.cc index dcae907..3188034 100644 --- a/remoting/protocol/clipboard_filter_unittest.cc +++ b/remoting/protocol/clipboard_filter_unittest.cc
@@ -12,8 +12,7 @@ using ::testing::_; -namespace remoting { -namespace protocol { +namespace remoting::protocol { using test::EqualsClipboardEvent; @@ -102,5 +101,4 @@ clipboard_filter.InjectClipboardEvent(MakeClipboardEvent("text","foo")); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/clipboard_stub.h b/remoting/protocol/clipboard_stub.h index 0edbfa1..eb335b3 100644 --- a/remoting/protocol/clipboard_stub.h +++ b/remoting/protocol/clipboard_stub.h
@@ -8,26 +8,24 @@ #ifndef REMOTING_PROTOCOL_CLIPBOARD_STUB_H_ #define REMOTING_PROTOCOL_CLIPBOARD_STUB_H_ -namespace remoting { -namespace protocol { +namespace remoting::protocol { class ClipboardEvent; class ClipboardStub { public: - ClipboardStub() {} + ClipboardStub() = default; ClipboardStub(const ClipboardStub&) = delete; ClipboardStub& operator=(const ClipboardStub&) = delete; - virtual ~ClipboardStub() {} + virtual ~ClipboardStub() = default; // Implementations must not assume the presence of |event|'s fields, nor that // |event.data| is correctly encoded according to the specified MIME-type. virtual void InjectClipboardEvent(const ClipboardEvent& event) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CLIPBOARD_STUB_H_
diff --git a/remoting/protocol/clipboard_thread_proxy.cc b/remoting/protocol/clipboard_thread_proxy.cc index 077cb91..5e4970b8 100644 --- a/remoting/protocol/clipboard_thread_proxy.cc +++ b/remoting/protocol/clipboard_thread_proxy.cc
@@ -7,8 +7,7 @@ #include "base/bind.h" #include "remoting/proto/event.pb.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { ClipboardThreadProxy::~ClipboardThreadProxy() = default; @@ -34,5 +33,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/clipboard_thread_proxy.h b/remoting/protocol/clipboard_thread_proxy.h index 34fffe0..62ee569d 100644 --- a/remoting/protocol/clipboard_thread_proxy.h +++ b/remoting/protocol/clipboard_thread_proxy.h
@@ -12,8 +12,7 @@ #include "base/task/task_runner.h" #include "remoting/protocol/clipboard_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class ClipboardThreadProxy : public ClipboardStub { public: @@ -42,7 +41,6 @@ scoped_refptr<base::TaskRunner> clipboard_stub_task_runner_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CLIPBOARD_THREAD_PROXY_H_
diff --git a/remoting/protocol/connection_tester.cc b/remoting/protocol/connection_tester.cc index a594bff..56e3632 100644 --- a/remoting/protocol/connection_tester.cc +++ b/remoting/protocol/connection_tester.cc
@@ -16,8 +16,7 @@ #include "remoting/protocol/p2p_stream_socket.h" #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { StreamConnectionTester::StreamConnectionTester(P2PStreamSocket* client_socket, P2PStreamSocket* host_socket, @@ -205,5 +204,4 @@ FAIL(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h index 192f3d5f..104e324 100644 --- a/remoting/protocol/connection_to_client.h +++ b/remoting/protocol/connection_to_client.h
@@ -17,9 +17,7 @@ class DesktopCapturer; } // namespace webrtc -namespace remoting { - -namespace protocol { +namespace remoting::protocol { class AudioSource; class AudioStream; @@ -123,7 +121,6 @@ virtual WebrtcEventLogData* rtc_event_log() = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_
diff --git a/remoting/protocol/connection_to_host.cc b/remoting/protocol/connection_to_host.cc index e585ab5..2b17912 100644 --- a/remoting/protocol/connection_to_host.cc +++ b/remoting/protocol/connection_to_host.cc
@@ -6,8 +6,7 @@ #include "base/notreached.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { #define RETURN_STRING_LITERAL(x) \ case x: \ @@ -26,5 +25,4 @@ return nullptr; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/connection_to_host.h b/remoting/protocol/connection_to_host.h index ebf39fd..bdaea4e 100644 --- a/remoting/protocol/connection_to_host.h +++ b/remoting/protocol/connection_to_host.h
@@ -16,8 +16,7 @@ class SingleThreadTaskRunner; } // namespace base -namespace remoting { -namespace protocol { +namespace remoting::protocol { class AudioStub; class ClientStub; @@ -105,7 +104,6 @@ virtual State state() const = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_
diff --git a/remoting/protocol/connection_unittest.cc b/remoting/protocol/connection_unittest.cc index 41c0aef..a3893e9 100644 --- a/remoting/protocol/connection_unittest.cc +++ b/remoting/protocol/connection_unittest.cc
@@ -40,8 +40,7 @@ using ::testing::NotNull; using ::testing::StrictMock; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -715,5 +714,4 @@ WaitNextVideoFrame(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/content_description.h b/remoting/protocol/content_description.h index 2874317..a0ad4fd 100644 --- a/remoting/protocol/content_description.h +++ b/remoting/protocol/content_description.h
@@ -15,8 +15,7 @@ class XmlElement; } // namespace jingle_xmpp -namespace remoting { -namespace protocol { +namespace remoting::protocol { // ContentDescription used for chromoting sessions. It contains the information // from the content description stanza in the session initialization handshake. @@ -56,7 +55,6 @@ std::list<ChannelConfig>* const configs); }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CONTENT_DESCRIPTION_H_
diff --git a/remoting/protocol/content_description_unittest.cc b/remoting/protocol/content_description_unittest.cc index e3d6237..bce9c4f 100644 --- a/remoting/protocol/content_description_unittest.cc +++ b/remoting/protocol/content_description_unittest.cc
@@ -13,8 +13,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { TEST(ContentDescriptionTest, FormatAndParse) { std::unique_ptr<CandidateSessionConfig> config = @@ -104,6 +103,4 @@ EXPECT_TRUE(parsed->config()->audio_configs().front() == ChannelConfig()); } -} // namespace protocol -} // namespace remoting - +} // namespace remoting::protocol
diff --git a/remoting/protocol/cursor_shape_stub.h b/remoting/protocol/cursor_shape_stub.h index 0be4cf4..092a02c 100644 --- a/remoting/protocol/cursor_shape_stub.h +++ b/remoting/protocol/cursor_shape_stub.h
@@ -7,24 +7,22 @@ #ifndef REMOTING_PROTOCOL_CURSOR_SHAPE_STUB_H_ #define REMOTING_PROTOCOL_CURSOR_SHAPE_STUB_H_ -namespace remoting { -namespace protocol { +namespace remoting::protocol { class CursorShapeInfo; class CursorShapeStub { public: - CursorShapeStub() {} + CursorShapeStub() = default; CursorShapeStub(const CursorShapeStub&) = delete; CursorShapeStub& operator=(const CursorShapeStub&) = delete; - virtual ~CursorShapeStub() {} + virtual ~CursorShapeStub() = default; virtual void SetCursorShape(const CursorShapeInfo& cursor_shape) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_CURSOR_SHAPE_STUB_H_
diff --git a/remoting/protocol/data_channel_manager.cc b/remoting/protocol/data_channel_manager.cc index a6556cf..efe2433 100644 --- a/remoting/protocol/data_channel_manager.cc +++ b/remoting/protocol/data_channel_manager.cc
@@ -9,8 +9,7 @@ #include "base/check.h" #include "remoting/protocol/message_pipe.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { DataChannelManager::DataChannelManager() = default; DataChannelManager::~DataChannelManager() = default; @@ -35,5 +34,4 @@ return false; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/data_channel_manager.h b/remoting/protocol/data_channel_manager.h index 9891b335..3eca491 100644 --- a/remoting/protocol/data_channel_manager.h +++ b/remoting/protocol/data_channel_manager.h
@@ -11,8 +11,7 @@ #include "base/callback.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class MessagePipe; @@ -41,7 +40,6 @@ std::vector<std::pair<std::string, CreateHandlerCallback>> constructors_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_DATA_CHANNEL_MANAGER_H_
diff --git a/remoting/protocol/data_channel_manager_unittest.cc b/remoting/protocol/data_channel_manager_unittest.cc index a83c136..ec01185 100644 --- a/remoting/protocol/data_channel_manager_unittest.cc +++ b/remoting/protocol/data_channel_manager_unittest.cc
@@ -17,8 +17,7 @@ #include "remoting/protocol/named_message_pipe_handler.h" #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -264,5 +263,4 @@ TestDataChannelManagerMultipleRegistrations(true); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/datagram_channel_factory.h b/remoting/protocol/datagram_channel_factory.h index af5c5a0..ef18d48 100644 --- a/remoting/protocol/datagram_channel_factory.h +++ b/remoting/protocol/datagram_channel_factory.h
@@ -10,8 +10,7 @@ #include "base/callback_forward.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class P2PDatagramSocket; @@ -20,7 +19,7 @@ typedef base::OnceCallback<void(std::unique_ptr<P2PDatagramSocket>)> ChannelCreatedCallback; - DatagramChannelFactory() {} + DatagramChannelFactory() = default; DatagramChannelFactory(const DatagramChannelFactory&) = delete; DatagramChannelFactory& operator=(const DatagramChannelFactory&) = delete; @@ -40,10 +39,9 @@ virtual void CancelChannelCreation(const std::string& name) = 0; protected: - virtual ~DatagramChannelFactory() {} + virtual ~DatagramChannelFactory() = default; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_DATAGRAM_CHANNEL_FACTORY_H_
diff --git a/remoting/protocol/errors.cc b/remoting/protocol/errors.cc index f82b59b0..5e11033 100644 --- a/remoting/protocol/errors.cc +++ b/remoting/protocol/errors.cc
@@ -6,8 +6,7 @@ #include "remoting/base/name_value_map.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -44,5 +43,4 @@ return NameToValue(kErrorCodeNames, name, result); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/errors.h b/remoting/protocol/errors.h index 4eaa3adb..177977e 100644 --- a/remoting/protocol/errors.h +++ b/remoting/protocol/errors.h
@@ -7,8 +7,7 @@ #include <string> -namespace remoting { -namespace protocol { +namespace remoting::protocol { // The UI implementations maintain corresponding definitions of this // enumeration in remoting/protocol/errors.cc and @@ -43,7 +42,6 @@ // Returns the literal string of |error|. const char* ErrorCodeToString(ErrorCode error); -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_ERRORS_H_
diff --git a/remoting/protocol/fake_audio_source.cc b/remoting/protocol/fake_audio_source.cc index e2887e89..568d548 100644 --- a/remoting/protocol/fake_audio_source.cc +++ b/remoting/protocol/fake_audio_source.cc
@@ -4,8 +4,7 @@ #include "remoting/protocol/fake_audio_source.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { FakeAudioSource::FakeAudioSource() = default; FakeAudioSource::~FakeAudioSource() = default; @@ -15,5 +14,4 @@ return true; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_audio_source.h b/remoting/protocol/fake_audio_source.h index c3b6fea..baae869 100644 --- a/remoting/protocol/fake_audio_source.h +++ b/remoting/protocol/fake_audio_source.h
@@ -8,8 +8,7 @@ #include "base/callback.h" #include "remoting/protocol/audio_source.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class FakeAudioSource : public AudioSource { public: @@ -29,7 +28,6 @@ PacketCapturedCallback callback_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_FAKE_AUDIO_SOURCE_H_
diff --git a/remoting/protocol/fake_authenticator.cc b/remoting/protocol/fake_authenticator.cc index eaff44a..8df487b 100644 --- a/remoting/protocol/fake_authenticator.cc +++ b/remoting/protocol/fake_authenticator.cc
@@ -19,8 +19,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { FakeChannelAuthenticator::FakeChannelAuthenticator(bool accept, bool async) : result_(accept ? net::OK : net::ERR_FAILED), async_(async) {} @@ -246,5 +245,4 @@ return std::move(authenticator); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_authenticator.h b/remoting/protocol/fake_authenticator.h index 352f1faa..f1a1d69 100644 --- a/remoting/protocol/fake_authenticator.h +++ b/remoting/protocol/fake_authenticator.h
@@ -10,8 +10,7 @@ #include "remoting/protocol/authenticator.h" #include "remoting/protocol/channel_authenticator.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class FakeChannelAuthenticator : public ChannelAuthenticator { public: @@ -147,7 +146,6 @@ const FakeAuthenticator::Config config_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_
diff --git a/remoting/protocol/fake_connection_to_client.cc b/remoting/protocol/fake_connection_to_client.cc index 0a5ed6c..bfd3158 100644 --- a/remoting/protocol/fake_connection_to_client.cc +++ b/remoting/protocol/fake_connection_to_client.cc
@@ -13,10 +13,9 @@ #include "remoting/protocol/video_frame_pump.h" #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { -FakeVideoStream::FakeVideoStream() {} +FakeVideoStream::FakeVideoStream() = default; FakeVideoStream::~FakeVideoStream() = default; void FakeVideoStream::SetEventTimestampsSource( @@ -116,5 +115,4 @@ return nullptr; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_connection_to_client.h b/remoting/protocol/fake_connection_to_client.h index 0276cf52..7dc727d4 100644 --- a/remoting/protocol/fake_connection_to_client.h +++ b/remoting/protocol/fake_connection_to_client.h
@@ -17,8 +17,7 @@ #include "remoting/protocol/video_stream.h" #include "remoting/protocol/video_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class FakeVideoStream : public protocol::VideoStream { public: @@ -126,7 +125,6 @@ ErrorCode disconnect_error_ = OK; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_FAKE_CONNECTION_TO_CLIENT_H_
diff --git a/remoting/protocol/fake_connection_to_host.cc b/remoting/protocol/fake_connection_to_host.cc index b63b038..fd6360c 100644 --- a/remoting/protocol/fake_connection_to_host.cc +++ b/remoting/protocol/fake_connection_to_host.cc
@@ -7,8 +7,7 @@ #include "remoting/protocol/authenticator.h" #include "remoting/protocol/transport_context.h" -namespace remoting { -namespace test { +namespace remoting::test { FakeConnectionToHost::FakeConnectionToHost() : session_config_(protocol::SessionConfig::ForTest()) {} @@ -106,5 +105,4 @@ } } -} // namespace test -} // namespace remoting +} // namespace remoting::test
diff --git a/remoting/protocol/fake_connection_to_host.h b/remoting/protocol/fake_connection_to_host.h index 9f9717e9..5f60d97 100644 --- a/remoting/protocol/fake_connection_to_host.h +++ b/remoting/protocol/fake_connection_to_host.h
@@ -12,8 +12,7 @@ #include "remoting/protocol/connection_to_host.h" #include "remoting/protocol/protocol_mock_objects.h" -namespace remoting { -namespace test { +namespace remoting::test { class FakeConnectionToHost : public protocol::ConnectionToHost { public: @@ -62,7 +61,6 @@ std::unique_ptr<protocol::SessionConfig> session_config_; }; -} // namespace test -} // namespace remoting +} // namespace remoting::test #endif // REMOTING_PROTOCOL_FAKE_CONNECTION_TO_HOST_H_
diff --git a/remoting/protocol/fake_datagram_socket.cc b/remoting/protocol/fake_datagram_socket.cc index 9baee53..d4378c6 100644 --- a/remoting/protocol/fake_datagram_socket.cc +++ b/remoting/protocol/fake_datagram_socket.cc
@@ -15,8 +15,7 @@ #include "net/base/net_errors.h" #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { FakeDatagramSocket::FakeDatagramSocket() : input_pos_(0), task_runner_(base::ThreadTaskRunnerHandle::Get()) {} @@ -187,5 +186,4 @@ channels_.erase(name); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_datagram_socket.h b/remoting/protocol/fake_datagram_socket.h index e67251de..4de50423 100644 --- a/remoting/protocol/fake_datagram_socket.h +++ b/remoting/protocol/fake_datagram_socket.h
@@ -19,8 +19,7 @@ class SingleThreadTaskRunner; } -namespace remoting { -namespace protocol { +namespace remoting::protocol { // FakeDatagramSocket implement P2PStreamSocket interface. All data written to // FakeDatagramSocket is stored in a buffer returned by written_packets(). @@ -147,7 +146,6 @@ base::WeakPtrFactory<FakeDatagramChannelFactory> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_
diff --git a/remoting/protocol/fake_desktop_capturer.cc b/remoting/protocol/fake_desktop_capturer.cc index 17533d4..7c446ba 100644 --- a/remoting/protocol/fake_desktop_capturer.cc +++ b/remoting/protocol/fake_desktop_capturer.cc
@@ -15,8 +15,7 @@ #include "base/time/time.h" #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // FakeDesktopCapturer generates a white picture of size kWidth x kHeight // with a rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed @@ -180,5 +179,4 @@ return false; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_message_pipe.cc b/remoting/protocol/fake_message_pipe.cc index 075511d5..2c3310e0 100644 --- a/remoting/protocol/fake_message_pipe.cc +++ b/remoting/protocol/fake_message_pipe.cc
@@ -14,8 +14,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/protobuf/src/google/protobuf/message_lite.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { FakeMessagePipe::FakeMessagePipe(bool asynchronous) : asynchronous_(asynchronous) {} @@ -132,5 +131,4 @@ event_handler_->OnMessagePipeClosed(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_message_pipe.h b/remoting/protocol/fake_message_pipe.h index d45d671..8236180 100644 --- a/remoting/protocol/fake_message_pipe.h +++ b/remoting/protocol/fake_message_pipe.h
@@ -18,8 +18,7 @@ } // namespace protobuf } // namespace google -namespace remoting { -namespace protocol { +namespace remoting::protocol { class FakeMessagePipeWrapper; @@ -72,7 +71,6 @@ base::queue<std::string> sent_messages_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_FAKE_MESSAGE_PIPE_H_
diff --git a/remoting/protocol/fake_message_pipe_wrapper.cc b/remoting/protocol/fake_message_pipe_wrapper.cc index 0d0c676..85cc908 100644 --- a/remoting/protocol/fake_message_pipe_wrapper.cc +++ b/remoting/protocol/fake_message_pipe_wrapper.cc
@@ -11,8 +11,7 @@ #include "remoting/base/compound_buffer.h" #include "remoting/protocol/fake_message_pipe.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { FakeMessagePipeWrapper::FakeMessagePipeWrapper(FakeMessagePipe* pipe) : pipe_(pipe) { @@ -42,5 +41,4 @@ pipe_->ClosePipe(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_message_pipe_wrapper.h b/remoting/protocol/fake_message_pipe_wrapper.h index 64ec7585..ec00cb3 100644 --- a/remoting/protocol/fake_message_pipe_wrapper.h +++ b/remoting/protocol/fake_message_pipe_wrapper.h
@@ -16,8 +16,7 @@ } // namespace protobuf } // namespace google -namespace remoting { -namespace protocol { +namespace remoting::protocol { class FakeMessagePipe; @@ -41,7 +40,6 @@ const raw_ptr<FakeMessagePipe> pipe_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_FAKE_MESSAGE_PIPE_WRAPPER_H_
diff --git a/remoting/protocol/fake_session.cc b/remoting/protocol/fake_session.cc index 00f919b..325b843 100644 --- a/remoting/protocol/fake_session.cc +++ b/remoting/protocol/fake_session.cc
@@ -14,8 +14,7 @@ #include "remoting/protocol/session_plugin.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { const char kTestJid[] = "host1@gmail.com/chromoting123"; const char kTestAuthKey[] = "test_auth_key"; @@ -136,5 +135,4 @@ attachments_[round] = std::move(attachment); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_session.h b/remoting/protocol/fake_session.h index dd101a17..f600191 100644 --- a/remoting/protocol/fake_session.h +++ b/remoting/protocol/fake_session.h
@@ -18,8 +18,7 @@ #include "remoting/protocol/session.h" #include "remoting/protocol/transport.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { extern const char kTestJid[]; @@ -85,7 +84,6 @@ base::WeakPtrFactory<FakeSession> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_
diff --git a/remoting/protocol/fake_stream_socket.cc b/remoting/protocol/fake_stream_socket.cc index f1ad9d9..7d9b854 100644 --- a/remoting/protocol/fake_stream_socket.cc +++ b/remoting/protocol/fake_stream_socket.cc
@@ -17,8 +17,7 @@ #include "net/traffic_annotation/network_traffic_annotation.h" #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { FakeStreamSocket::FakeStreamSocket() : task_runner_(base::ThreadTaskRunnerHandle::Get()) {} @@ -206,5 +205,4 @@ channels_.erase(name); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_stream_socket.h b/remoting/protocol/fake_stream_socket.h index 5b9833f..6830459 100644 --- a/remoting/protocol/fake_stream_socket.h +++ b/remoting/protocol/fake_stream_socket.h
@@ -19,8 +19,7 @@ class SingleThreadTaskRunner; } -namespace remoting { -namespace protocol { +namespace remoting::protocol { // FakeStreamSocket implement P2PStreamSocket interface. All data written to // FakeStreamSocket is stored in a buffer returned by written_data(). Read() @@ -155,7 +154,6 @@ base::WeakPtrFactory<FakeStreamChannelFactory> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_FAKE_STREAM_SOCKET_H_
diff --git a/remoting/protocol/fake_video_renderer.cc b/remoting/protocol/fake_video_renderer.cc index 3a6bc99e..f74028cd3 100644 --- a/remoting/protocol/fake_video_renderer.cc +++ b/remoting/protocol/fake_video_renderer.cc
@@ -11,22 +11,21 @@ #include "remoting/proto/video.pb.h" #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { FakeVideoStub::FakeVideoStub() = default; FakeVideoStub::~FakeVideoStub() = default; void FakeVideoStub::set_on_frame_callback( const base::RepeatingClosure& on_frame_callback) { - CHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); on_frame_callback_ = on_frame_callback; } void FakeVideoStub::ProcessVideoPacket( std::unique_ptr<VideoPacket> video_packet, base::OnceClosure done) { - CHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); received_packets_.push_back(std::move(video_packet)); if (!done.is_null()) std::move(done).Run(); @@ -39,19 +38,19 @@ void FakeFrameConsumer::set_on_frame_callback( const base::RepeatingClosure& on_frame_callback) { - CHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); on_frame_callback_ = on_frame_callback; } std::unique_ptr<webrtc::DesktopFrame> FakeFrameConsumer::AllocateFrame( const webrtc::DesktopSize& size) { - CHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return std::make_unique<webrtc::BasicDesktopFrame>(size); } void FakeFrameConsumer::DrawFrame(std::unique_ptr<webrtc::DesktopFrame> frame, base::OnceClosure done) { - CHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); received_frames_.push_back(std::move(frame)); if (done) std::move(done).Run(); @@ -60,7 +59,7 @@ } FrameConsumer::PixelFormat FakeFrameConsumer::GetPixelFormat() { - CHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return FORMAT_BGRA; } @@ -73,7 +72,7 @@ } void FakeFrameStatsConsumer::OnVideoFrameStats(const FrameStats& stats) { - CHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); received_stats_.push_back(stats); if (!on_stats_callback_.is_null()) on_stats_callback_.Run(); @@ -91,19 +90,18 @@ void FakeVideoRenderer::OnSessionConfig(const SessionConfig& config) {} FakeVideoStub* FakeVideoRenderer::GetVideoStub() { - CHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return &video_stub_; } FakeFrameConsumer* FakeVideoRenderer::GetFrameConsumer() { - CHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return &frame_consumer_; } FakeFrameStatsConsumer* FakeVideoRenderer::GetFrameStatsConsumer() { - CHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return &frame_stats_consumer_; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_video_renderer.h b/remoting/protocol/fake_video_renderer.h index 0e2af76..0f9cbb69 100644 --- a/remoting/protocol/fake_video_renderer.h +++ b/remoting/protocol/fake_video_renderer.h
@@ -15,8 +15,7 @@ #include "remoting/protocol/video_renderer.h" #include "remoting/protocol/video_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class FakeVideoStub : public VideoStub { public: @@ -34,10 +33,10 @@ base::OnceClosure done) override; private: - base::ThreadChecker thread_checker_; - std::list<std::unique_ptr<VideoPacket>> received_packets_; base::RepeatingClosure on_frame_callback_; + + THREAD_CHECKER(thread_checker_); }; class FakeFrameConsumer : public FrameConsumer { @@ -59,10 +58,10 @@ PixelFormat GetPixelFormat() override; private: - base::ThreadChecker thread_checker_; - std::list<std::unique_ptr<webrtc::DesktopFrame>> received_frames_; base::RepeatingClosure on_frame_callback_; + + THREAD_CHECKER(thread_checker_); }; class FakeFrameStatsConsumer : public FrameStatsConsumer { @@ -78,10 +77,10 @@ void OnVideoFrameStats(const FrameStats& stats) override; private: - base::ThreadChecker thread_checker_; - std::list<FrameStats> received_stats_; base::RepeatingClosure on_stats_callback_; + + THREAD_CHECKER(thread_checker_); }; class FakeVideoRenderer : public VideoRenderer { @@ -98,14 +97,13 @@ FakeFrameStatsConsumer* GetFrameStatsConsumer() override; private: - base::ThreadChecker thread_checker_; - FakeVideoStub video_stub_; FakeFrameConsumer frame_consumer_; FakeFrameStatsConsumer frame_stats_consumer_; + + THREAD_CHECKER(thread_checker_); }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_FAKE_VIDEO_RENDERER_H_
diff --git a/remoting/protocol/file_transfer_helpers.cc b/remoting/protocol/file_transfer_helpers.cc index cfb31ea..a4a5e7a 100644 --- a/remoting/protocol/file_transfer_helpers.cc +++ b/remoting/protocol/file_transfer_helpers.cc
@@ -4,8 +4,7 @@ #include "remoting/protocol/file_transfer_helpers.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { FileTransfer_Error MakeFileTransferError( base::Location location, @@ -33,5 +32,4 @@ return stream; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/file_transfer_helpers.h b/remoting/protocol/file_transfer_helpers.h index 4fd2d925..420a8dbf 100644 --- a/remoting/protocol/file_transfer_helpers.h +++ b/remoting/protocol/file_transfer_helpers.h
@@ -13,8 +13,7 @@ #include "remoting/proto/file_transfer.pb.h" #include "third_party/abseil-cpp/absl/types/optional.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { template <typename SuccessType> using FileTransferResult = Result<SuccessType, FileTransfer_Error>; @@ -26,7 +25,6 @@ std::ostream& operator<<(std::ostream& stream, const FileTransfer_Error& error); -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_FILE_TRANSFER_HELPERS_H_
diff --git a/remoting/protocol/frame_consumer.h b/remoting/protocol/frame_consumer.h index fc148bd..5106d35 100644 --- a/remoting/protocol/frame_consumer.h +++ b/remoting/protocol/frame_consumer.h
@@ -14,15 +14,14 @@ class DesktopSize; } // namespace webrtc -namespace remoting { -namespace protocol { +namespace remoting::protocol { class FrameConsumer { public: FrameConsumer(const FrameConsumer&) = delete; FrameConsumer& operator=(const FrameConsumer&) = delete; - virtual ~FrameConsumer() {} + virtual ~FrameConsumer() = default; // List of supported pixel formats needed by various platforms. enum PixelFormat { @@ -40,10 +39,9 @@ virtual PixelFormat GetPixelFormat() = 0; protected: - FrameConsumer() {} + FrameConsumer() = default; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_FRAME_CONSUMER_H_
diff --git a/remoting/protocol/frame_stats.cc b/remoting/protocol/frame_stats.cc index df995e3a..26473f0 100644 --- a/remoting/protocol/frame_stats.cc +++ b/remoting/protocol/frame_stats.cc
@@ -7,8 +7,7 @@ #include "remoting/proto/video.pb.h" #include "remoting/proto/video_stats.pb.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { ClientFrameStats::ClientFrameStats() = default; ClientFrameStats::ClientFrameStats(const ClientFrameStats&) = default; @@ -152,5 +151,4 @@ FrameStats::FrameStats(const FrameStats&) = default; FrameStats::~FrameStats() = default; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/frame_stats_unittest.cc b/remoting/protocol/frame_stats_unittest.cc index c3de501..e38bd2d 100644 --- a/remoting/protocol/frame_stats_unittest.cc +++ b/remoting/protocol/frame_stats_unittest.cc
@@ -6,8 +6,7 @@ #include "remoting/proto/video_stats.pb.h" #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class FrameStatsTest : public testing::Test {}; @@ -42,5 +41,4 @@ EXPECT_EQ(stats.frame_quality, newStats.frame_quality); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/host_control_dispatcher.cc b/remoting/protocol/host_control_dispatcher.cc index 622a49a..3da6b9e 100644 --- a/remoting/protocol/host_control_dispatcher.cc +++ b/remoting/protocol/host_control_dispatcher.cc
@@ -15,8 +15,7 @@ #include "remoting/protocol/message_pipe.h" #include "remoting/protocol/message_serialization.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { HostControlDispatcher::HostControlDispatcher() : ChannelDispatcherBase(kControlChannelName) {} @@ -131,5 +130,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/host_control_dispatcher.h b/remoting/protocol/host_control_dispatcher.h index 5c1355fe..cca07906 100644 --- a/remoting/protocol/host_control_dispatcher.h +++ b/remoting/protocol/host_control_dispatcher.h
@@ -14,15 +14,14 @@ #include "remoting/protocol/clipboard_stub.h" #include "remoting/protocol/cursor_shape_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class HostStub; class PairingResponse; -// HostControlDispatcher dispatches incoming messages on the control -// channel to HostStub or ClipboardStub, and also implements ClientStub and -// CursorShapeStub for outgoing messages. +// HostControlDispatcher dispatches incoming messages on the control channel to +// HostStub or ClipboardStub, and also implements ClientStub and CursorShapeStub +// for outgoing messages. class HostControlDispatcher : public ChannelDispatcherBase, public ClientStub { public: @@ -55,8 +54,8 @@ clipboard_stub_ = clipboard_stub; } - // Sets the HostStub that will be called for each incoming control - // message. |host_stub| must outlive this object. + // Sets the HostStub that will be called for each incoming control message. + // |host_stub| must outlive this object. void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; } // Sets the maximum size of outgoing messages, which defaults to 64KiB. This @@ -73,12 +72,11 @@ raw_ptr<ClipboardStub> clipboard_stub_ = nullptr; raw_ptr<HostStub> host_stub_ = nullptr; - // 64 KiB is the default message size expected to be supported in absence of - // a higher value negotiated via SDP. + // 64 KiB is the default message size expected to be supported in absence of a + // higher value negotiated via SDP. std::size_t max_message_size_ = 64 * 1024; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_
diff --git a/remoting/protocol/host_event_dispatcher.cc b/remoting/protocol/host_event_dispatcher.cc index 5069304..b5c1642 100644 --- a/remoting/protocol/host_event_dispatcher.cc +++ b/remoting/protocol/host_event_dispatcher.cc
@@ -13,8 +13,7 @@ #include "remoting/protocol/input_stub.h" #include "remoting/protocol/message_serialization.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { HostEventDispatcher::HostEventDispatcher() : ChannelDispatcherBase(kEventChannelName), @@ -58,5 +57,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/host_event_dispatcher.h b/remoting/protocol/host_event_dispatcher.h index a70855e..c30a01b 100644 --- a/remoting/protocol/host_event_dispatcher.h +++ b/remoting/protocol/host_event_dispatcher.h
@@ -11,13 +11,12 @@ #include "remoting/protocol/channel_dispatcher_base.h" #include "remoting/protocol/input_event_timestamps.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class InputStub; -// HostEventDispatcher dispatches incoming messages on the event -// channel to InputStub. +// HostEventDispatcher dispatches incoming messages on the event channel to +// InputStub. class HostEventDispatcher : public ChannelDispatcherBase { public: HostEventDispatcher(); @@ -52,7 +51,6 @@ raw_ptr<InputStub> input_stub_ = nullptr; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_
diff --git a/remoting/protocol/host_stub.h b/remoting/protocol/host_stub.h index fcae747c..46ebc26 100644 --- a/remoting/protocol/host_stub.h +++ b/remoting/protocol/host_stub.h
@@ -9,8 +9,7 @@ #ifndef REMOTING_PROTOCOL_HOST_STUB_H_ #define REMOTING_PROTOCOL_HOST_STUB_H_ -namespace remoting { -namespace protocol { +namespace remoting::protocol { class AudioControl; class Capabilities; @@ -23,7 +22,7 @@ class HostStub { public: - HostStub() {} + HostStub() = default; HostStub(const HostStub&) = delete; HostStub& operator=(const HostStub&) = delete; @@ -59,10 +58,9 @@ const SelectDesktopDisplayRequest& select_display) = 0; protected: - virtual ~HostStub() {} + virtual ~HostStub() = default; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_HOST_STUB_H_
diff --git a/remoting/protocol/host_video_dispatcher.cc b/remoting/protocol/host_video_dispatcher.cc index bc23cfd..697d7fb2 100644 --- a/remoting/protocol/host_video_dispatcher.cc +++ b/remoting/protocol/host_video_dispatcher.cc
@@ -15,8 +15,7 @@ #include "remoting/protocol/message_serialization.h" #include "remoting/protocol/video_feedback_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { HostVideoDispatcher::HostVideoDispatcher() : ChannelDispatcherBase(kVideoChannelName) {} @@ -37,5 +36,4 @@ video_feedback_stub_->ProcessVideoAck(std::move(ack)); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/host_video_dispatcher.h b/remoting/protocol/host_video_dispatcher.h index c186ea3..2acda1f 100644 --- a/remoting/protocol/host_video_dispatcher.h +++ b/remoting/protocol/host_video_dispatcher.h
@@ -10,8 +10,7 @@ #include "remoting/protocol/channel_dispatcher_base.h" #include "remoting/protocol/video_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class VideoFeedbackStub; @@ -38,7 +37,6 @@ raw_ptr<VideoFeedbackStub> video_feedback_stub_ = nullptr; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_HOST_VIDEO_DISPATCHER_H_
diff --git a/remoting/protocol/host_video_stats_dispatcher.cc b/remoting/protocol/host_video_stats_dispatcher.cc index c1d433d..1ee38f96 100644 --- a/remoting/protocol/host_video_stats_dispatcher.cc +++ b/remoting/protocol/host_video_stats_dispatcher.cc
@@ -16,8 +16,7 @@ #include "remoting/protocol/message_serialization.h" #include "remoting/protocol/video_stats_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { HostVideoStatsDispatcher::HostVideoStatsDispatcher( const std::string& stream_name) @@ -40,5 +39,4 @@ void HostVideoStatsDispatcher::OnIncomingMessage( std::unique_ptr<CompoundBuffer> message) {} -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/host_video_stats_dispatcher.h b/remoting/protocol/host_video_stats_dispatcher.h index 6d4d626..11ab4a8 100644 --- a/remoting/protocol/host_video_stats_dispatcher.h +++ b/remoting/protocol/host_video_stats_dispatcher.h
@@ -9,8 +9,7 @@ #include "remoting/protocol/channel_dispatcher_base.h" #include "remoting/protocol/video_stats_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class HostVideoStatsDispatcher : public ChannelDispatcherBase, public VideoStatsStub { @@ -34,7 +33,6 @@ base::WeakPtrFactory<HostVideoStatsDispatcher> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_HOST_VIDEO_STATS_DISPATCHER_H_
diff --git a/remoting/protocol/ice_config.cc b/remoting/protocol/ice_config.cc index 9b49beb..471bd8a 100644 --- a/remoting/protocol/ice_config.cc +++ b/remoting/protocol/ice_config.cc
@@ -16,8 +16,7 @@ #include "net/base/url_util.h" #include "remoting/proto/remoting/v1/network_traversal_messages.pb.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -262,5 +261,4 @@ return ice_config; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/ice_config_request.h b/remoting/protocol/ice_config_request.h index f969a951..76015293 100644 --- a/remoting/protocol/ice_config_request.h +++ b/remoting/protocol/ice_config_request.h
@@ -7,8 +7,7 @@ #include "base/callback_forward.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { struct IceConfig; @@ -26,7 +25,6 @@ virtual void Send(OnIceConfigCallback callback) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_ICE_CONFIG_REQUEST_H_
diff --git a/remoting/protocol/ice_config_unittest.cc b/remoting/protocol/ice_config_unittest.cc index 4ab649c..5b529fe 100644 --- a/remoting/protocol/ice_config_unittest.cc +++ b/remoting/protocol/ice_config_unittest.cc
@@ -8,8 +8,7 @@ #include "remoting/proto/remoting/v1/network_traversal_messages.pb.h" #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { TEST(IceConfigTest, ParseValid) { const char kTestConfigJson[] = @@ -235,5 +234,4 @@ EXPECT_EQ(2000, config2.max_bitrate_kbps); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/ice_connection_to_client.cc b/remoting/protocol/ice_connection_to_client.cc index e392899c..58529ff 100644 --- a/remoting/protocol/ice_connection_to_client.cc +++ b/remoting/protocol/ice_connection_to_client.cc
@@ -26,8 +26,7 @@ #include "remoting/protocol/transport_context.h" #include "remoting/protocol/video_frame_pump.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -69,22 +68,22 @@ } IceConnectionToClient::~IceConnectionToClient() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } void IceConnectionToClient::SetEventHandler( ConnectionToClient::EventHandler* event_handler) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); event_handler_ = event_handler; } protocol::Session* IceConnectionToClient::session() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return session_.get(); } void IceConnectionToClient::Disconnect(ErrorCode error) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // This should trigger OnConnectionClosed() event and this object // may be destroyed as the result. @@ -94,7 +93,7 @@ std::unique_ptr<VideoStream> IceConnectionToClient::StartVideoStream( const std::string& stream_name, std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); std::unique_ptr<VideoEncoder> video_encoder = VideoEncoder::Create(session_->config()); @@ -109,7 +108,7 @@ std::unique_ptr<AudioStream> IceConnectionToClient::StartAudioStream( std::unique_ptr<AudioSource> audio_source) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // Audio channel is disabled. if (!audio_writer_) @@ -125,23 +124,23 @@ // Return pointer to ClientStub. ClientStub* IceConnectionToClient::client_stub() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return control_dispatcher_.get(); } void IceConnectionToClient::set_clipboard_stub( protocol::ClipboardStub* clipboard_stub) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); control_dispatcher_->set_clipboard_stub(clipboard_stub); } void IceConnectionToClient::set_host_stub(protocol::HostStub* host_stub) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); control_dispatcher_->set_host_stub(host_stub); } void IceConnectionToClient::set_input_stub(protocol::InputStub* input_stub) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); event_dispatcher_->set_input_stub(input_stub); } @@ -154,7 +153,7 @@ } void IceConnectionToClient::OnSessionStateChange(Session::State state) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(event_handler_); switch (state) { @@ -200,25 +199,25 @@ } void IceConnectionToClient::OnIceTransportError(ErrorCode error) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); Disconnect(error); } void IceConnectionToClient::OnChannelInitialized( ChannelDispatcherBase* channel_dispatcher) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); NotifyIfChannelsReady(); } void IceConnectionToClient::OnChannelClosed( ChannelDispatcherBase* channel_dispatcher) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); Disconnect(OK); } void IceConnectionToClient::NotifyIfChannelsReady() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (!control_dispatcher_ || !control_dispatcher_->is_connected()) return; @@ -241,5 +240,4 @@ audio_writer_.reset(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/ice_connection_to_client.h b/remoting/protocol/ice_connection_to_client.h index a2da4be..5a0a88e 100644 --- a/remoting/protocol/ice_connection_to_client.h +++ b/remoting/protocol/ice_connection_to_client.h
@@ -19,17 +19,15 @@ #include "remoting/protocol/ice_transport.h" #include "remoting/protocol/session.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class AudioWriter; class HostControlDispatcher; class HostEventDispatcher; class HostVideoDispatcher; -// This class represents a remote viewer connection to the chromoting -// host. It sets up all protocol channels and connects them to the -// stubs. +// This class represents a remote viewer connection to the chromoting host. It +// sets up all protocol channels and connects them to the stubs. class IceConnectionToClient : public ConnectionToClient, public Session::EventHandler, public IceTransport::EventHandler, @@ -83,8 +81,6 @@ void CloseChannels(); - base::ThreadChecker thread_checker_; - // Event handler for handling events sent from this object. raw_ptr<ConnectionToClient::EventHandler> event_handler_; @@ -99,9 +95,10 @@ std::unique_ptr<HostEventDispatcher> event_dispatcher_; std::unique_ptr<HostVideoDispatcher> video_dispatcher_; std::unique_ptr<AudioWriter> audio_writer_; + + THREAD_CHECKER(thread_checker_); }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_
diff --git a/remoting/protocol/ice_connection_to_host.cc b/remoting/protocol/ice_connection_to_host.cc index 0aaad8a..c728d75 100644 --- a/remoting/protocol/ice_connection_to_host.cc +++ b/remoting/protocol/ice_connection_to_host.cc
@@ -25,8 +25,7 @@ #include "remoting/protocol/transport_context.h" #include "remoting/protocol/video_renderer.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { IceConnectionToHost::IceConnectionToHost() = default; @@ -235,5 +234,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/ice_connection_to_host.h b/remoting/protocol/ice_connection_to_host.h index 5de9521..e7bdbad 100644 --- a/remoting/protocol/ice_connection_to_host.h +++ b/remoting/protocol/ice_connection_to_host.h
@@ -25,8 +25,7 @@ #include "remoting/protocol/session.h" #include "remoting/protocol/session_config.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class AudioDecodeScheduler; class AudioReader; @@ -114,7 +113,6 @@ SEQUENCE_CHECKER(sequence_checker_); }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_ICE_CONNECTION_TO_HOST_H_
diff --git a/remoting/protocol/ice_transport.cc b/remoting/protocol/ice_transport.cc index 30be726..40dd569b 100644 --- a/remoting/protocol/ice_transport.cc +++ b/remoting/protocol/ice_transport.cc
@@ -15,8 +15,7 @@ #include "remoting/protocol/stream_message_pipe_adapter.h" #include "remoting/protocol/transport_context.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Delay after candidate creation before sending transport-info message to // accumulate multiple candidates. This is an optimization to reduce number of @@ -53,7 +52,8 @@ weak_factory_.GetWeakPtr())); } -bool IceTransport::ProcessTransportInfo(jingle_xmpp::XmlElement* transport_info_xml) { +bool IceTransport::ProcessTransportInfo( + jingle_xmpp::XmlElement* transport_info_xml) { IceTransportInfo transport_info; if (!transport_info.ParseXml(transport_info_xml)) return false; @@ -204,5 +204,4 @@ event_handler_->OnIceTransportError(error ? CHANNEL_CONNECTION_ERROR : OK); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/ice_transport.h b/remoting/protocol/ice_transport.h index 478a7664..60018a3d 100644 --- a/remoting/protocol/ice_transport.h +++ b/remoting/protocol/ice_transport.h
@@ -16,8 +16,7 @@ #include "remoting/protocol/jingle_messages.h" #include "remoting/protocol/transport.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class ChannelMultiplexer; class PseudoTcpChannelFactory; @@ -113,7 +112,6 @@ base::WeakPtrFactory<IceTransport> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_ICE_TRANSPORT_H_
diff --git a/remoting/protocol/ice_transport_channel.cc b/remoting/protocol/ice_transport_channel.cc index 48e34f3..c67c204 100644 --- a/remoting/protocol/ice_transport_channel.cc +++ b/remoting/protocol/ice_transport_channel.cc
@@ -22,8 +22,7 @@ #include "third_party/webrtc/p2p/base/packet_transport_internal.h" #include "third_party/webrtc/p2p/base/port.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -58,7 +57,7 @@ IceTransportChannel::~IceTransportChannel() { DCHECK(delegate_); - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); delegate_->OnChannelDeleted(this); @@ -72,7 +71,7 @@ void IceTransportChannel::Connect(const std::string& name, Delegate* delegate, ConnectedCallback callback) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(!name.empty()); DCHECK(delegate); DCHECK(!callback.is_null()); @@ -144,7 +143,7 @@ void IceTransportChannel::SetRemoteCredentials(const std::string& ufrag, const std::string& password) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); remote_ice_username_fragment_ = ufrag; remote_ice_password_ = password; @@ -155,7 +154,7 @@ void IceTransportChannel::AddRemoteCandidate( const cricket::Candidate& candidate) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // To enforce the no-relay setting, it's not enough to not produce relay // candidates. It's also necessary to discard remote relay candidates. @@ -172,19 +171,19 @@ } const std::string& IceTransportChannel::name() const { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return name_; } bool IceTransportChannel::is_connected() const { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return callback_.is_null(); } void IceTransportChannel::OnCandidateGathered( cricket::IceTransportInternal* ice_transport, const cricket::Candidate& candidate) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); delegate_->OnChannelCandidate(this, candidate); } @@ -274,5 +273,4 @@ channel_->SetIceCredentials(ice_username_fragment_, ice_password); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/ice_transport_channel.h b/remoting/protocol/ice_transport_channel.h index 7f7d5afb..fe3eb50 100644 --- a/remoting/protocol/ice_transport_channel.h +++ b/remoting/protocol/ice_transport_channel.h
@@ -28,8 +28,7 @@ class PortAllocator; } // namespace cricket -namespace remoting { -namespace protocol { +namespace remoting::protocol { class P2PDatagramSocket; class TransportContext; @@ -133,12 +132,11 @@ int connect_attempts_left_; base::RepeatingTimer reconnect_timer_; - base::ThreadChecker thread_checker_; + THREAD_CHECKER(thread_checker_); base::WeakPtrFactory<IceTransportChannel> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_ICE_TRANSPORT_CHANNEL_H_
diff --git a/remoting/protocol/ice_transport_unittest.cc b/remoting/protocol/ice_transport_unittest.cc index f0ea39ab..3045e93 100644 --- a/remoting/protocol/ice_transport_unittest.cc +++ b/remoting/protocol/ice_transport_unittest.cc
@@ -32,8 +32,7 @@ using testing::_; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -371,5 +370,4 @@ tester.RunAndCheckResults(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/input_event_timestamps.cc b/remoting/protocol/input_event_timestamps.cc index e4dcbb69..ba8867d 100644 --- a/remoting/protocol/input_event_timestamps.cc +++ b/remoting/protocol/input_event_timestamps.cc
@@ -4,8 +4,7 @@ #include "remoting/protocol/input_event_timestamps.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { InputEventTimestampsSourceImpl::InputEventTimestampsSourceImpl() = default; InputEventTimestampsSourceImpl::~InputEventTimestampsSourceImpl() = default; @@ -21,5 +20,4 @@ return result; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/input_event_timestamps.h b/remoting/protocol/input_event_timestamps.h index 2bf84cf..6e588f6 100644 --- a/remoting/protocol/input_event_timestamps.h +++ b/remoting/protocol/input_event_timestamps.h
@@ -8,8 +8,7 @@ #include "base/memory/ref_counted.h" #include "base/time/time.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Used on the host side to track timestamps for input events. struct InputEventTimestamps { @@ -29,7 +28,7 @@ class InputEventTimestampsSource : public base::RefCountedThreadSafe<InputEventTimestampsSource> { public: - InputEventTimestampsSource() {} + InputEventTimestampsSource() = default; // Returns event timestamps for the input event that was received since the // previous call. Null InputEventTimestamps value is returned if no input @@ -39,7 +38,7 @@ protected: friend base::RefCountedThreadSafe<InputEventTimestampsSource>; - virtual ~InputEventTimestampsSource() {} + virtual ~InputEventTimestampsSource() = default; }; // Simple implementations of InputEventTimestampsSource that just stores the @@ -60,7 +59,6 @@ InputEventTimestamps last_timestamps_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_INPUT_EVENT_TIMESTAMPS_H_
diff --git a/remoting/protocol/input_event_tracker.cc b/remoting/protocol/input_event_tracker.cc index 57269d0..e5c3047 100644 --- a/remoting/protocol/input_event_tracker.cc +++ b/remoting/protocol/input_event_tracker.cc
@@ -7,8 +7,7 @@ #include "base/check.h" #include "remoting/proto/event.pb.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { InputEventTracker::InputEventTracker() = default; @@ -164,5 +163,4 @@ input_stub_->InjectTouchEvent(event); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/input_event_tracker.h b/remoting/protocol/input_event_tracker.h index 2a7b728..eb54a63 100644 --- a/remoting/protocol/input_event_tracker.h +++ b/remoting/protocol/input_event_tracker.h
@@ -15,8 +15,7 @@ #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" #include "ui/events/keycodes/dom/dom_code.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Filtering InputStub which tracks mouse and keyboard input events before // passing them on to |input_stub|, and can dispatch release events to @@ -68,7 +67,6 @@ std::set<uint32_t> touch_point_ids_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_
diff --git a/remoting/protocol/input_event_tracker_unittest.cc b/remoting/protocol/input_event_tracker_unittest.cc index 47a4ed4c..bf8ed40 100644 --- a/remoting/protocol/input_event_tracker_unittest.cc +++ b/remoting/protocol/input_event_tracker_unittest.cc
@@ -16,8 +16,7 @@ using ::testing::ExpectationSet; using ::testing::InSequence; -namespace remoting { -namespace protocol { +namespace remoting::protocol { using test::EqualsKeyEventWithCapsLock; using test::EqualsMouseEvent; @@ -353,5 +352,4 @@ input_tracker.ReleaseAll(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/input_filter.cc b/remoting/protocol/input_filter.cc index d5bd16c3..cc1b0f7 100644 --- a/remoting/protocol/input_filter.cc +++ b/remoting/protocol/input_filter.cc
@@ -4,8 +4,7 @@ #include "remoting/protocol/input_filter.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { InputFilter::InputFilter() : input_stub_(nullptr), enabled_(true) { } @@ -36,5 +35,4 @@ input_stub_->InjectTouchEvent(event); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/input_filter.h b/remoting/protocol/input_filter.h index bb5cb567..d144377 100644 --- a/remoting/protocol/input_filter.h +++ b/remoting/protocol/input_filter.h
@@ -9,8 +9,7 @@ #include "base/memory/raw_ptr.h" #include "remoting/protocol/input_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Forwards input events to |input_stub|, if configured. Input forwarding may // also be disabled independently of the |input_stub| being set. InputFilters @@ -49,7 +48,6 @@ bool enabled_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_INPUT_FILTER_H_
diff --git a/remoting/protocol/input_filter_unittest.cc b/remoting/protocol/input_filter_unittest.cc index 952a1ebd..95f27d05 100644 --- a/remoting/protocol/input_filter_unittest.cc +++ b/remoting/protocol/input_filter_unittest.cc
@@ -14,8 +14,7 @@ using ::testing::_; -namespace remoting { -namespace protocol { +namespace remoting::protocol { using test::EqualsKeyEvent; using test::EqualsMouseMoveEvent; @@ -82,5 +81,4 @@ InjectTestSequence(&input_filter); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/input_stub.h b/remoting/protocol/input_stub.h index 5469489..878097b 100644 --- a/remoting/protocol/input_stub.h +++ b/remoting/protocol/input_stub.h
@@ -8,8 +8,7 @@ #ifndef REMOTING_PROTOCOL_INPUT_STUB_H_ #define REMOTING_PROTOCOL_INPUT_STUB_H_ -namespace remoting { -namespace protocol { +namespace remoting::protocol { class KeyEvent; class TextEvent; @@ -18,22 +17,21 @@ class InputStub { public: - InputStub() {} + InputStub() = default; InputStub(const InputStub&) = delete; InputStub& operator=(const InputStub&) = delete; - virtual ~InputStub() {} + virtual ~InputStub() = default; - // Implementations must never assume the presence of any |event| fields, - // nor assume that their contents are valid. + // Implementations must never assume the presence of any |event| fields, nor + // assume that their contents are valid. virtual void InjectKeyEvent(const KeyEvent& event) = 0; virtual void InjectTextEvent(const TextEvent& event) = 0; virtual void InjectMouseEvent(const MouseEvent& event) = 0; virtual void InjectTouchEvent(const TouchEvent& event) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_INPUT_STUB_H_
diff --git a/remoting/protocol/it2me_host_authenticator_factory.cc b/remoting/protocol/it2me_host_authenticator_factory.cc index f48f0c27..24c0faf 100644 --- a/remoting/protocol/it2me_host_authenticator_factory.cc +++ b/remoting/protocol/it2me_host_authenticator_factory.cc
@@ -12,8 +12,7 @@ #include "remoting/protocol/negotiating_host_authenticator.h" #include "remoting/protocol/validating_authenticator.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { It2MeHostAuthenticatorFactory::It2MeHostAuthenticatorFactory( const std::string& local_cert, @@ -40,5 +39,4 @@ remote_jid, std::move(validation_callback_), std::move(authenticator)); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/jingle_messages.cc b/remoting/protocol/jingle_messages.cc index 7a0ef5dd..cebab92c 100644 --- a/remoting/protocol/jingle_messages.cc +++ b/remoting/protocol/jingle_messages.cc
@@ -18,8 +18,7 @@ using jingle_xmpp::QName; using jingle_xmpp::XmlElement; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -560,5 +559,4 @@ return result; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/jingle_messages.h b/remoting/protocol/jingle_messages.h index 3731526..cbc4f4b 100644 --- a/remoting/protocol/jingle_messages.h +++ b/remoting/protocol/jingle_messages.h
@@ -14,8 +14,7 @@ #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" #include "third_party/webrtc/api/candidate.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class ContentDescription; @@ -153,7 +152,6 @@ std::list<NamedCandidate> candidates; }; -} // protocol -} // remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_JINGLE_MESSAGES_H_
diff --git a/remoting/protocol/jingle_messages_unittest.cc b/remoting/protocol/jingle_messages_unittest.cc index d7513798..20da694 100644 --- a/remoting/protocol/jingle_messages_unittest.cc +++ b/remoting/protocol/jingle_messages_unittest.cc
@@ -17,8 +17,7 @@ using jingle_xmpp::XmlAttr; using jingle_xmpp::XmlElement; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -634,5 +633,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc index 90603619..d23d449c 100644 --- a/remoting/protocol/jingle_session.cc +++ b/remoting/protocol/jingle_session.cc
@@ -32,8 +32,7 @@ using jingle_xmpp::XmlElement; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -199,25 +198,25 @@ message_queue_(new OrderedMessageQueue) {} JingleSession::~JingleSession() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); session_manager_->SessionDestroyed(this); } void JingleSession::SetEventHandler(Session::EventHandler* event_handler) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(event_handler); event_handler_ = event_handler; } ErrorCode JingleSession::error() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return error_; } void JingleSession::StartConnection( const SignalingAddress& peer_address, std::unique_ptr<Authenticator> authenticator) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(authenticator.get()); DCHECK_EQ(authenticator->state(), Authenticator::MESSAGE_READY); @@ -244,7 +243,7 @@ const std::string& message_id, const JingleMessage& initiate_message, std::unique_ptr<Authenticator> authenticator) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(initiate_message.description.get()); DCHECK(authenticator.get()); DCHECK_EQ(authenticator->state(), Authenticator::WAITING_MESSAGE); @@ -322,17 +321,17 @@ } const std::string& JingleSession::jid() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return peer_address_.id(); } const SessionConfig& JingleSession::config() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return *config_; } void JingleSession::SetTransport(Transport* transport) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(!transport_); DCHECK(transport); transport_ = transport; @@ -340,7 +339,7 @@ void JingleSession::SendTransportInfo( std::unique_ptr<jingle_xmpp::XmlElement> transport_info) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_EQ(state_, AUTHENTICATED); std::unique_ptr<JingleMessage> message(new JingleMessage( @@ -363,7 +362,7 @@ } void JingleSession::Close(protocol::ErrorCode error) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (is_session_active()) { // Send session-terminate message with the appropriate error code. @@ -417,7 +416,7 @@ } void JingleSession::SendMessage(std::unique_ptr<JingleMessage> message) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (message->action != JingleMessage::SESSION_TERMINATE) { // When the host accepts session-initiate message from a client JID it @@ -454,7 +453,7 @@ JingleMessage::ActionType request_type, IqRequest* request, const jingle_xmpp::XmlElement* response) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // Delete the request from the list of pending requests. pending_requests_.erase( @@ -491,7 +490,7 @@ void JingleSession::OnTransportInfoResponse(IqRequest* request, const jingle_xmpp::XmlElement* response) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(!transport_info_requests_.empty()); // Consider transport-info requests sent before this one lost and delete @@ -537,7 +536,7 @@ void JingleSession::ProcessIncomingMessage( std::unique_ptr<JingleMessage> message, ReplyCallback reply_callback) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (peer_address_ != message->from) { // Ignore messages received from a different Jid. @@ -718,7 +717,7 @@ } void JingleSession::ProcessAuthenticationStep() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_NE(authenticator_->state(), Authenticator::PROCESSING_MESSAGE); if (state_ != ACCEPTED && state_ != AUTHENTICATING) { @@ -774,7 +773,7 @@ } void JingleSession::SetState(State new_state) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (new_state != state_) { DCHECK_NE(state_, CLOSED); @@ -829,5 +828,4 @@ return outgoing_id_prefix_ + "_" + base::NumberToString(++next_outgoing_id_); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h index 39349f5..a6fedb6f 100644 --- a/remoting/protocol/jingle_session.h +++ b/remoting/protocol/jingle_session.h
@@ -22,15 +22,14 @@ #include "remoting/protocol/session_config.h" #include "remoting/signaling/iq_sender.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class JingleSessionManager; class Transport; -// JingleSessionManager and JingleSession implement the subset of the -// Jingle protocol used in Chromoting. Instances of this class are -// created by the JingleSessionManager. +// JingleSessionManager and JingleSession implement the subset of the Jingle +// protocol used in Chromoting. Instances of this class are created by the +// JingleSessionManager. class JingleSession : public Session { public: JingleSession(const JingleSession&) = delete; @@ -136,8 +135,6 @@ // sequence ID encoded. std::string GetNextOutgoingId(); - base::ThreadChecker thread_checker_; - raw_ptr<JingleSessionManager> session_manager_; SignalingAddress peer_address_; raw_ptr<Session::EventHandler> event_handler_; @@ -185,10 +182,11 @@ // The SessionPlugins attached to this session. std::vector<SessionPlugin*> plugins_; + THREAD_CHECKER(thread_checker_); + base::WeakPtrFactory<JingleSession> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_
diff --git a/remoting/protocol/jingle_session_manager.cc b/remoting/protocol/jingle_session_manager.cc index 41141c8..6f615b9 100644 --- a/remoting/protocol/jingle_session_manager.cc +++ b/remoting/protocol/jingle_session_manager.cc
@@ -20,8 +20,7 @@ using jingle_xmpp::QName; -namespace remoting { -namespace protocol { +namespace remoting::protocol { JingleSessionManager::JingleSessionManager(SignalStrategy* signal_strategy) : signal_strategy_(signal_strategy), @@ -152,5 +151,4 @@ sessions_.erase(session->session_id_); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc index fbc8190..adc1522 100644 --- a/remoting/protocol/jingle_session_unittest.cc +++ b/remoting/protocol/jingle_session_unittest.cc
@@ -48,8 +48,7 @@ using testing::SetArgPointee; using testing::WithArg; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -637,5 +636,4 @@ ASSERT_EQ(1U, host_signal_strategy_->received_messages().size()); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/keyboard_layout_stub.h b/remoting/protocol/keyboard_layout_stub.h index 999db726..f4e2c21 100644 --- a/remoting/protocol/keyboard_layout_stub.h +++ b/remoting/protocol/keyboard_layout_stub.h
@@ -7,8 +7,7 @@ #ifndef REMOTING_PROTOCOL_KEYBOARD_LAYOUT_STUB_H_ #define REMOTING_PROTOCOL_KEYBOARD_LAYOUT_STUB_H_ -namespace remoting { -namespace protocol { +namespace remoting::protocol { class KeyboardLayout; @@ -25,7 +24,6 @@ KeyboardLayoutStub() = default; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_KEYBOARD_LAYOUT_STUB_H_
diff --git a/remoting/protocol/me2me_host_authenticator_factory.cc b/remoting/protocol/me2me_host_authenticator_factory.cc index 3aa9455..6af34f07 100644 --- a/remoting/protocol/me2me_host_authenticator_factory.cc +++ b/remoting/protocol/me2me_host_authenticator_factory.cc
@@ -19,8 +19,7 @@ #include "remoting/signaling/signaling_id_util.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // static std::unique_ptr<AuthenticatorFactory> @@ -125,5 +124,4 @@ Authenticator::RejectionReason::INVALID_CREDENTIALS)); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/message_channel_factory.h b/remoting/protocol/message_channel_factory.h index d0cd6f0..52f0655 100644 --- a/remoting/protocol/message_channel_factory.h +++ b/remoting/protocol/message_channel_factory.h
@@ -10,8 +10,7 @@ #include "base/callback_forward.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class MessagePipe; @@ -36,7 +35,6 @@ virtual void CancelChannelCreation(const std::string& name) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_MESSAGE_CHANNEL_FACTORY_H_
diff --git a/remoting/protocol/message_decoder.cc b/remoting/protocol/message_decoder.cc index c8c609c..cbc89cbb 100644 --- a/remoting/protocol/message_decoder.cc +++ b/remoting/protocol/message_decoder.cc
@@ -12,13 +12,9 @@ #include "remoting/proto/internal.pb.h" #include "third_party/webrtc/rtc_base/byte_order.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { -MessageDecoder::MessageDecoder() - : next_payload_(0), - next_payload_known_(false) { -} +MessageDecoder::MessageDecoder() = default; MessageDecoder::~MessageDecoder() = default; @@ -68,5 +64,4 @@ return true; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/message_decoder.h b/remoting/protocol/message_decoder.h index de5f9c2..59cf6b5 100644 --- a/remoting/protocol/message_decoder.h +++ b/remoting/protocol/message_decoder.h
@@ -10,31 +10,29 @@ #include "remoting/base/compound_buffer.h" #include "third_party/protobuf/src/google/protobuf/message_lite.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { -// MessageDecoder uses CompoundBuffer to split the data received from -// the network into separate messages. Each message is expected to be -// decoded in the stream as follows: +// MessageDecoder uses CompoundBuffer to split the data received from the +// network into separate messages. Each message is expected to be decoded in the +// stream as follows: // +--------------+--------------+ // | message_size | message_data | // +--------------+--------------+ // -// Here, message_size is 4-byte integer that represents size of -// message_data in bytes. message_data - content of the message. +// Here, message_size is 4-byte integer that represents size of message_data in +// bytes. message_data - content of the message. class MessageDecoder { public: MessageDecoder(); virtual ~MessageDecoder(); - // Add next chunk of data. MessageDecoder retains |data| until all - // its bytes are consumed. + // Add next chunk of data. MessageDecoder retains |data| until all its bytes + // are consumed. void AddData(scoped_refptr<net::IOBuffer> data, int data_size); - // Returns next message from the stream. Ownership of the result is - // passed to the caller. Returns nullptr if there are no complete - // messages yet, otherwise returns a buffer that contains one - // message. + // Returns next message from the stream. Ownership of the result is passed to + // the caller. Returns nullptr if there are no complete messages yet, + // otherwise returns a buffer that contains one message. CompoundBuffer* GetNextMessage(); private: @@ -48,11 +46,10 @@ // |next_payload_| stores the size of the next payload if known. // |next_payload_known_| is true if the size of the next payload is known. // After one payload is read this is reset to false. - int next_payload_; - bool next_payload_known_; + int next_payload_ = 0; + bool next_payload_known_ = false; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_MESSAGE_DECODER_H_
diff --git a/remoting/protocol/message_decoder_unittest.cc b/remoting/protocol/message_decoder_unittest.cc index 7eb73f8..93b0945 100644 --- a/remoting/protocol/message_decoder_unittest.cc +++ b/remoting/protocol/message_decoder_unittest.cc
@@ -16,8 +16,7 @@ #include "remoting/protocol/message_serialization.h" #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { static const unsigned int kTestKey = 142; @@ -121,5 +120,4 @@ SimulateReadSequence(kReads, std::size(kReads)); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/message_reader.cc b/remoting/protocol/message_reader.cc index 8305dc3..9ad2c85 100644 --- a/remoting/protocol/message_reader.cc +++ b/remoting/protocol/message_reader.cc
@@ -19,12 +19,11 @@ #include "remoting/proto/internal.pb.h" #include "remoting/protocol/p2p_stream_socket.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { static const int kReadBufferSize = 4096; -MessageReader::MessageReader() {} +MessageReader::MessageReader() = default; MessageReader::~MessageReader() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } @@ -116,5 +115,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/message_reader.h b/remoting/protocol/message_reader.h index 9fbfe6f..af6de2e4 100644 --- a/remoting/protocol/message_reader.h +++ b/remoting/protocol/message_reader.h
@@ -18,22 +18,21 @@ class IOBuffer; } // namespace net -namespace remoting { -namespace protocol { +namespace remoting::protocol { class P2PStreamSocket; -// MessageReader reads data from the socket asynchronously and calls -// callback for each message it receives. It stops calling the -// callback as soon as the socket is closed, so the socket should -// always be closed before the callback handler is destroyed. +// MessageReader reads data from the socket asynchronously and calls the +// callback for each message it receives. It stops calling the callback as soon +// as the socket is closed, so the socket should always be closed before the +// callback handler is destroyed. // -// In order to throttle the stream, MessageReader doesn't try to read -// new data from the socket until all previously received messages are -// processed by the receiver (|done_task| is called for each message). -// It is still possible that the MessageReceivedCallback is called -// twice (so that there is more than one outstanding message), -// e.g. when we the sender sends multiple messages in one TCP packet. +// In order to throttle the stream, MessageReader doesn't try to read new data +// from the socket until all previously received messages are processed by the +// receiver (|done_task| is called for each message). It is still possible that +// the MessageReceivedCallback is called twice (so that there is more than one +// outstanding message), e.g. when we the sender sends multiple messages in one +// TCP packet. class MessageReader { public: typedef base::RepeatingCallback<void(std::unique_ptr<CompoundBuffer> message)> @@ -83,7 +82,6 @@ base::WeakPtrFactory<MessageReader> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_MESSAGE_READER_H_
diff --git a/remoting/protocol/message_reader_unittest.cc b/remoting/protocol/message_reader_unittest.cc index 907dfc7..adafe946 100644 --- a/remoting/protocol/message_reader_unittest.cc +++ b/remoting/protocol/message_reader_unittest.cc
@@ -24,8 +24,7 @@ using testing::Mock; using testing::SaveArg; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { const char kTestMessage1[] = "Message1"; @@ -199,5 +198,4 @@ base::RunLoop().RunUntilIdle(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/message_serialization.cc b/remoting/protocol/message_serialization.cc index 9acf4208..cf4a327 100644 --- a/remoting/protocol/message_serialization.cc +++ b/remoting/protocol/message_serialization.cc
@@ -9,8 +9,7 @@ #include "net/base/io_buffer.h" #include "third_party/webrtc/rtc_base/byte_order.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { scoped_refptr<net::IOBufferWithSize> SerializeAndFrameMessage( const google::protobuf::MessageLite& msg) { @@ -26,5 +25,4 @@ return buffer; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/message_serialization.h b/remoting/protocol/message_serialization.h index 6c1fe41..9a91ba3 100644 --- a/remoting/protocol/message_serialization.h +++ b/remoting/protocol/message_serialization.h
@@ -13,8 +13,7 @@ #include "remoting/base/compound_buffer.h" #include "third_party/protobuf/src/google/protobuf/message_lite.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { template <class T> std::unique_ptr<T> ParseMessage(CompoundBuffer* buffer) { @@ -35,7 +34,6 @@ scoped_refptr<net::IOBufferWithSize> SerializeAndFrameMessage( const google::protobuf::MessageLite& msg); -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_MESSAGE_SERIALIZATION_H_
diff --git a/remoting/protocol/monitored_video_stub.cc b/remoting/protocol/monitored_video_stub.cc index bca113f..cae8986 100644 --- a/remoting/protocol/monitored_video_stub.cc +++ b/remoting/protocol/monitored_video_stub.cc
@@ -10,8 +10,7 @@ #include "base/check.h" #include "remoting/proto/video.pb.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { MonitoredVideoStub::MonitoredVideoStub(VideoStub* video_stub, base::TimeDelta connectivity_check_delay, @@ -27,12 +26,12 @@ } MonitoredVideoStub::~MonitoredVideoStub() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } void MonitoredVideoStub::ProcessVideoPacket(std::unique_ptr<VideoPacket> packet, base::OnceClosure done) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); connectivity_check_timer_.Reset(); @@ -42,7 +41,7 @@ } void MonitoredVideoStub::OnConnectivityCheckTimeout() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); NotifyChannelState(false); } @@ -53,5 +52,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/monitored_video_stub.h b/remoting/protocol/monitored_video_stub.h index 289346c..11dddd4 100644 --- a/remoting/protocol/monitored_video_stub.h +++ b/remoting/protocol/monitored_video_stub.h
@@ -11,12 +11,7 @@ #include "base/timer/timer.h" #include "remoting/protocol/video_stub.h" -namespace base { -class ThreadChecker; -} // namespace base - -namespace remoting { -namespace protocol { +namespace remoting::protocol { // MonitoredVideoStub is responsible for notifying the event handler if no // frames have been received within |connectivity_check_delay|. @@ -54,12 +49,12 @@ raw_ptr<VideoStub> video_stub_; ChannelStateCallback callback_; - base::ThreadChecker thread_checker_; bool is_connected_; base::DelayTimer connectivity_check_timer_; + + THREAD_CHECKER(thread_checker_); }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_MONITORED_VIDEO_STUB_H_
diff --git a/remoting/protocol/monitored_video_stub_unittest.cc b/remoting/protocol/monitored_video_stub_unittest.cc index 6739c3f..7e82d37 100644 --- a/remoting/protocol/monitored_video_stub_unittest.cc +++ b/remoting/protocol/monitored_video_stub_unittest.cc
@@ -24,8 +24,7 @@ using ::testing::AtMost; using ::testing::InvokeWithoutArgs; -namespace remoting { -namespace protocol { +namespace remoting::protocol { static const int64_t kTestOverrideDelayMilliseconds = 1; @@ -97,5 +96,4 @@ base::RunLoop().Run(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/mouse_input_filter.cc b/remoting/protocol/mouse_input_filter.cc index 647980b2..ca51989 100644 --- a/remoting/protocol/mouse_input_filter.cc +++ b/remoting/protocol/mouse_input_filter.cc
@@ -11,8 +11,7 @@ #include "remoting/base/logging.h" #include "remoting/proto/event.pb.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { MouseInputFilter::MouseInputFilter() = default; @@ -79,5 +78,4 @@ return base::clamp(y, 0, output_bounds_.y()); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/mouse_input_filter.h b/remoting/protocol/mouse_input_filter.h index aa66bfc..27605328 100644 --- a/remoting/protocol/mouse_input_filter.h +++ b/remoting/protocol/mouse_input_filter.h
@@ -10,8 +10,7 @@ #include "remoting/protocol/input_filter.h" #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Filtering InputStub implementation which scales mouse events based on the // supplied input and output dimensions, and clamps their coordinates to the @@ -53,7 +52,6 @@ webrtc::DesktopVector output_offset_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_MOUSE_INPUT_FILTER_H_
diff --git a/remoting/protocol/mouse_input_filter_unittest.cc b/remoting/protocol/mouse_input_filter_unittest.cc index 0760373..177ec1c 100644 --- a/remoting/protocol/mouse_input_filter_unittest.cc +++ b/remoting/protocol/mouse_input_filter_unittest.cc
@@ -14,8 +14,7 @@ using ::testing::_; using ::testing::InSequence; -namespace remoting { -namespace protocol { +namespace remoting::protocol { using test::EqualsMouseMoveEvent; @@ -265,5 +264,4 @@ RunMouseTests(std::size(expected), injected, expected); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/named_message_pipe_handler.cc b/remoting/protocol/named_message_pipe_handler.cc index 8058fc6..91498bf 100644 --- a/remoting/protocol/named_message_pipe_handler.cc +++ b/remoting/protocol/named_message_pipe_handler.cc
@@ -11,8 +11,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "remoting/base/compound_buffer.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { NamedMessagePipeHandler::NamedMessagePipeHandler( const std::string& name, @@ -26,7 +25,7 @@ NamedMessagePipeHandler::~NamedMessagePipeHandler() = default; void NamedMessagePipeHandler::Close() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (connected()) { OnDisconnecting(); is_connected_ = false; @@ -36,7 +35,7 @@ void NamedMessagePipeHandler::Send(const google::protobuf::MessageLite& message, base::OnceClosure done) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(connected()); pipe_->Send(const_cast<google::protobuf::MessageLite*>(&message), std::move(done)); @@ -50,7 +49,7 @@ void NamedMessagePipeHandler::OnDisconnecting() {} void NamedMessagePipeHandler::OnMessagePipeOpen() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(!is_connected_); is_connected_ = true; OnConnected(); @@ -58,7 +57,7 @@ void NamedMessagePipeHandler::OnMessageReceived( std::unique_ptr<CompoundBuffer> message) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); OnIncomingMessage(std::move(message)); } @@ -66,5 +65,4 @@ Close(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/named_message_pipe_handler.h b/remoting/protocol/named_message_pipe_handler.h index e240cc6..49c2c68 100644 --- a/remoting/protocol/named_message_pipe_handler.h +++ b/remoting/protocol/named_message_pipe_handler.h
@@ -69,8 +69,9 @@ const std::string name_; std::unique_ptr<MessagePipe> pipe_; - base::ThreadChecker thread_checker_; bool is_connected_ = false; + + THREAD_CHECKER(thread_checker_); }; } // namespace protocol
diff --git a/remoting/protocol/negotiating_authenticator_base.cc b/remoting/protocol/negotiating_authenticator_base.cc index d5c1b17..eeda7263 100644 --- a/remoting/protocol/negotiating_authenticator_base.cc +++ b/remoting/protocol/negotiating_authenticator_base.cc
@@ -18,8 +18,7 @@ #include "remoting/protocol/channel_authenticator.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -165,5 +164,4 @@ return current_authenticator_->CreateChannelAuthenticator(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/negotiating_authenticator_base.h b/remoting/protocol/negotiating_authenticator_base.h index 0312cf3..58a57c2 100644 --- a/remoting/protocol/negotiating_authenticator_base.h +++ b/remoting/protocol/negotiating_authenticator_base.h
@@ -17,8 +17,7 @@ struct StaticQName; } // namespace jingle_xmpp -namespace remoting { -namespace protocol { +namespace remoting::protocol { // This class provides the common base for a meta-authenticator that allows // clients and hosts that support multiple authentication methods to negotiate a @@ -143,7 +142,6 @@ RejectionReason rejection_reason_ = RejectionReason::INVALID_CREDENTIALS; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_BASE_H_
diff --git a/remoting/protocol/negotiating_authenticator_unittest.cc b/remoting/protocol/negotiating_authenticator_unittest.cc index 135c8136b..511217cd 100644 --- a/remoting/protocol/negotiating_authenticator_unittest.cc +++ b/remoting/protocol/negotiating_authenticator_unittest.cc
@@ -26,8 +26,7 @@ using testing::DeleteArg; using testing::SaveArg; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -320,5 +319,4 @@ VerifyRejected(Authenticator::RejectionReason::INVALID_CREDENTIALS); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/negotiating_client_authenticator.cc b/remoting/protocol/negotiating_client_authenticator.cc index 47efd58..0616380 100644 --- a/remoting/protocol/negotiating_client_authenticator.cc +++ b/remoting/protocol/negotiating_client_authenticator.cc
@@ -22,8 +22,7 @@ #include "remoting/protocol/v2_authenticator.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { NegotiatingClientAuthenticator::NegotiatingClientAuthenticator( const std::string& local_id, @@ -220,5 +219,4 @@ return !config_.pairing_client_id.empty() && !config_.pairing_secret.empty(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/negotiating_client_authenticator.h b/remoting/protocol/negotiating_client_authenticator.h index 3ea09e2..fb9f015 100644 --- a/remoting/protocol/negotiating_client_authenticator.h +++ b/remoting/protocol/negotiating_client_authenticator.h
@@ -15,8 +15,7 @@ #include "remoting/protocol/negotiating_authenticator_base.h" #include "remoting/protocol/third_party_client_authenticator.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Client-side implementation of NegotiatingAuthenticatorBase. // See comments in negotiating_authenticator_base.h for a general explanation. @@ -77,7 +76,6 @@ base::WeakPtrFactory<NegotiatingClientAuthenticator> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_NEGOTIATING_CLIENT_AUTHENTICATOR_H_
diff --git a/remoting/protocol/negotiating_host_authenticator.cc b/remoting/protocol/negotiating_host_authenticator.cc index efd3ec8..9ab4ac2 100644 --- a/remoting/protocol/negotiating_host_authenticator.cc +++ b/remoting/protocol/negotiating_host_authenticator.cc
@@ -23,8 +23,7 @@ #include "remoting/protocol/v2_authenticator.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { NegotiatingHostAuthenticator::NegotiatingHostAuthenticator( const std::string& local_id, @@ -246,5 +245,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/network_settings.h b/remoting/protocol/network_settings.h index 4645efb..7838112c 100644 --- a/remoting/protocol/network_settings.h +++ b/remoting/protocol/network_settings.h
@@ -10,8 +10,7 @@ #include "base/time/time.h" #include "remoting/protocol/port_range.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { struct NetworkSettings { @@ -58,7 +57,6 @@ int ice_reconnect_attempts = 2; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_NETWORK_SETTINGS_H_
diff --git a/remoting/protocol/p2p_datagram_socket.h b/remoting/protocol/p2p_datagram_socket.h index 10e39da..fae09c5 100644 --- a/remoting/protocol/p2p_datagram_socket.h +++ b/remoting/protocol/p2p_datagram_socket.h
@@ -11,8 +11,7 @@ class IOBuffer; } // namespace net -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Peer-to-peer socket with datagram semantics. class P2PDatagramSocket { @@ -45,7 +44,6 @@ const net::CompletionRepeatingCallback& callback) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_P2P_DATAGRAM_SOCKET_H_
diff --git a/remoting/protocol/p2p_stream_socket.h b/remoting/protocol/p2p_stream_socket.h index 2f4bbc3..f7e5feb 100644 --- a/remoting/protocol/p2p_stream_socket.h +++ b/remoting/protocol/p2p_stream_socket.h
@@ -12,8 +12,7 @@ class IOBuffer; } // namespace net -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Peer-to-peer socket with stream semantics. class P2PStreamSocket { @@ -48,7 +47,6 @@ const net::NetworkTrafficAnnotationTag& traffic_annotation) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_P2P_STREAM_SOCKET_H_
diff --git a/remoting/protocol/pairing_authenticator_base.cc b/remoting/protocol/pairing_authenticator_base.cc index 6f7ce15..8f59401d 100644 --- a/remoting/protocol/pairing_authenticator_base.cc +++ b/remoting/protocol/pairing_authenticator_base.cc
@@ -12,8 +12,7 @@ #include "remoting/base/constants.h" #include "remoting/protocol/channel_authenticator.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { const jingle_xmpp::StaticQName kPairingFailedTag = @@ -77,7 +76,8 @@ weak_factory_.GetWeakPtr(), std::move(resume_callback))); } -std::unique_ptr<jingle_xmpp::XmlElement> PairingAuthenticatorBase::GetNextMessage() { +std::unique_ptr<jingle_xmpp::XmlElement> +PairingAuthenticatorBase::GetNextMessage() { DCHECK_EQ(state(), MESSAGE_READY); std::unique_ptr<jingle_xmpp::XmlElement> result = spake2_authenticator_->GetNextMessage(); @@ -94,7 +94,8 @@ return spake2_authenticator_->CreateChannelAuthenticator(); } -void PairingAuthenticatorBase::MaybeAddErrorMessage(jingle_xmpp::XmlElement* message) { +void PairingAuthenticatorBase::MaybeAddErrorMessage( + jingle_xmpp::XmlElement* message) { if (!error_message_.empty()) { jingle_xmpp::XmlElement* pairing_failed_tag = new jingle_xmpp::XmlElement(kPairingFailedTag); @@ -134,5 +135,4 @@ std::move(resume_callback).Run(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/pairing_authenticator_base.h b/remoting/protocol/pairing_authenticator_base.h index 9424deb3..db31bd0 100644 --- a/remoting/protocol/pairing_authenticator_base.h +++ b/remoting/protocol/pairing_authenticator_base.h
@@ -9,8 +9,7 @@ #include "remoting/protocol/authenticator.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // The pairing authenticator builds on top of V2Authenticator to add // support for PIN-less authentication via device pairing: @@ -86,7 +85,6 @@ base::WeakPtrFactory<PairingAuthenticatorBase> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_BASE_H_
diff --git a/remoting/protocol/pairing_client_authenticator.cc b/remoting/protocol/pairing_client_authenticator.cc index bd6874e..aff300c8 100644 --- a/remoting/protocol/pairing_client_authenticator.cc +++ b/remoting/protocol/pairing_client_authenticator.cc
@@ -11,8 +11,7 @@ #include "remoting/protocol/channel_authenticator.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { PairingClientAuthenticator::PairingClientAuthenticator( const ClientAuthenticationConfig& client_auth_config, @@ -74,5 +73,4 @@ std::move(resume_callback).Run(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/pairing_client_authenticator.h b/remoting/protocol/pairing_client_authenticator.h index 31ae776c..dbfa62c 100644 --- a/remoting/protocol/pairing_client_authenticator.h +++ b/remoting/protocol/pairing_client_authenticator.h
@@ -9,8 +9,7 @@ #include "remoting/protocol/client_authentication_config.h" #include "remoting/protocol/pairing_authenticator_base.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class PairingClientAuthenticator : public PairingAuthenticatorBase { public: @@ -58,7 +57,6 @@ base::WeakPtrFactory<PairingClientAuthenticator> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_PAIRING_CLIENT_AUTHENTICATOR_H_
diff --git a/remoting/protocol/pairing_host_authenticator.cc b/remoting/protocol/pairing_host_authenticator.cc index 788d401..4a68046 100644 --- a/remoting/protocol/pairing_host_authenticator.cc +++ b/remoting/protocol/pairing_host_authenticator.cc
@@ -12,8 +12,7 @@ #include "remoting/protocol/channel_authenticator.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { PairingHostAuthenticator::PairingHostAuthenticator( scoped_refptr<PairingRegistry> pairing_registry, @@ -96,5 +95,4 @@ std::move(resume_callback).Run(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/pairing_host_authenticator.h b/remoting/protocol/pairing_host_authenticator.h index 26e789bb..3df87db 100644 --- a/remoting/protocol/pairing_host_authenticator.h +++ b/remoting/protocol/pairing_host_authenticator.h
@@ -9,8 +9,7 @@ #include "remoting/protocol/pairing_authenticator_base.h" #include "remoting/protocol/pairing_registry.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class PairingRegistry; @@ -58,7 +57,6 @@ base::WeakPtrFactory<PairingHostAuthenticator> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_PAIRING_HOST_AUTHENTICATOR_H_
diff --git a/remoting/protocol/pairing_registry.cc b/remoting/protocol/pairing_registry.cc index c64ef763..bac1729 100644 --- a/remoting/protocol/pairing_registry.cc +++ b/remoting/protocol/pairing_registry.cc
@@ -20,8 +20,7 @@ #include "base/values.h" #include "crypto/random.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // How many bytes of random data to use for the shared secret. const int kKeySize = 16; @@ -293,5 +292,4 @@ std::move(pending_requests_.front())); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/pairing_registry.h b/remoting/protocol/pairing_registry.h index 21991d3c..2d84fca 100644 --- a/remoting/protocol/pairing_registry.h +++ b/remoting/protocol/pairing_registry.h
@@ -22,8 +22,7 @@ class SingleThreadTaskRunner; } // namespace base -namespace remoting { -namespace protocol { +namespace remoting::protocol { // PairingRegistry holds information about paired clients to support // PIN-less authentication. For each paired client, the registry holds @@ -185,7 +184,6 @@ base::queue<base::OnceClosure> pending_requests_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_PAIRING_REGISTRY_H_
diff --git a/remoting/protocol/pairing_registry_unittest.cc b/remoting/protocol/pairing_registry_unittest.cc index 4c11d65..9b91a48 100644 --- a/remoting/protocol/pairing_registry_unittest.cc +++ b/remoting/protocol/pairing_registry_unittest.cc
@@ -56,8 +56,7 @@ } // namespace -namespace remoting { -namespace protocol { +namespace remoting::protocol { class PairingRegistryTest : public testing::Test { public: @@ -250,5 +249,4 @@ run_loop_.Run(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/peer_connection_controls.h b/remoting/protocol/peer_connection_controls.h index 2d2198a5..a71a3d02 100644 --- a/remoting/protocol/peer_connection_controls.h +++ b/remoting/protocol/peer_connection_controls.h
@@ -7,8 +7,7 @@ #include "third_party/abseil-cpp/absl/types/optional.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Interface for changing peer connection parameters after the connection is // established. @@ -33,7 +32,6 @@ virtual void RequestSdpRestart() = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_PEER_CONNECTION_CONTROLS_H_
diff --git a/remoting/protocol/performance_tracker.cc b/remoting/protocol/performance_tracker.cc index c5ac5740..177f46a 100644 --- a/remoting/protocol/performance_tracker.cc +++ b/remoting/protocol/performance_tracker.cc
@@ -18,8 +18,7 @@ } // namespace -namespace remoting { -namespace protocol { +namespace remoting::protocol { PerformanceTracker::PerformanceTracker() : video_bandwidth_(base::Seconds(kStatsUpdatePeriodSeconds)), @@ -80,5 +79,4 @@ round_trip_ms_.Record(round_trip_latency.InMilliseconds()); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/performance_tracker.h b/remoting/protocol/performance_tracker.h index 428a8260..71623b1a 100644 --- a/remoting/protocol/performance_tracker.h +++ b/remoting/protocol/performance_tracker.h
@@ -11,8 +11,7 @@ #include "remoting/base/running_samples.h" #include "remoting/protocol/frame_stats.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // PerformanceTracker defines a bundle of performance counters and statistics // for chromoting. @@ -63,7 +62,6 @@ RunningSamples round_trip_ms_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
diff --git a/remoting/protocol/port_allocator.cc b/remoting/protocol/port_allocator.cc index 8f20923..56238ee 100644 --- a/remoting/protocol/port_allocator.cc +++ b/remoting/protocol/port_allocator.cc
@@ -13,8 +13,7 @@ #include "remoting/protocol/transport_context.h" #include "third_party/abseil-cpp/absl/strings/string_view.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { PortAllocator::PortAllocator( std::unique_ptr<rtc::NetworkManager> network_manager, @@ -105,5 +104,4 @@ return config; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/port_allocator.h b/remoting/protocol/port_allocator.h index 3b0a659..45329091 100644 --- a/remoting/protocol/port_allocator.h +++ b/remoting/protocol/port_allocator.h
@@ -14,8 +14,7 @@ #include "third_party/abseil-cpp/absl/strings/string_view.h" #include "third_party/webrtc/p2p/client/basic_port_allocator.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class PortAllocator : public cricket::BasicPortAllocator { public: @@ -71,7 +70,6 @@ base::WeakPtrFactory<PortAllocatorSession> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_PORT_ALLOCATOR_H_
diff --git a/remoting/protocol/port_allocator_factory.h b/remoting/protocol/port_allocator_factory.h index 4ac6e2c..a0412e15 100644 --- a/remoting/protocol/port_allocator_factory.h +++ b/remoting/protocol/port_allocator_factory.h
@@ -14,8 +14,7 @@ class PortAllocator; } // namespace cricket -namespace remoting { -namespace protocol { +namespace remoting::protocol { class SessionOptionsProvider; class TransportContext; @@ -31,7 +30,6 @@ base::WeakPtr<SessionOptionsProvider> session_options_provider) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_PORT_ALLOCATOR_FACTORY_H_
diff --git a/remoting/protocol/protocol_mock_objects.cc b/remoting/protocol/protocol_mock_objects.cc index 049295e..f9a3606 100644 --- a/remoting/protocol/protocol_mock_objects.cc +++ b/remoting/protocol/protocol_mock_objects.cc
@@ -13,8 +13,7 @@ #include "remoting/protocol/video_stream.h" #include "remoting/signaling/signaling_address.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { MockAuthenticator::MockAuthenticator() = default; MockAuthenticator::~MockAuthenticator() = default; @@ -100,5 +99,4 @@ std::move(task).Run(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h index 388a305..011117e8 100644 --- a/remoting/protocol/protocol_mock_objects.h +++ b/remoting/protocol/protocol_mock_objects.h
@@ -34,9 +34,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { - -namespace protocol { +namespace remoting::protocol { class MockAuthenticator : public Authenticator { public: @@ -281,7 +279,6 @@ base::OnceClosure task) override; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
diff --git a/remoting/protocol/pseudotcp_adapter.cc b/remoting/protocol/pseudotcp_adapter.cc index 437931c..acf6b87 100644 --- a/remoting/protocol/pseudotcp_adapter.cc +++ b/remoting/protocol/pseudotcp_adapter.cc
@@ -27,8 +27,7 @@ const uint16_t kDefaultMtu = 1280; } // namespace -namespace remoting { -namespace protocol { +namespace remoting::protocol { class PseudoTcpAdapter::Core : public cricket::IPseudoTcpNotify, public base::RefCounted<Core> { @@ -503,5 +502,4 @@ core_->SetWriteWaitsForSend(write_waits_for_send); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/pseudotcp_adapter.h b/remoting/protocol/pseudotcp_adapter.h index ef044f0..545155ef 100644 --- a/remoting/protocol/pseudotcp_adapter.h +++ b/remoting/protocol/pseudotcp_adapter.h
@@ -17,8 +17,7 @@ #include "remoting/protocol/p2p_stream_socket.h" #include "third_party/webrtc/p2p/base/pseudo_tcp.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class P2PDatagramSocket; @@ -89,7 +88,6 @@ SEQUENCE_CHECKER(sequence_checker_); }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_PSEUDOTCP_ADAPTER_H_
diff --git a/remoting/protocol/pseudotcp_adapter_unittest.cc b/remoting/protocol/pseudotcp_adapter_unittest.cc index b51d24c8..8d45504 100644 --- a/remoting/protocol/pseudotcp_adapter_unittest.cc +++ b/remoting/protocol/pseudotcp_adapter_unittest.cc
@@ -30,8 +30,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -441,5 +440,4 @@ } // namespace -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/pseudotcp_channel_factory.cc b/remoting/protocol/pseudotcp_channel_factory.cc index 6d66690..137cbe2 100644 --- a/remoting/protocol/pseudotcp_channel_factory.cc +++ b/remoting/protocol/pseudotcp_channel_factory.cc
@@ -13,13 +13,12 @@ #include "remoting/protocol/p2p_datagram_socket.h" #include "remoting/protocol/pseudotcp_adapter.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { -// Value is chosen to balance the extra latency against the reduced -// load due to ACK traffic. +// Value is chosen to balance the extra latency against the reduced load due to +// ACK traffic. const int kTcpAckDelayMilliseconds = 10; // Values for the TCP send and receive buffer size. This should be tuned to @@ -95,5 +94,4 @@ std::move(callback).Run(std::move(socket)); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/pseudotcp_channel_factory.h b/remoting/protocol/pseudotcp_channel_factory.h index b046c75..2818141 100644 --- a/remoting/protocol/pseudotcp_channel_factory.h +++ b/remoting/protocol/pseudotcp_channel_factory.h
@@ -10,8 +10,7 @@ #include "base/memory/raw_ptr.h" #include "remoting/protocol/stream_channel_factory.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class DatagramChannelFactory; class P2PDatagramSocket; @@ -49,7 +48,6 @@ PendingSocketsMap pending_sockets_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_
diff --git a/remoting/protocol/rejecting_authenticator.cc b/remoting/protocol/rejecting_authenticator.cc index 98637b50..ad4b695 100644 --- a/remoting/protocol/rejecting_authenticator.cc +++ b/remoting/protocol/rejecting_authenticator.cc
@@ -10,8 +10,7 @@ #include "remoting/protocol/channel_authenticator.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { RejectingAuthenticator::RejectingAuthenticator(RejectionReason rejection_reason) : rejection_reason_(rejection_reason) { @@ -56,5 +55,4 @@ return nullptr; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/rejecting_authenticator.h b/remoting/protocol/rejecting_authenticator.h index 17c2f21..1989b7b 100644 --- a/remoting/protocol/rejecting_authenticator.h +++ b/remoting/protocol/rejecting_authenticator.h
@@ -9,8 +9,7 @@ #include "remoting/protocol/authenticator.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Authenticator that accepts one message and rejects connection after that. class RejectingAuthenticator : public Authenticator { @@ -39,7 +38,6 @@ std::string auth_key_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_REJECTING_AUTHENTICATOR_H_
diff --git a/remoting/protocol/remoting_ice_config_request.cc b/remoting/protocol/remoting_ice_config_request.cc index 28e14d5..23394b956 100644 --- a/remoting/protocol/remoting_ice_config_request.cc +++ b/remoting/protocol/remoting_ice_config_request.cc
@@ -19,8 +19,7 @@ #include "remoting/protocol/ice_config.h" #include "services/network/public/cpp/shared_url_loader_factory.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -109,5 +108,4 @@ std::move(on_ice_config_callback_).Run(IceConfig::Parse(*response)); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/remoting_ice_config_request_unittest.cc b/remoting/protocol/remoting_ice_config_request_unittest.cc index 1844acd..40e22af5 100644 --- a/remoting/protocol/remoting_ice_config_request_unittest.cc +++ b/remoting/protocol/remoting_ice_config_request_unittest.cc
@@ -14,8 +14,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -88,5 +87,4 @@ EXPECT_TRUE(received_config.is_null()); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/sdp_message.cc b/remoting/protocol/sdp_message.cc index 8e0b334..c6bf667 100644 --- a/remoting/protocol/sdp_message.cc +++ b/remoting/protocol/sdp_message.cc
@@ -12,8 +12,7 @@ #include "base/strings/string_split.h" #include "base/strings/string_util.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { SdpMessage::SdpMessage(const std::string& sdp) { sdp_lines_ = base::SplitString( @@ -124,5 +123,4 @@ return results; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/sdp_message.h b/remoting/protocol/sdp_message.h index f2f7fa80..e074120e 100644 --- a/remoting/protocol/sdp_message.h +++ b/remoting/protocol/sdp_message.h
@@ -9,8 +9,7 @@ #include <string> #include <vector> -namespace remoting { -namespace protocol { +namespace remoting::protocol { // SdpMessage is used to process session descriptions messages in SDP format // generated by WebRTC (see RFC 4566). In particularly it allows configuring @@ -60,7 +59,6 @@ bool has_video_ = false; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_SDP_MESSAGE_H_
diff --git a/remoting/protocol/sdp_message_unittest.cc b/remoting/protocol/sdp_message_unittest.cc index 96d8082d..a6176eb7 100644 --- a/remoting/protocol/sdp_message_unittest.cc +++ b/remoting/protocol/sdp_message_unittest.cc
@@ -6,8 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Verify that SDP is normalized by removing empty lines and normalizing // line-endings to \r\n. @@ -255,5 +254,4 @@ sdp_message.ToString()); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/secure_channel_factory.cc b/remoting/protocol/secure_channel_factory.cc index ec747ff..39fd05b 100644 --- a/remoting/protocol/secure_channel_factory.cc +++ b/remoting/protocol/secure_channel_factory.cc
@@ -11,8 +11,7 @@ #include "remoting/protocol/channel_authenticator.h" #include "remoting/protocol/p2p_stream_socket.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { SecureChannelFactory::SecureChannelFactory( StreamChannelFactory* channel_factory, @@ -79,5 +78,4 @@ std::move(callback).Run(std::move(socket)); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/secure_channel_factory.h b/remoting/protocol/secure_channel_factory.h index 8a4c76c..d6bb145 100644 --- a/remoting/protocol/secure_channel_factory.h +++ b/remoting/protocol/secure_channel_factory.h
@@ -11,8 +11,7 @@ #include "net/base/net_errors.h" #include "remoting/protocol/stream_channel_factory.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class Authenticator; class ChannelAuthenticator; @@ -56,7 +55,6 @@ AuthenticatorMap channel_authenticators_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_SECURE_CHANNEL_FACTORY_H_
diff --git a/remoting/protocol/session.h b/remoting/protocol/session.h index 9fa0bd5..4a5dcdd 100644 --- a/remoting/protocol/session.h +++ b/remoting/protocol/session.h
@@ -12,8 +12,7 @@ #include "remoting/protocol/session_config.h" #include "remoting/protocol/transport.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class SessionPlugin; class Transport; @@ -51,8 +50,8 @@ class EventHandler { public: - EventHandler() {} - virtual ~EventHandler() {} + EventHandler() = default; + virtual ~EventHandler() = default; // Called after session state has changed. It is safe to destroy // the session from within the handler if |state| is AUTHENTICATING @@ -60,12 +59,12 @@ virtual void OnSessionStateChange(State state) = 0; }; - Session() {} + Session() = default; Session(const Session&) = delete; Session& operator=(const Session&) = delete; - virtual ~Session() {} + virtual ~Session() = default; // Set event handler for this session. |event_handler| must outlive // this object. @@ -97,7 +96,6 @@ virtual void AddPlugin(SessionPlugin* plugin) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_SESSION_H_
diff --git a/remoting/protocol/session_config.cc b/remoting/protocol/session_config.cc index d78827e..d83c5d8 100644 --- a/remoting/protocol/session_config.cc +++ b/remoting/protocol/session_config.cc
@@ -12,8 +12,7 @@ #include "base/memory/ptr_util.h" #include "base/notreached.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -307,5 +306,4 @@ UpdateConfigListToPreferTransport(&audio_configs_, transport); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/session_config.h b/remoting/protocol/session_config.h index 75e10d7..fa2d03d 100644 --- a/remoting/protocol/session_config.h +++ b/remoting/protocol/session_config.h
@@ -9,9 +9,7 @@ #include <memory> #include <string> - -namespace remoting { -namespace protocol { +namespace remoting::protocol { extern const int kDefaultStreamVersion; @@ -193,7 +191,6 @@ std::list<ChannelConfig> audio_configs_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_SESSION_CONFIG_H_
diff --git a/remoting/protocol/session_config_unittest.cc b/remoting/protocol/session_config_unittest.cc index 0835482..474aaa06 100644 --- a/remoting/protocol/session_config_unittest.cc +++ b/remoting/protocol/session_config_unittest.cc
@@ -6,8 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { void TestGetFinalConfig(std::unique_ptr<SessionConfig> config) { std::unique_ptr<CandidateSessionConfig> candidate_config = @@ -107,5 +106,4 @@ EXPECT_TRUE(hybrid_candidate_config->IsSupported(*webrtc_config)); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/session_plugin.h b/remoting/protocol/session_plugin.h index 99d79131..6227492b 100644 --- a/remoting/protocol/session_plugin.h +++ b/remoting/protocol/session_plugin.h
@@ -9,8 +9,7 @@ #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Interface for Session plugins. Plugins allow to send and receive optional // information that is not essential for session handshake. Messages generated @@ -30,7 +29,6 @@ virtual void OnIncomingMessage(const jingle_xmpp::XmlElement& attachments) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_SESSION_PLUGIN_H_
diff --git a/remoting/protocol/spake2_authenticator.cc b/remoting/protocol/spake2_authenticator.cc index 332cccd..4f41996 100644 --- a/remoting/protocol/spake2_authenticator.cc +++ b/remoting/protocol/spake2_authenticator.cc
@@ -18,8 +18,7 @@ #include "third_party/boringssl/src/include/openssl/curve25519.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -314,5 +313,4 @@ return result; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/spake2_authenticator_unittest.cc b/remoting/protocol/spake2_authenticator_unittest.cc index 25cef15..afb12012 100644 --- a/remoting/protocol/spake2_authenticator_unittest.cc +++ b/remoting/protocol/spake2_authenticator_unittest.cc
@@ -19,8 +19,7 @@ using testing::DeleteArg; using testing::SaveArg; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -99,5 +98,4 @@ ASSERT_EQ(Authenticator::REJECTED, host_->state()); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/ssl_hmac_channel_authenticator.cc b/remoting/protocol/ssl_hmac_channel_authenticator.cc index a34c0a8..3a7e44e 100644 --- a/remoting/protocol/ssl_hmac_channel_authenticator.cc +++ b/remoting/protocol/ssl_hmac_channel_authenticator.cc
@@ -37,8 +37,7 @@ #include "remoting/protocol/auth_util.h" #include "remoting/protocol/p2p_stream_socket.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -463,5 +462,4 @@ std::move(done_callback_).Run(error, nullptr); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc index 8c72e35f..0c3d9ab 100644 --- a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc +++ b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc
@@ -32,8 +32,7 @@ using testing::NotNull; using testing::SaveArg; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -213,5 +212,4 @@ ASSERT_TRUE(host_socket_.get() == nullptr); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/stream_channel_factory.h b/remoting/protocol/stream_channel_factory.h index 232a9ebf..63fb14cc 100644 --- a/remoting/protocol/stream_channel_factory.h +++ b/remoting/protocol/stream_channel_factory.h
@@ -11,8 +11,7 @@ #include "base/callback.h" #include "base/sequence_checker.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class P2PStreamSocket; @@ -23,7 +22,7 @@ typedef base::OnceCallback<void(std::unique_ptr<P2PStreamSocket>)> ChannelCreatedCallback; - StreamChannelFactory() {} + StreamChannelFactory() = default; StreamChannelFactory(const StreamChannelFactory&) = delete; StreamChannelFactory& operator=(const StreamChannelFactory&) = delete; @@ -42,12 +41,11 @@ virtual void CancelChannelCreation(const std::string& name) = 0; protected: - virtual ~StreamChannelFactory() {} + virtual ~StreamChannelFactory() = default; SEQUENCE_CHECKER(sequence_checker_); }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_STREAM_CHANNEL_FACTORY_H_
diff --git a/remoting/protocol/stream_message_pipe_adapter.cc b/remoting/protocol/stream_message_pipe_adapter.cc index a8713de..74e96cba 100644 --- a/remoting/protocol/stream_message_pipe_adapter.cc +++ b/remoting/protocol/stream_message_pipe_adapter.cc
@@ -16,8 +16,7 @@ #include "remoting/protocol/p2p_stream_socket.h" #include "remoting/protocol/stream_channel_factory.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { StreamMessagePipeAdapter::StreamMessagePipeAdapter( std::unique_ptr<P2PStreamSocket> socket, @@ -127,5 +126,4 @@ std::move(socket), error_callback_)); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/stream_packet_processor.h b/remoting/protocol/stream_packet_processor.h index 56cb1ff..a8c5fab 100644 --- a/remoting/protocol/stream_packet_processor.h +++ b/remoting/protocol/stream_packet_processor.h
@@ -17,8 +17,7 @@ struct PacketTimeUpdateParams; } // namespace rtc -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Helper class to process packets from and to the StreamPacketSocket. class StreamPacketProcessor { @@ -46,7 +45,6 @@ const rtc::PacketTimeUpdateParams& packet_time_params) const = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_STREAM_PACKET_PROCESSOR_H_
diff --git a/remoting/protocol/stream_packet_socket.cc b/remoting/protocol/stream_packet_socket.cc index 64fa6c75..d184778 100644 --- a/remoting/protocol/stream_packet_socket.cc +++ b/remoting/protocol/stream_packet_socket.cc
@@ -14,8 +14,7 @@ #include "net/traffic_annotation/network_traffic_annotation.h" #include "remoting/protocol/stun_tcp_packet_processor.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -445,5 +444,4 @@ SignalClose(this, error_); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/stream_packet_socket.h b/remoting/protocol/stream_packet_socket.h index 528d1a9..1fcca7e3 100644 --- a/remoting/protocol/stream_packet_socket.h +++ b/remoting/protocol/stream_packet_socket.h
@@ -21,8 +21,7 @@ } // namespace net -namespace remoting { -namespace protocol { +namespace remoting::protocol { class StreamPacketProcessor; @@ -117,7 +116,6 @@ int error_ = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_STREAM_PACKET_SOCKET_H_
diff --git a/remoting/protocol/stun_tcp_packet_processor.cc b/remoting/protocol/stun_tcp_packet_processor.cc index 340fff8c..c4b91942 100644 --- a/remoting/protocol/stun_tcp_packet_processor.cc +++ b/remoting/protocol/stun_tcp_packet_processor.cc
@@ -11,8 +11,7 @@ #include "third_party/webrtc/media/base/rtp_utils.h" #include "third_party/webrtc/rtc_base/time_utils.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -122,5 +121,4 @@ rtc::TimeMicros()); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/stun_tcp_packet_processor.h b/remoting/protocol/stun_tcp_packet_processor.h index 159ddcaa..cc5c773 100644 --- a/remoting/protocol/stun_tcp_packet_processor.h +++ b/remoting/protocol/stun_tcp_packet_processor.h
@@ -10,8 +10,7 @@ #include "base/memory/scoped_refptr.h" #include "remoting/protocol/stream_packet_processor.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // StreamPacketSocket implementation for data that has already been packed in // STUN/TURN's TCP packet. It won't add any extra header to the data but will @@ -40,7 +39,6 @@ const rtc::PacketTimeUpdateParams& packet_time_params) const override; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_STUN_TCP_PACKET_PROCESSOR_H_
diff --git a/remoting/protocol/test_event_matchers.h b/remoting/protocol/test_event_matchers.h index 2961a67a..cf9586f 100644 --- a/remoting/protocol/test_event_matchers.h +++ b/remoting/protocol/test_event_matchers.h
@@ -13,9 +13,7 @@ #include "testing/gmock/include/gmock/gmock.h" // This file contains matchers for protocol events. -namespace remoting { -namespace protocol { -namespace test { +namespace remoting::protocol::test { MATCHER_P2(EqualsKeyEvent, usb_keycode, pressed, "") { return arg.usb_keycode() == static_cast<uint32_t>(usb_keycode) && @@ -135,8 +133,6 @@ return arg.touch_points(0).id() == id; } -} // namespace test -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol::test #endif // REMOTING_PROTOCOL_TEST_EVENT_MATCHERS_H_
diff --git a/remoting/protocol/third_party_authenticator_base.cc b/remoting/protocol/third_party_authenticator_base.cc index 451b1fc4..1029d578 100644 --- a/remoting/protocol/third_party_authenticator_base.cc +++ b/remoting/protocol/third_party_authenticator_base.cc
@@ -13,8 +13,7 @@ #include "remoting/protocol/channel_authenticator.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // static const jingle_xmpp::StaticQName ThirdPartyAuthenticatorBase::kTokenUrlTag = @@ -97,5 +96,4 @@ return underlying_->CreateChannelAuthenticator(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/third_party_authenticator_base.h b/remoting/protocol/third_party_authenticator_base.h index 71e4937c..7e3803e 100644 --- a/remoting/protocol/third_party_authenticator_base.h +++ b/remoting/protocol/third_party_authenticator_base.h
@@ -18,8 +18,7 @@ } // namespace jingle_xmpp -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Implements an authentication method that relies on a third party server for // authentication of both client and host. @@ -74,7 +73,6 @@ RejectionReason rejection_reason_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_THIRD_PARTY_AUTHENTICATOR_BASE_H_
diff --git a/remoting/protocol/third_party_authenticator_unittest.cc b/remoting/protocol/third_party_authenticator_unittest.cc index ac36078d..c9ca3d5c 100644 --- a/remoting/protocol/third_party_authenticator_unittest.cc +++ b/remoting/protocol/third_party_authenticator_unittest.cc
@@ -41,8 +41,7 @@ } // namespace -namespace remoting { -namespace protocol { +namespace remoting::protocol { class ThirdPartyAuthenticatorTest : public AuthenticatorTestBase { class FakeTokenFetcher { @@ -223,5 +222,4 @@ ASSERT_EQ(Authenticator::REJECTED, client_->state()); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/third_party_client_authenticator.cc b/remoting/protocol/third_party_client_authenticator.cc index e1732e0..f8528cf 100644 --- a/remoting/protocol/third_party_client_authenticator.cc +++ b/remoting/protocol/third_party_client_authenticator.cc
@@ -15,8 +15,7 @@ #include "remoting/protocol/channel_authenticator.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { ThirdPartyClientAuthenticator::ThirdPartyClientAuthenticator( const CreateBaseAuthenticatorCallback& create_base_authenticator_callback, @@ -82,5 +81,4 @@ std::move(resume_callback).Run(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/third_party_client_authenticator.h b/remoting/protocol/third_party_client_authenticator.h index 55753500..86975c3 100644 --- a/remoting/protocol/third_party_client_authenticator.h +++ b/remoting/protocol/third_party_client_authenticator.h
@@ -14,8 +14,7 @@ #include "remoting/protocol/third_party_authenticator_base.h" #include "remoting/protocol/token_validator.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Implements the client side of the third party authentication mechanism. // The client authenticator expects a |token_url| and |scope| in the first @@ -59,8 +58,6 @@ base::WeakPtrFactory<ThirdPartyClientAuthenticator> weak_factory_{this}; }; - -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_THIRD_PARTY_CLIENT_AUTHENTICATOR_H_
diff --git a/remoting/protocol/third_party_host_authenticator.cc b/remoting/protocol/third_party_host_authenticator.cc index 8bcdf11..32b9ef9 100644 --- a/remoting/protocol/third_party_host_authenticator.cc +++ b/remoting/protocol/third_party_host_authenticator.cc
@@ -14,8 +14,7 @@ #include "remoting/protocol/token_validator.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { ThirdPartyHostAuthenticator::ThirdPartyHostAuthenticator( const CreateBaseAuthenticatorCallback& create_base_authenticator_callback, @@ -89,5 +88,4 @@ underlying_->ProcessMessage(message, std::move(resume_callback)); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/third_party_host_authenticator.h b/remoting/protocol/third_party_host_authenticator.h index 8486bc0..c7be6d43 100644 --- a/remoting/protocol/third_party_host_authenticator.h +++ b/remoting/protocol/third_party_host_authenticator.h
@@ -12,8 +12,7 @@ #include "remoting/protocol/third_party_authenticator_base.h" #include "remoting/protocol/token_validator.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Implements the host side of the third party authentication mechanism. // The host authenticator sends the |token_url| and |scope| obtained from the @@ -54,7 +53,6 @@ std::unique_ptr<TokenValidator> token_validator_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_
diff --git a/remoting/protocol/token_validator.h b/remoting/protocol/token_validator.h index fe79b73c..cf1bb48 100644 --- a/remoting/protocol/token_validator.h +++ b/remoting/protocol/token_validator.h
@@ -14,9 +14,7 @@ #include "remoting/protocol/authenticator.h" #include "url/gurl.h" -namespace remoting { - -namespace protocol { +namespace remoting::protocol { // The |TokenValidator| encapsulates the parameters to be sent to the client // to obtain a token, and the method to validate that token and obtain the @@ -64,10 +62,9 @@ protected: friend class base::RefCountedThreadSafe<TokenValidatorFactory>; - virtual ~TokenValidatorFactory() {} + virtual ~TokenValidatorFactory() = default; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_TOKEN_VALIDATOR_H_
diff --git a/remoting/protocol/transport.cc b/remoting/protocol/transport.cc index b1328f3..0667fba 100644 --- a/remoting/protocol/transport.cc +++ b/remoting/protocol/transport.cc
@@ -6,8 +6,7 @@ #include "base/notreached.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // static std::string TransportRoute::GetTypeString(RouteType type) { @@ -26,5 +25,4 @@ TransportRoute::TransportRoute() : type(DIRECT) {} TransportRoute::~TransportRoute() = default; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/transport.h b/remoting/protocol/transport.h index baae9f7..546d9f92 100644 --- a/remoting/protocol/transport.h +++ b/remoting/protocol/transport.h
@@ -16,8 +16,7 @@ class XmlElement; } // namespace jingle_xmpp -namespace remoting { -namespace protocol { +namespace remoting::protocol { class Authenticator; @@ -64,7 +63,6 @@ virtual bool ProcessTransportInfo(jingle_xmpp::XmlElement* transport_info) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_TRANSPORT_H_
diff --git a/remoting/protocol/transport_context.cc b/remoting/protocol/transport_context.cc index 098f272..b59363a 100644 --- a/remoting/protocol/transport_context.cc +++ b/remoting/protocol/transport_context.cc
@@ -22,8 +22,7 @@ #include "services/network/public/cpp/shared_url_loader_factory.h" #include "third_party/webrtc/rtc_base/socket_address.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -160,5 +159,4 @@ return ice_config_.max_bitrate_kbps; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/v2_authenticator.cc b/remoting/protocol/v2_authenticator.cc index 2a175d4..20fd580 100644 --- a/remoting/protocol/v2_authenticator.cc +++ b/remoting/protocol/v2_authenticator.cc
@@ -16,8 +16,7 @@ using crypto::P224EncryptedKeyExchange; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -205,5 +204,4 @@ return local_key_pair_.get() != nullptr; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/v2_authenticator_unittest.cc b/remoting/protocol/v2_authenticator_unittest.cc index df01e30..36a8d16 100644 --- a/remoting/protocol/v2_authenticator_unittest.cc +++ b/remoting/protocol/v2_authenticator_unittest.cc
@@ -20,8 +20,7 @@ using testing::DeleteArg; using testing::SaveArg; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -95,5 +94,4 @@ ASSERT_EQ(Authenticator::REJECTED, host_->state()); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/validating_authenticator.cc b/remoting/protocol/validating_authenticator.cc index 2b1a244..c9a6168 100644 --- a/remoting/protocol/validating_authenticator.cc +++ b/remoting/protocol/validating_authenticator.cc
@@ -17,8 +17,7 @@ #include "remoting/protocol/channel_authenticator.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { ValidatingAuthenticator::ValidatingAuthenticator( const std::string& remote_jid, @@ -142,5 +141,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/validating_authenticator.h b/remoting/protocol/validating_authenticator.h index e5a046f7..24f44a5 100644 --- a/remoting/protocol/validating_authenticator.h +++ b/remoting/protocol/validating_authenticator.h
@@ -13,8 +13,7 @@ #include "base/memory/weak_ptr.h" #include "remoting/protocol/authenticator.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // This authenticator class provides a way to check the validity of a connection // as it is being established through an asynchronous callback. The validation @@ -85,7 +84,6 @@ base::WeakPtrFactory<ValidatingAuthenticator> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_VALIDATING_AUTHENTICATOR_H_
diff --git a/remoting/protocol/validating_authenticator_unittest.cc b/remoting/protocol/validating_authenticator_unittest.cc index afc5879..f44ba22 100644 --- a/remoting/protocol/validating_authenticator_unittest.cc +++ b/remoting/protocol/validating_authenticator_unittest.cc
@@ -20,8 +20,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -333,5 +332,4 @@ validating_authenticator_->rejection_reason()); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/video_channel_state_observer.h b/remoting/protocol/video_channel_state_observer.h index d0714b2..0f5809d 100644 --- a/remoting/protocol/video_channel_state_observer.h +++ b/remoting/protocol/video_channel_state_observer.h
@@ -8,8 +8,7 @@ #include "remoting/codec/webrtc_video_encoder.h" #include "third_party/webrtc/api/video_codecs/video_encoder.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class VideoChannelStateObserver { public: @@ -35,7 +34,6 @@ virtual ~VideoChannelStateObserver() = default; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_VIDEO_CHANNEL_STATE_OBSERVER_H_
diff --git a/remoting/protocol/video_feedback_stub.h b/remoting/protocol/video_feedback_stub.h index 417e5341..2f0ca41 100644 --- a/remoting/protocol/video_feedback_stub.h +++ b/remoting/protocol/video_feedback_stub.h
@@ -21,8 +21,8 @@ virtual void ProcessVideoAck(std::unique_ptr<VideoAck> video_ack) = 0; protected: - VideoFeedbackStub() {} - virtual ~VideoFeedbackStub() {} + VideoFeedbackStub() = default; + virtual ~VideoFeedbackStub() = default; }; } // namespace protocol
diff --git a/remoting/protocol/video_frame_pump.cc b/remoting/protocol/video_frame_pump.cc index ea1544b..5162b24 100644 --- a/remoting/protocol/video_frame_pump.cc +++ b/remoting/protocol/video_frame_pump.cc
@@ -20,8 +20,7 @@ #include "remoting/protocol/video_stub.h" #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Interval between empty keep-alive frames. These frames are sent only when the // stream is paused or inactive for some other reason (e.g. when blocked on @@ -63,25 +62,25 @@ } VideoFramePump::~VideoFramePump() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); encode_task_runner_->DeleteSoon(FROM_HERE, encoder_.release()); } void VideoFramePump::SetEventTimestampsSource( scoped_refptr<InputEventTimestampsSource> event_timestamps_source) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); event_timestamps_source_ = event_timestamps_source; } void VideoFramePump::Pause(bool pause) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); capture_scheduler_.Pause(pause); } void VideoFramePump::SetLosslessEncode(bool want_lossless) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); encode_task_runner_->PostTask( FROM_HERE, @@ -90,7 +89,7 @@ } void VideoFramePump::SetLosslessColor(bool want_lossless) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); encode_task_runner_->PostTask( FROM_HERE, @@ -99,7 +98,7 @@ } void VideoFramePump::SetObserver(Observer* observer) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); observer_ = observer; } @@ -108,7 +107,7 @@ void VideoFramePump::OnCaptureResult( webrtc::DesktopCapturer::Result result, std::unique_ptr<webrtc::DesktopFrame> frame) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); capture_scheduler_.OnCaptureCompleted(); @@ -138,7 +137,7 @@ } void VideoFramePump::CaptureNextFrame() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); captured_frame_timestamps_ = std::make_unique<FrameTimestamps>(); captured_frame_timestamps_->capture_started_time = base::TimeTicks::Now(); @@ -182,7 +181,7 @@ void VideoFramePump::OnFrameEncoded( std::unique_ptr<PacketWithTimestamps> packet) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); capture_scheduler_.OnFrameEncoded(packet->packet.get()); @@ -194,7 +193,7 @@ } void VideoFramePump::SendPacket(std::unique_ptr<PacketWithTimestamps> packet) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(!send_pending_); packet->timestamps->can_send_time = base::TimeTicks::Now(); @@ -233,7 +232,7 @@ } void VideoFramePump::OnVideoPacketSent() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); send_pending_ = false; capture_scheduler_.OnFrameSent(); @@ -249,7 +248,7 @@ } void VideoFramePump::SendKeepAlivePacket() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); video_stub_->ProcessVideoPacket( std::make_unique<VideoPacket>(), @@ -258,10 +257,9 @@ } void VideoFramePump::OnKeepAlivePacketSent() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); keep_alive_timer_.Reset(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/video_frame_pump.h b/remoting/protocol/video_frame_pump.h index 9c4dfe2..5837a6f6 100644 --- a/remoting/protocol/video_frame_pump.h +++ b/remoting/protocol/video_frame_pump.h
@@ -25,8 +25,7 @@ class SingleThreadTaskRunner; } // namespace base -namespace remoting { -namespace protocol { +namespace remoting::protocol { class VideoFeedbackStub; class VideoStub; @@ -186,12 +185,11 @@ std::vector<std::unique_ptr<PacketWithTimestamps>> pending_packets_; - base::ThreadChecker thread_checker_; + THREAD_CHECKER(thread_checker_); base::WeakPtrFactory<VideoFramePump> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_VIDEO_FRAME_PUMP_H_
diff --git a/remoting/protocol/video_frame_pump_unittest.cc b/remoting/protocol/video_frame_pump_unittest.cc index 7216605..60e2e04 100644 --- a/remoting/protocol/video_frame_pump_unittest.cc +++ b/remoting/protocol/video_frame_pump_unittest.cc
@@ -32,8 +32,7 @@ using ::testing::InvokeWithoutArgs; using ::testing::Return; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -261,5 +260,4 @@ run_loop.Run(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/video_renderer.h b/remoting/protocol/video_renderer.h index c8bf148..0eec6ad 100644 --- a/remoting/protocol/video_renderer.h +++ b/remoting/protocol/video_renderer.h
@@ -26,7 +26,7 @@ // TODO(sergeyu): Reconsider this design. class VideoRenderer { public: - virtual ~VideoRenderer() {} + virtual ~VideoRenderer() = default; // Initializes the video renderer. This allows the renderer to be initialized // after it is constructed. Returns true if initialization succeeds and false
diff --git a/remoting/protocol/video_stats_stub.h b/remoting/protocol/video_stats_stub.h index 3607820f..dbe9076 100644 --- a/remoting/protocol/video_stats_stub.h +++ b/remoting/protocol/video_stats_stub.h
@@ -7,8 +7,7 @@ #include <cstdint> -namespace remoting { -namespace protocol { +namespace remoting::protocol { struct HostFrameStats; @@ -22,11 +21,10 @@ const HostFrameStats& frame_stats) = 0; protected: - VideoStatsStub() {} - virtual ~VideoStatsStub() {} + VideoStatsStub() = default; + virtual ~VideoStatsStub() = default; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_VIDEO_STATS_STUB_H_
diff --git a/remoting/protocol/video_stream.h b/remoting/protocol/video_stream.h index a524f5b..e60ede1 100644 --- a/remoting/protocol/video_stream.h +++ b/remoting/protocol/video_stream.h
@@ -13,8 +13,7 @@ class DesktopVector; } // namespace webrtc -namespace remoting { -namespace protocol { +namespace remoting::protocol { class VideoStream { public: @@ -27,8 +26,8 @@ const webrtc::DesktopVector& dpi) = 0; }; - VideoStream() {} - virtual ~VideoStream() {} + VideoStream() = default; + virtual ~VideoStream() = default; // Sets event timestamps source to be used for the video stream. virtual void SetEventTimestampsSource( @@ -50,7 +49,6 @@ virtual void SelectSource(webrtc::ScreenId id) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_VIDEO_STREAM_H_
diff --git a/remoting/protocol/video_stub.h b/remoting/protocol/video_stub.h index 4c1c1f7..ab2f96f 100644 --- a/remoting/protocol/video_stub.h +++ b/remoting/protocol/video_stub.h
@@ -24,8 +24,8 @@ base::OnceClosure done) = 0; protected: - VideoStub() {} - virtual ~VideoStub() {} + VideoStub() = default; + virtual ~VideoStub() = default; }; } // namespace protocol
diff --git a/remoting/protocol/webrtc_audio_module.cc b/remoting/protocol/webrtc_audio_module.cc index d4d0c17..85e044d 100644 --- a/remoting/protocol/webrtc_audio_module.cc +++ b/remoting/protocol/webrtc_audio_module.cc
@@ -11,8 +11,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/timer/timer.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -379,5 +378,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_audio_module.h b/remoting/protocol/webrtc_audio_module.h index bafb27bb..32d76b0 100644 --- a/remoting/protocol/webrtc_audio_module.h +++ b/remoting/protocol/webrtc_audio_module.h
@@ -15,8 +15,7 @@ class SingleThreadTaskRunner; } // namespace base -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Audio module passed to WebRTC. It doesn't access actual audio devices, but it // provides all functionality we need to ensure that audio streaming works @@ -124,7 +123,6 @@ std::unique_ptr<base::RepeatingTimer> poll_timer_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_WEBRTC_AUDIO_MODULE_H_
diff --git a/remoting/protocol/webrtc_audio_sink_adapter.cc b/remoting/protocol/webrtc_audio_sink_adapter.cc index 8de8b91..7a5363c 100644 --- a/remoting/protocol/webrtc_audio_sink_adapter.cc +++ b/remoting/protocol/webrtc_audio_sink_adapter.cc
@@ -11,8 +11,7 @@ #include "remoting/proto/audio.pb.h" #include "remoting/protocol/audio_stub.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { WebrtcAudioSinkAdapter::WebrtcAudioSinkAdapter( rtc::scoped_refptr<webrtc::MediaStreamInterface> stream, @@ -76,5 +75,4 @@ std::move(audio_packet), base::OnceClosure())); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_audio_sink_adapter.h b/remoting/protocol/webrtc_audio_sink_adapter.h index 09d9f59..01ae666 100644 --- a/remoting/protocol/webrtc_audio_sink_adapter.h +++ b/remoting/protocol/webrtc_audio_sink_adapter.h
@@ -14,8 +14,7 @@ class SingleThreadTaskRunner; } // namespace base -namespace remoting { -namespace protocol { +namespace remoting::protocol { class AudioStub; @@ -39,7 +38,6 @@ rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_WEBRTC_AUDIO_SINK_ADAPTER_H_
diff --git a/remoting/protocol/webrtc_audio_source_adapter.cc b/remoting/protocol/webrtc_audio_source_adapter.cc index 30344c8..692fe2e 100644 --- a/remoting/protocol/webrtc_audio_source_adapter.cc +++ b/remoting/protocol/webrtc_audio_source_adapter.cc
@@ -15,8 +15,7 @@ #include "remoting/proto/audio.pb.h" #include "remoting/protocol/audio_source.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { static const int kChannels = 2; static const int kBytesPerSample = 2; @@ -53,27 +52,27 @@ base::ObserverList<webrtc::AudioTrackSinkInterface>::Unchecked audio_sinks_; base::Lock audio_sinks_lock_; - base::ThreadChecker thread_checker_; + THREAD_CHECKER(thread_checker_); }; WebrtcAudioSourceAdapter::Core::Core() { - thread_checker_.DetachFromThread(); + DETACH_FROM_THREAD(thread_checker_); } WebrtcAudioSourceAdapter::Core::~Core() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } void WebrtcAudioSourceAdapter::Core::Start( std::unique_ptr<AudioSource> audio_source) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); audio_source_ = std::move(audio_source); audio_source_->Start( base::BindRepeating(&Core::OnAudioPacket, base::Unretained(this))); } void WebrtcAudioSourceAdapter::Core::Pause(bool pause) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); paused_ = pause; } @@ -93,7 +92,7 @@ void WebrtcAudioSourceAdapter::Core::OnAudioPacket( std::unique_ptr<AudioPacket> packet) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (paused_) return; @@ -193,5 +192,4 @@ void WebrtcAudioSourceAdapter::UnregisterObserver( webrtc::ObserverInterface* observer) {} -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_audio_source_adapter.h b/remoting/protocol/webrtc_audio_source_adapter.h index bc97119..2f68e677 100644 --- a/remoting/protocol/webrtc_audio_source_adapter.h +++ b/remoting/protocol/webrtc_audio_source_adapter.h
@@ -15,9 +15,7 @@ class AudioTrackSinkInterface; } // namespace webrtc -namespace remoting { - -namespace protocol { +namespace remoting::protocol { class AudioSource; @@ -55,7 +53,6 @@ std::unique_ptr<Core> core_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_WEBRTC_AUDIO_SOURCE_ADAPTER_H_
diff --git a/remoting/protocol/webrtc_audio_source_adapter_unittest.cc b/remoting/protocol/webrtc_audio_source_adapter_unittest.cc index 78b0c92..34b2242 100644 --- a/remoting/protocol/webrtc_audio_source_adapter_unittest.cc +++ b/remoting/protocol/webrtc_audio_source_adapter_unittest.cc
@@ -19,8 +19,7 @@ #include "third_party/webrtc/rtc_base/ref_count.h" #include "third_party/webrtc/rtc_base/ref_counted_object.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -116,6 +115,4 @@ } } - -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_audio_stream.cc b/remoting/protocol/webrtc_audio_stream.cc index b28fb22f..1946271 100644 --- a/remoting/protocol/webrtc_audio_stream.cc +++ b/remoting/protocol/webrtc_audio_stream.cc
@@ -15,8 +15,7 @@ #include "third_party/webrtc/api/peer_connection_interface.h" #include "third_party/webrtc/rtc_base/ref_count.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { const char kAudioStreamLabel[] = "audio_stream"; const char kAudioTrackLabel[] = "system_audio"; @@ -57,5 +56,4 @@ source_adapter_->Pause(pause); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_audio_stream.h b/remoting/protocol/webrtc_audio_stream.h index 7a9357c2..2691429 100644 --- a/remoting/protocol/webrtc_audio_stream.h +++ b/remoting/protocol/webrtc_audio_stream.h
@@ -19,8 +19,7 @@ class PeerConnectionInterface; } // namespace webrtc -namespace remoting { -namespace protocol { +namespace remoting::protocol { class AudioSource; class WebrtcAudioSourceAdapter; @@ -48,7 +47,6 @@ scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_WEBRTC_AUDIO_STREAM_H_
diff --git a/remoting/protocol/webrtc_connection_to_client.cc b/remoting/protocol/webrtc_connection_to_client.cc index 7aed5dac..2bf10a2 100644 --- a/remoting/protocol/webrtc_connection_to_client.cc +++ b/remoting/protocol/webrtc_connection_to_client.cc
@@ -30,8 +30,7 @@ #include "third_party/webrtc/api/peer_connection_interface.h" #include "third_party/webrtc/api/sctp_transport_interface.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -39,10 +38,10 @@ } // namespace -// Currently the network thread is also used as worker thread for webrtc. +// Currently the network thread is also used as the worker thread for webrtc. // -// TODO(sergeyu): Figure out if we would benefit from using a separate -// thread as a worker thread. +// TODO(sergeyu): Figure out if we would benefit from using a separate thread as +// a worker thread. WebrtcConnectionToClient::WebrtcConnectionToClient( std::unique_ptr<protocol::Session> session, scoped_refptr<protocol::TransportContext> transport_context, @@ -62,22 +61,22 @@ } WebrtcConnectionToClient::~WebrtcConnectionToClient() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } void WebrtcConnectionToClient::SetEventHandler( ConnectionToClient::EventHandler* event_handler) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); event_handler_ = event_handler; } protocol::Session* WebrtcConnectionToClient::session() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return session_.get(); } void WebrtcConnectionToClient::Disconnect(ErrorCode error) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // This should trigger OnConnectionClosed() event and this object // may be destroyed as the result. @@ -87,7 +86,7 @@ std::unique_ptr<VideoStream> WebrtcConnectionToClient::StartVideoStream( const std::string& stream_name, std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(transport_); auto stream = @@ -102,7 +101,7 @@ std::unique_ptr<AudioStream> WebrtcConnectionToClient::StartAudioStream( std::unique_ptr<AudioSource> audio_source) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(transport_); std::unique_ptr<WebrtcAudioStream> stream(new WebrtcAudioStream()); @@ -112,23 +111,23 @@ // Return pointer to ClientStub. ClientStub* WebrtcConnectionToClient::client_stub() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return control_dispatcher_.get(); } void WebrtcConnectionToClient::set_clipboard_stub( protocol::ClipboardStub* clipboard_stub) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); control_dispatcher_->set_clipboard_stub(clipboard_stub); } void WebrtcConnectionToClient::set_host_stub(protocol::HostStub* host_stub) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); control_dispatcher_->set_host_stub(host_stub); } void WebrtcConnectionToClient::set_input_stub(protocol::InputStub* input_stub) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); event_dispatcher_->set_input_stub(input_stub); } @@ -149,7 +148,7 @@ } void WebrtcConnectionToClient::OnSessionStateChange(Session::State state) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(event_handler_); switch (state) { @@ -188,7 +187,7 @@ } void WebrtcConnectionToClient::OnWebrtcTransportConnecting() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // Create outgoing control channel. |event_dispatcher_| is initialized later // because event channel is expected to be created by the client. control_dispatcher_->Init( @@ -203,7 +202,7 @@ } void WebrtcConnectionToClient::OnWebrtcTransportConnected() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); auto sctp_transport = transport_->peer_connection()->GetSctpTransport(); if (sctp_transport) { absl::optional<double> max_message_size = @@ -215,12 +214,12 @@ } void WebrtcConnectionToClient::OnWebrtcTransportError(ErrorCode error) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); Disconnect(error); } void WebrtcConnectionToClient::OnWebrtcTransportProtocolChanged() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // If not all channels are connected, this call will be deferred to // OnChannelInitialized() when all channels are connected. if (allChannelsConnected()) { @@ -231,7 +230,7 @@ void WebrtcConnectionToClient::OnWebrtcTransportIncomingDataChannel( const std::string& name, std::unique_ptr<MessagePipe> pipe) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(event_handler_); if (name == event_dispatcher_->channel_name() && @@ -245,18 +244,18 @@ void WebrtcConnectionToClient::OnWebrtcTransportMediaStreamAdded( rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); LOG(WARNING) << "The client created an unexpected media stream."; } void WebrtcConnectionToClient::OnWebrtcTransportMediaStreamRemoved( rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } void WebrtcConnectionToClient::OnWebrtcTransportRouteChanged( const TransportRoute& route) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(event_handler_); // WebRTC route-change events are triggered at the transport level, so the @@ -267,7 +266,7 @@ void WebrtcConnectionToClient::OnChannelInitialized( ChannelDispatcherBase* channel_dispatcher) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (allChannelsConnected()) { event_handler_->OnConnectionChannelsConnected(); @@ -280,7 +279,7 @@ void WebrtcConnectionToClient::OnChannelClosed( ChannelDispatcherBase* channel_dispatcher) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (channel_dispatcher == &video_stats_dispatcher_) { LOG(WARNING) << "video_stats channel was closed."; @@ -297,5 +296,4 @@ event_dispatcher_ && event_dispatcher_->is_connected(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_connection_to_client.h b/remoting/protocol/webrtc_connection_to_client.h index 3caabd9..fe65cfb 100644 --- a/remoting/protocol/webrtc_connection_to_client.h +++ b/remoting/protocol/webrtc_connection_to_client.h
@@ -20,8 +20,7 @@ #include "remoting/protocol/session.h" #include "remoting/protocol/webrtc_transport.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class WebrtcVideoEncoderFactory; class HostControlDispatcher; @@ -84,8 +83,6 @@ private: bool allChannelsConnected(); - base::ThreadChecker thread_checker_; - // Event handler for handling events sent from this object. raw_ptr<ConnectionToClient::EventHandler> event_handler_ = nullptr; @@ -103,10 +100,12 @@ std::unique_ptr<HostControlDispatcher> control_dispatcher_; std::unique_ptr<HostEventDispatcher> event_dispatcher_; + + THREAD_CHECKER(thread_checker_); + base::WeakPtrFactory<WebrtcConnectionToClient> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_CLIENT_H_
diff --git a/remoting/protocol/webrtc_connection_to_host.cc b/remoting/protocol/webrtc_connection_to_host.cc index 82cbd85..50d57ce 100644 --- a/remoting/protocol/webrtc_connection_to_host.cc +++ b/remoting/protocol/webrtc_connection_to_host.cc
@@ -23,8 +23,7 @@ #include "remoting/protocol/webrtc_transport.h" #include "remoting/protocol/webrtc_video_renderer_adapter.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { WebrtcConnectionToHost::WebrtcConnectionToHost() = default; WebrtcConnectionToHost::~WebrtcConnectionToHost() = default; @@ -236,5 +235,4 @@ } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_connection_to_host.h b/remoting/protocol/webrtc_connection_to_host.h index 77102e7..c556e11 100644 --- a/remoting/protocol/webrtc_connection_to_host.h +++ b/remoting/protocol/webrtc_connection_to_host.h
@@ -18,8 +18,7 @@ #include "remoting/protocol/session.h" #include "remoting/protocol/webrtc_transport.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { class ClientControlDispatcher; class ClientEventDispatcher; @@ -116,7 +115,6 @@ ErrorCode error_ = OK; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_
diff --git a/remoting/protocol/webrtc_data_stream_adapter.cc b/remoting/protocol/webrtc_data_stream_adapter.cc index b810e141..8351de7 100644 --- a/remoting/protocol/webrtc_data_stream_adapter.cc +++ b/remoting/protocol/webrtc_data_stream_adapter.cc
@@ -17,8 +17,7 @@ #include "remoting/base/compound_buffer.h" #include "remoting/protocol/message_serialization.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { WebrtcDataStreamAdapter::WebrtcDataStreamAdapter( rtc::scoped_refptr<webrtc::DataChannelInterface> channel) @@ -163,5 +162,4 @@ WebrtcDataStreamAdapter::PendingMessage::~PendingMessage() = default; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_data_stream_adapter.h b/remoting/protocol/webrtc_data_stream_adapter.h index a15e30b..9677273 100644 --- a/remoting/protocol/webrtc_data_stream_adapter.h +++ b/remoting/protocol/webrtc_data_stream_adapter.h
@@ -16,8 +16,7 @@ #include "third_party/webrtc/api/peer_connection_interface.h" #include "third_party/webrtc/rtc_base/ref_count.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // WebrtcDataStreamAdapter implements MessagePipe for WebRTC data channels. class WebrtcDataStreamAdapter : public MessagePipe, @@ -80,7 +79,6 @@ base::WeakPtrFactory<WebrtcDataStreamAdapter> weak_ptr_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_WEBRTC_DATA_STREAM_ADAPTER_H_
diff --git a/remoting/protocol/webrtc_event_log_data.cc b/remoting/protocol/webrtc_event_log_data.cc index 3a4c409..23541b7 100644 --- a/remoting/protocol/webrtc_event_log_data.cc +++ b/remoting/protocol/webrtc_event_log_data.cc
@@ -10,8 +10,7 @@ #include "base/numerics/safe_conversions.h" #include "base/strings/string_piece.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { WebrtcEventLogData::WebrtcEventLogData() { // See the caveat for base::circular_deque::reserve(). Calling reserve() is @@ -79,5 +78,4 @@ sections_.back().reserve(max_section_size_); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_event_log_data.h b/remoting/protocol/webrtc_event_log_data.h index fd5436c..8e4f72b 100644 --- a/remoting/protocol/webrtc_event_log_data.h +++ b/remoting/protocol/webrtc_event_log_data.h
@@ -11,8 +11,7 @@ #include "base/containers/circular_deque.h" #include "base/strings/string_piece.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // A data store which records the most recent RTC event log data. This is // written to by an RTCEventLogOutput instance, which is owned by the @@ -71,7 +70,6 @@ int max_section_size_ = kMaxSectionSize; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_WEBRTC_EVENT_LOG_DATA_H_
diff --git a/remoting/protocol/webrtc_event_log_data_unittest.cc b/remoting/protocol/webrtc_event_log_data_unittest.cc index 456a072..6f35278a 100644 --- a/remoting/protocol/webrtc_event_log_data_unittest.cc +++ b/remoting/protocol/webrtc_event_log_data_unittest.cc
@@ -6,8 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -68,5 +67,4 @@ EXPECT_TRUE(data.empty()); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_frame_scheduler.h b/remoting/protocol/webrtc_frame_scheduler.h index 7f0e737..7d3a8f3 100644 --- a/remoting/protocol/webrtc_frame_scheduler.h +++ b/remoting/protocol/webrtc_frame_scheduler.h
@@ -12,8 +12,7 @@ class DesktopFrame; } // namespace webrtc -namespace remoting { -namespace protocol { +namespace remoting::protocol { // An abstract interface for frame schedulers, which are responsible for // scheduling when video frames are captured and for defining encoding @@ -30,16 +29,15 @@ // Pause and resumes the scheduler. virtual void Pause(bool pause) = 0; - // Called after |frame| has been captured. |frame| may be set to nullptr - // if the capture request failed. + // Called after |frame| has been captured. |frame| may be set to nullptr if + // the capture request failed. virtual void OnFrameCaptured(const webrtc::DesktopFrame* frame) = 0; - // Called when WebRTC requests the VideoTrackSource to provide frames - // at a maximum framerate. + // Called when WebRTC requests the VideoTrackSource to provide frames at a + // maximum framerate. virtual void SetMaxFramerateFps(int max_framerate_fps) = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_
diff --git a/remoting/protocol/webrtc_frame_scheduler_unittest.cc b/remoting/protocol/webrtc_frame_scheduler_unittest.cc index aaf1b29..2fc3666 100644 --- a/remoting/protocol/webrtc_frame_scheduler_unittest.cc +++ b/remoting/protocol/webrtc_frame_scheduler_unittest.cc
@@ -18,8 +18,7 @@ using webrtc::DesktopRect; using webrtc::DesktopSize; -namespace remoting { -namespace protocol { +namespace remoting::protocol { class WebrtcFrameSchedulerTest : public ::testing::Test { public: @@ -106,5 +105,4 @@ EXPECT_LE(1, capture_callback_count_); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_transport.cc b/remoting/protocol/webrtc_transport.cc index 9f332cb..705a627 100644 --- a/remoting/protocol/webrtc_transport.cc +++ b/remoting/protocol/webrtc_transport.cc
@@ -51,8 +51,7 @@ using jingle_xmpp::QName; using jingle_xmpp::XmlElement; -namespace remoting { -namespace protocol { +namespace remoting::protocol { class ScopedAllowThreadJoinForWebRtcTransport : public base::ScopedAllowBaseSyncPrimitivesOutsideBlockingScope {}; @@ -426,7 +425,7 @@ } WebrtcTransport::~WebrtcTransport() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); Close(OK); } @@ -471,7 +470,7 @@ void WebrtcTransport::Start( Authenticator* authenticator, SendTransportInfoCallback send_transport_info_callback) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(send_transport_info_callback_.is_null()); webrtc::ThreadWrapper::EnsureForCurrentMessageLoop(); @@ -492,7 +491,7 @@ } bool WebrtcTransport::ProcessTransportInfo(XmlElement* transport_info) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (transport_info->Name() != QName(kTransportNamespace, "transport")) return false; @@ -611,7 +610,7 @@ } const SessionOptions& WebrtcTransport::session_options() const { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return session_options_; } @@ -724,7 +723,7 @@ } void WebrtcTransport::Close(ErrorCode error) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (!peer_connection_wrapper_) return; @@ -743,7 +742,7 @@ } void WebrtcTransport::ApplySessionOptions(const SessionOptions& options) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); session_options_ = options; absl::optional<std::string> video_codec = options.Get("Video-Codec"); if (video_codec) { @@ -773,7 +772,7 @@ void WebrtcTransport::OnLocalSessionDescriptionCreated( std::unique_ptr<webrtc::SessionDescriptionInterface> description, const std::string& error) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (!peer_connection()) return; @@ -837,7 +836,7 @@ void WebrtcTransport::OnLocalDescriptionSet(bool success, const std::string& error) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (!peer_connection()) return; @@ -862,7 +861,7 @@ void WebrtcTransport::OnRemoteDescriptionSet(bool send_answer, bool success, const std::string& error) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (!peer_connection()) return; @@ -888,24 +887,24 @@ void WebrtcTransport::OnSignalingChange( webrtc::PeerConnectionInterface::SignalingState new_state) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } void WebrtcTransport::OnAddStream( rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); event_handler_->OnWebrtcTransportMediaStreamAdded(stream); } void WebrtcTransport::OnRemoveStream( rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); event_handler_->OnWebrtcTransportMediaStreamRemoved(stream); } void WebrtcTransport::OnDataChannel( rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); std::string data_channel_name = data_channel->label(); if (data_channel_name == kControlChannelName) { DCHECK(!control_data_channel_); @@ -920,7 +919,7 @@ } void WebrtcTransport::OnRenegotiationNeeded() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (transport_context_->role() == TransportRole::SERVER) { RequestNegotiation(); @@ -933,7 +932,7 @@ void WebrtcTransport::OnIceConnectionChange( webrtc::PeerConnectionInterface::IceConnectionState new_state) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (!connected_ && new_state == webrtc::PeerConnectionInterface::kIceConnectionConnected) { @@ -952,12 +951,12 @@ void WebrtcTransport::OnIceGatheringChange( webrtc::PeerConnectionInterface::IceGatheringState new_state) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } void WebrtcTransport::OnIceCandidate( const webrtc::IceCandidateInterface* candidate) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); std::unique_ptr<XmlElement> candidate_element( new XmlElement(QName(kTransportNamespace, "candidate"))); @@ -979,7 +978,7 @@ void WebrtcTransport::OnIceSelectedCandidatePairChanged( const cricket::CandidatePairChangeEvent& event) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); std::string transport_protocol = GetTransportProtocol(event.selected_candidate_pair); @@ -1167,7 +1166,7 @@ } void WebrtcTransport::EnsurePendingTransportInfoMessage() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // |transport_info_timer_| must be running iff // |pending_transport_info_message_| exists. @@ -1187,14 +1186,14 @@ } void WebrtcTransport::SendTransportInfo() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(pending_transport_info_message_); send_transport_info_callback_.Run(std::move(pending_transport_info_message_)); } void WebrtcTransport::AddPendingCandidatesIfPossible() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (peer_connection()->signaling_state() == webrtc::PeerConnectionInterface::kStable) { @@ -1210,7 +1209,7 @@ } void WebrtcTransport::StartRtcEventLogging() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (!peer_connection()) return; @@ -1222,12 +1221,11 @@ } void WebrtcTransport::StopRtcEventLogging() { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (peer_connection()) { ScopedAllowThreadJoinForWebRtcTransport allow_wait; peer_connection()->StopRtcEventLog(); } } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_transport.h b/remoting/protocol/webrtc_transport.h index 5468dcc..03cfa80 100644 --- a/remoting/protocol/webrtc_transport.h +++ b/remoting/protocol/webrtc_transport.h
@@ -30,13 +30,10 @@ #include "third_party/webrtc/api/video_codecs/video_encoder_factory.h" namespace base { - class Watchdog; - } // namespace base -namespace remoting { -namespace protocol { +namespace remoting::protocol { class TransportContext; class MessagePipe; @@ -227,8 +224,6 @@ void StartRtcEventLogging(); void StopRtcEventLogging(); - base::ThreadChecker thread_checker_; - scoped_refptr<TransportContext> transport_context_; raw_ptr<EventHandler> event_handler_ = nullptr; SendTransportInfoCallback send_transport_info_callback_; @@ -272,10 +267,11 @@ // Stores event log data generated by WebRTC for the PeerConnection. WebrtcEventLogData rtc_event_log_; + THREAD_CHECKER(thread_checker_); + base::WeakPtrFactory<WebrtcTransport> weak_factory_{this}; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_
diff --git a/remoting/protocol/webrtc_transport_unittest.cc b/remoting/protocol/webrtc_transport_unittest.cc index 1172863..37b0cb4a 100644 --- a/remoting/protocol/webrtc_transport_unittest.cc +++ b/remoting/protocol/webrtc_transport_unittest.cc
@@ -33,8 +33,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -463,5 +462,4 @@ EXPECT_FALSE(host_message_pipe_); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_video_frame_adapter.cc b/remoting/protocol/webrtc_video_frame_adapter.cc index 08d0a1c..10d2f3a 100644 --- a/remoting/protocol/webrtc_video_frame_adapter.cc +++ b/remoting/protocol/webrtc_video_frame_adapter.cc
@@ -9,8 +9,7 @@ #include "base/notreached.h" #include "third_party/webrtc/rtc_base/ref_counted_object.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { WebrtcVideoFrameAdapter::WebrtcVideoFrameAdapter( std::unique_ptr<webrtc::DesktopFrame> frame, @@ -74,12 +73,10 @@ rtc::scoped_refptr<webrtc::I420BufferInterface> WebrtcVideoFrameAdapter::ToI420() { // Strictly speaking all adapters must implement ToI420(), so that if the - // external encoder fails, an internal libvpx could be used. But the - // remoting encoder already uses libvpx, so there's no reason for fallback to - // happen. + // external encoder fails, an internal libvpx could be used. But the remoting + // encoder already uses libvpx, so there's no reason for fallback to happen. NOTIMPLEMENTED(); return nullptr; } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_video_frame_adapter.h b/remoting/protocol/webrtc_video_frame_adapter.h index 9c7a3d92..2d78a7b 100644 --- a/remoting/protocol/webrtc_video_frame_adapter.h +++ b/remoting/protocol/webrtc_video_frame_adapter.h
@@ -12,8 +12,7 @@ #include "third_party/webrtc/api/video/video_frame_buffer.h" #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { // Adapter class to wrap a DesktopFrame produced by the capturer, and provide // it as a VideoFrame to the WebRTC video sink. The encoder will extract the @@ -53,7 +52,6 @@ std::unique_ptr<WebrtcVideoEncoder::FrameStats> frame_stats_; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_FRAME_ADAPTER_H_
diff --git a/remoting/protocol/webrtc_video_frame_adapter_unittest.cc b/remoting/protocol/webrtc_video_frame_adapter_unittest.cc index b616060..0154dc96 100644 --- a/remoting/protocol/webrtc_video_frame_adapter_unittest.cc +++ b/remoting/protocol/webrtc_video_frame_adapter_unittest.cc
@@ -24,8 +24,7 @@ } // namespace -namespace remoting { -namespace protocol { +namespace remoting::protocol { TEST(WebrtcVideoFrameAdapter, CreateVideoFrameWrapsDesktopFrame) { auto desktop_frame = MakeDesktopFrame(100, 200); @@ -78,5 +77,4 @@ .offset_x = 10, .offset_y = 20, .width = 60, .height = 60})); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_video_renderer_adapter.cc b/remoting/protocol/webrtc_video_renderer_adapter.cc index e340345..e22ca46 100644 --- a/remoting/protocol/webrtc_video_renderer_adapter.cc +++ b/remoting/protocol/webrtc_video_renderer_adapter.cc
@@ -25,8 +25,7 @@ #include "third_party/libyuv/include/libyuv/convert_from.h" #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -67,9 +66,8 @@ WebrtcVideoRendererAdapter::~WebrtcVideoRendererAdapter() { DCHECK(task_runner_->BelongsToCurrentThread()); - // Needed for ConnectionTest unittests which set up a - // fake connection without starting any video. This - // video adapter is instantiated when the incoming + // Needed for ConnectionTest unittests which set up a fake connection without + // starting any video. This video adapter is instantiated when the incoming // video-stats data channel is created. if (!media_stream_) { return; @@ -256,5 +254,4 @@ frame_stats_consumer->OnVideoFrameStats(frame_stats); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_video_renderer_adapter.h b/remoting/protocol/webrtc_video_renderer_adapter.h index 6a62b6ab..265a831 100644 --- a/remoting/protocol/webrtc_video_renderer_adapter.h +++ b/remoting/protocol/webrtc_video_renderer_adapter.h
@@ -27,8 +27,7 @@ class VideoFrameBuffer; } // namespace webrtc -namespace remoting { -namespace protocol { +namespace remoting::protocol { class MessagePipe; class VideoRenderer; @@ -91,7 +90,6 @@ base::WeakPtrFactory<WebrtcVideoRendererAdapter> weak_factory_{this}; }; -} // namespace remoting -} // namespace protocol +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_RENDERER_ADAPTER_H_
diff --git a/remoting/protocol/webrtc_video_stream.cc b/remoting/protocol/webrtc_video_stream.cc index b2a73d8..d464ce8 100644 --- a/remoting/protocol/webrtc_video_stream.cc +++ b/remoting/protocol/webrtc_video_stream.cc
@@ -80,8 +80,6 @@ // Called by the |scheduler_|. void CaptureNextFrame(); - THREAD_CHECKER(thread_checker_); - // The current frame size. webrtc::DesktopSize frame_size_; @@ -108,6 +106,8 @@ // Allows Core to post messages to its owner in a thread-safe manner. scoped_refptr<base::SingleThreadTaskRunner> video_stream_task_runner_; + + THREAD_CHECKER(thread_checker_); }; WebrtcVideoStream::Core::Core(std::unique_ptr<webrtc::DesktopCapturer> capturer,
diff --git a/remoting/protocol/webrtc_video_stream.h b/remoting/protocol/webrtc_video_stream.h index ea3404d..5b68f5e 100644 --- a/remoting/protocol/webrtc_video_stream.h +++ b/remoting/protocol/webrtc_video_stream.h
@@ -88,8 +88,6 @@ std::unique_ptr<webrtc::DesktopFrame> desktop_frame, std::unique_ptr<WebrtcVideoEncoder::FrameStats> frame_stats); - THREAD_CHECKER(thread_checker_); - // Label of the associated WebRTC video-stream. std::string stream_name_; @@ -110,6 +108,8 @@ std::unique_ptr<Core> core_; scoped_refptr<base::SingleThreadTaskRunner> core_task_runner_; + THREAD_CHECKER(thread_checker_); + base::WeakPtrFactory<WebrtcVideoStream> weak_factory_{this}; };
diff --git a/remoting/protocol/webrtc_video_track_source.cc b/remoting/protocol/webrtc_video_track_source.cc index 3598a662..4ff8684 100644 --- a/remoting/protocol/webrtc_video_track_source.cc +++ b/remoting/protocol/webrtc_video_track_source.cc
@@ -11,8 +11,7 @@ #include "base/threading/sequenced_task_runner_handle.h" #include "remoting/protocol/webrtc_video_frame_adapter.h" -namespace remoting { -namespace protocol { +namespace remoting::protocol { WebrtcVideoTrackSource::WebrtcVideoTrackSource( AddSinkCallback add_sink_callback) @@ -98,5 +97,4 @@ sink_->OnFrame(video_frame); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_video_track_source.h b/remoting/protocol/webrtc_video_track_source.h index b9ce53e3..ae629d87 100644 --- a/remoting/protocol/webrtc_video_track_source.h +++ b/remoting/protocol/webrtc_video_track_source.h
@@ -15,8 +15,7 @@ #include <memory> -namespace remoting { -namespace protocol { +namespace remoting::protocol { class WebrtcVideoTrackSource : public webrtc::Notifier<webrtc::VideoTrackSourceInterface> { @@ -27,8 +26,10 @@ // |add_sink_callback| is notified on the main thread whenever a sink is // added or updated. explicit WebrtcVideoTrackSource(AddSinkCallback add_sink_callback); + ~WebrtcVideoTrackSource() override; WebrtcVideoTrackSource(const WebrtcVideoTrackSource&) = delete; + WebrtcVideoTrackSource& operator=(const WebrtcVideoTrackSource&) = delete; // VideoTrackSourceInterface implementation. @@ -64,7 +65,6 @@ uint16_t frame_id_ = 0; }; -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol #endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_TRACK_SOURCE_H_
diff --git a/remoting/protocol/webrtc_video_track_source_unittest.cc b/remoting/protocol/webrtc_video_track_source_unittest.cc index 5a6d6dae..9d61706 100644 --- a/remoting/protocol/webrtc_video_track_source_unittest.cc +++ b/remoting/protocol/webrtc_video_track_source_unittest.cc
@@ -23,8 +23,7 @@ using webrtc::DesktopSize; using webrtc::VideoFrame; -namespace remoting { -namespace protocol { +namespace remoting::protocol { namespace { @@ -99,5 +98,4 @@ task_environment_.FastForwardUntilNoTasksRemain(); } -} // namespace protocol -} // namespace remoting +} // namespace remoting::protocol
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 87c3147..8712cfc 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -76547,7 +76547,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "absl_hardening_tests", @@ -76577,7 +76577,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -76599,7 +76599,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "base_unittests", @@ -76629,7 +76629,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -76651,7 +76651,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "base_unittests", @@ -76681,7 +76681,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -76703,7 +76703,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "base_unittests", @@ -76733,7 +76733,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -76755,7 +76755,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "boringssl_crypto_tests", @@ -76785,7 +76785,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -76807,7 +76807,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "boringssl_ssl_tests", @@ -76837,7 +76837,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -76859,7 +76859,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "components_unittests", @@ -76889,7 +76889,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -76911,7 +76911,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "components_unittests", @@ -76941,7 +76941,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -76963,7 +76963,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "components_unittests", @@ -76993,7 +76993,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77015,7 +77015,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "crashpad_tests", @@ -77045,7 +77045,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77067,7 +77067,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "crypto_unittests", @@ -77097,7 +77097,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77119,7 +77119,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "gfx_unittests", @@ -77149,7 +77149,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77171,7 +77171,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "gfx_unittests", @@ -77201,7 +77201,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77223,7 +77223,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "gfx_unittests", @@ -77253,7 +77253,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77275,7 +77275,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "google_apis_unittests", @@ -77305,7 +77305,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77327,7 +77327,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -77358,7 +77358,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77380,7 +77380,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -77411,7 +77411,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77433,7 +77433,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -77464,7 +77464,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77486,7 +77486,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -77517,7 +77517,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77539,7 +77539,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -77570,7 +77570,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77593,7 +77593,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -77624,7 +77624,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77647,7 +77647,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -77678,7 +77678,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77701,7 +77701,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -77732,7 +77732,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77755,7 +77755,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -77786,7 +77786,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77809,7 +77809,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -77840,7 +77840,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77863,7 +77863,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -77894,7 +77894,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77917,7 +77917,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -77948,7 +77948,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -77971,7 +77971,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -78002,7 +78002,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78025,7 +78025,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -78056,7 +78056,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78079,7 +78079,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -78110,7 +78110,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78132,7 +78132,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -78163,7 +78163,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78185,7 +78185,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -78216,7 +78216,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78238,7 +78238,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -78269,7 +78269,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78291,7 +78291,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -78322,7 +78322,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78345,7 +78345,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -78376,7 +78376,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78399,7 +78399,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -78430,7 +78430,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78453,7 +78453,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_chrome_unittests", @@ -78483,7 +78483,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78505,7 +78505,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_chrome_unittests", @@ -78535,7 +78535,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78557,7 +78557,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_chrome_unittests", @@ -78587,7 +78587,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78609,7 +78609,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -78640,7 +78640,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78662,7 +78662,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -78693,7 +78693,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78715,7 +78715,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -78746,7 +78746,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78768,7 +78768,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -78799,7 +78799,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78821,7 +78821,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_components_unittests", @@ -78851,7 +78851,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78873,7 +78873,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -78904,7 +78904,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78926,7 +78926,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_net_unittests", @@ -78956,7 +78956,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -78979,7 +78979,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_remoting_unittests", @@ -79009,7 +79009,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79031,7 +79031,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -79062,7 +79062,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79084,7 +79084,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -79115,7 +79115,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79137,7 +79137,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -79168,7 +79168,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79190,7 +79190,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -79221,7 +79221,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79243,7 +79243,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_testing_unittests", @@ -79273,7 +79273,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79295,7 +79295,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_web_inttests", @@ -79325,7 +79325,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79347,7 +79347,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_web_inttests", @@ -79377,7 +79377,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79399,7 +79399,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_web_inttests", @@ -79429,7 +79429,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79451,7 +79451,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -79482,7 +79482,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79504,7 +79504,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -79535,7 +79535,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79557,7 +79557,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest", "--xcode-parallelization" ], @@ -79588,7 +79588,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79610,7 +79610,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_web_unittests", @@ -79640,7 +79640,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79662,7 +79662,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_web_unittests", @@ -79692,7 +79692,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79714,7 +79714,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_web_unittests", @@ -79744,7 +79744,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79766,7 +79766,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_web_view_inttests", @@ -79796,7 +79796,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79818,7 +79818,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_web_view_inttests", @@ -79848,7 +79848,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79870,7 +79870,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_web_view_inttests", @@ -79900,7 +79900,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79922,7 +79922,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_web_view_unittests", @@ -79952,7 +79952,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -79974,7 +79974,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_web_view_unittests", @@ -80004,7 +80004,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80026,7 +80026,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ios_web_view_unittests", @@ -80056,7 +80056,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80078,7 +80078,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "net_unittests", @@ -80108,7 +80108,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80130,7 +80130,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "services_unittests", @@ -80160,7 +80160,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80182,7 +80182,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "skia_unittests", @@ -80212,7 +80212,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80234,7 +80234,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "skia_unittests", @@ -80264,7 +80264,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80286,7 +80286,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "skia_unittests", @@ -80316,7 +80316,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80338,7 +80338,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "sql_unittests", @@ -80368,7 +80368,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80390,7 +80390,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ui_base_unittests", @@ -80420,7 +80420,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80442,7 +80442,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ui_base_unittests", @@ -80472,7 +80472,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80494,7 +80494,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "ui_base_unittests", @@ -80524,7 +80524,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80546,7 +80546,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--xctest" ], "isolate_name": "url_unittests", @@ -80576,7 +80576,7 @@ ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80605,7 +80605,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -80632,12 +80632,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80659,7 +80660,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -80686,12 +80687,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80713,7 +80715,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -80740,12 +80742,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80767,7 +80770,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -80794,12 +80797,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80821,7 +80825,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -80848,12 +80852,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80875,7 +80880,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -80902,12 +80907,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80929,7 +80935,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -80956,12 +80962,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -80983,7 +80990,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81010,12 +81017,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81037,7 +81045,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81064,12 +81072,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81091,7 +81100,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81118,12 +81127,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81145,7 +81155,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81172,12 +81182,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81199,7 +81210,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81226,12 +81237,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81253,7 +81265,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81280,12 +81292,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81307,7 +81320,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81334,12 +81347,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81361,7 +81375,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81388,12 +81402,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81415,7 +81430,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81442,12 +81457,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81469,7 +81485,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81496,12 +81512,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81523,7 +81540,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81550,12 +81567,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81577,7 +81595,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81604,12 +81622,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81631,7 +81650,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81658,12 +81677,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81685,7 +81705,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81712,12 +81732,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81739,7 +81760,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81766,12 +81787,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81793,7 +81815,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81820,12 +81842,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81847,7 +81870,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81874,12 +81897,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81901,7 +81925,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81928,12 +81952,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -81955,7 +81980,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -81982,12 +82007,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82009,7 +82035,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -82036,12 +82062,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82063,7 +82090,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -82090,12 +82117,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82117,7 +82145,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -82144,12 +82172,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82171,7 +82200,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -82198,12 +82227,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82225,7 +82255,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -82253,12 +82283,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82280,7 +82311,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -82308,12 +82339,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82335,7 +82367,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -82363,12 +82395,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82390,7 +82423,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -82418,12 +82451,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82445,7 +82479,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -82473,12 +82507,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82500,7 +82535,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -82528,12 +82563,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82555,7 +82591,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -82583,12 +82619,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82610,7 +82647,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -82638,12 +82675,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82665,7 +82703,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -82693,12 +82731,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82720,7 +82759,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -82748,12 +82787,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82776,7 +82816,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -82804,12 +82844,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82832,7 +82873,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -82860,12 +82901,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82888,7 +82930,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -82916,12 +82958,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -82944,7 +82987,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -82972,12 +83015,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83000,7 +83044,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83028,12 +83072,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83056,7 +83101,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83084,12 +83129,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83112,7 +83158,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83140,12 +83186,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83168,7 +83215,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83196,12 +83243,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83224,7 +83272,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83252,12 +83300,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83280,7 +83329,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83308,12 +83357,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83336,7 +83386,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83364,12 +83414,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83392,7 +83443,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83420,12 +83471,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83448,7 +83500,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83476,12 +83528,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83504,7 +83557,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83532,12 +83585,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83560,7 +83614,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83588,12 +83642,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83616,7 +83671,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83644,12 +83699,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83672,7 +83728,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83700,12 +83756,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83728,7 +83785,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83756,12 +83813,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83784,7 +83842,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83812,12 +83870,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83840,7 +83899,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83868,12 +83927,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83896,7 +83956,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83924,12 +83984,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -83952,7 +84013,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -83980,12 +84041,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84008,7 +84070,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84036,12 +84098,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84064,7 +84127,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84092,12 +84155,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84120,7 +84184,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84148,12 +84212,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84176,7 +84241,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84204,12 +84269,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84232,7 +84298,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84260,12 +84326,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84287,7 +84354,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84315,12 +84382,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84342,7 +84410,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84370,12 +84438,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84397,7 +84466,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84425,12 +84494,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84452,7 +84522,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84480,12 +84550,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84507,7 +84578,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84535,12 +84606,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84562,7 +84634,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84590,12 +84662,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84617,7 +84690,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84645,12 +84718,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84672,7 +84746,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84700,12 +84774,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84727,7 +84802,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84755,12 +84830,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84783,7 +84859,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84811,12 +84887,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84839,7 +84916,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84867,12 +84944,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84895,7 +84973,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84923,12 +85001,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -84951,7 +85030,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -84979,12 +85058,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85007,7 +85087,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -85035,12 +85115,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85063,7 +85144,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -85091,12 +85172,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85119,7 +85201,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -85147,12 +85229,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85175,7 +85258,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -85203,12 +85286,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85231,7 +85315,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -85258,12 +85342,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85285,7 +85370,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -85312,12 +85397,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85339,7 +85425,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -85366,12 +85452,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85393,7 +85480,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -85420,12 +85507,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85447,7 +85535,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -85475,12 +85563,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85502,7 +85591,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -85530,12 +85619,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85557,7 +85647,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -85585,12 +85675,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85612,7 +85703,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -85640,12 +85731,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85667,7 +85759,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -85695,12 +85787,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85722,7 +85815,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -85750,12 +85843,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85777,7 +85871,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -85805,12 +85899,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85832,7 +85927,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -85860,12 +85955,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85887,7 +85983,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -85915,12 +86011,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85942,7 +86039,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -85969,12 +86066,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -85996,7 +86094,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -86023,12 +86121,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86050,7 +86149,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -86077,12 +86176,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86104,7 +86204,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -86132,12 +86232,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86159,7 +86260,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -86187,12 +86288,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86214,7 +86316,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -86242,12 +86344,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86269,7 +86372,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -86296,12 +86399,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86324,7 +86428,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -86351,12 +86455,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86379,7 +86484,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -86406,12 +86511,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86434,7 +86540,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -86461,12 +86567,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86488,7 +86595,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -86515,12 +86622,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86542,7 +86650,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -86569,12 +86677,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86596,7 +86705,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -86624,12 +86733,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86651,7 +86761,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -86679,12 +86789,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86706,7 +86817,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -86734,12 +86845,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86761,7 +86873,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -86789,12 +86901,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86816,7 +86929,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -86844,12 +86957,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86871,7 +86985,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -86899,12 +87013,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86926,7 +87041,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -86954,12 +87069,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -86981,7 +87097,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -87009,12 +87125,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87036,7 +87153,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -87064,12 +87181,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87091,7 +87209,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -87118,12 +87236,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87145,7 +87264,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -87172,12 +87291,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87199,7 +87319,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -87226,12 +87346,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87253,7 +87374,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -87280,12 +87401,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87307,7 +87429,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -87334,12 +87456,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87361,7 +87484,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -87388,12 +87511,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87415,7 +87539,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -87442,12 +87566,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87469,7 +87594,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -87497,12 +87622,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87524,7 +87650,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -87552,12 +87678,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87579,7 +87706,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -87607,12 +87734,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87634,7 +87762,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -87662,12 +87790,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87689,7 +87818,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -87717,12 +87846,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87744,7 +87874,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -87772,12 +87902,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87799,7 +87930,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -87827,12 +87958,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87854,7 +87986,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -87882,12 +88014,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87909,7 +88042,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest", @@ -87937,12 +88070,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -87964,7 +88098,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -87991,12 +88125,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88018,7 +88153,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88045,12 +88180,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88072,7 +88208,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88099,12 +88235,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88126,7 +88263,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88153,12 +88290,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88180,7 +88318,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88207,12 +88345,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88234,7 +88373,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88261,12 +88400,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88288,7 +88428,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88315,12 +88455,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88342,7 +88483,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88369,12 +88510,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88396,7 +88538,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88423,12 +88565,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88450,7 +88593,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88477,12 +88620,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88504,7 +88648,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88531,12 +88675,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88558,7 +88703,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88585,12 +88730,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88612,7 +88758,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88639,12 +88785,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88666,7 +88813,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88693,12 +88840,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88720,7 +88868,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88747,12 +88895,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88774,7 +88923,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88801,12 +88950,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88828,7 +88978,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88855,12 +89005,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88882,7 +89033,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88909,12 +89060,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88936,7 +89088,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -88963,12 +89115,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -88990,7 +89143,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -89017,12 +89170,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -89044,7 +89198,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -89071,12 +89225,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -89098,7 +89253,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -89125,12 +89280,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -89152,7 +89308,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -89179,12 +89335,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -89206,7 +89363,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -89233,12 +89390,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -89260,7 +89418,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -89287,12 +89445,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -89314,7 +89473,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -89341,12 +89500,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -89368,7 +89528,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -89395,12 +89555,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -89422,7 +89583,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -89449,12 +89610,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -89476,7 +89638,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -89503,12 +89665,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -89530,7 +89693,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -89557,12 +89720,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -89584,7 +89748,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -89611,12 +89775,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -89638,7 +89803,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "14a5294e", + "14a5294g", "--readline-timeout", "600", "--xctest" @@ -89665,12 +89830,13 @@ "dimension_sets": [ { "cpu": "x86-64", + "mac_model": "Macmini8,1", "os": "Mac-12.4" } ], "named_caches": [ { - "name": "xcode_ios_14a5294e", + "name": "xcode_ios_14a5294g", "path": "Xcode.app" }, { @@ -89989,8 +90155,9 @@ "skylab_tests": [ { "args": [], + "bucket": "chromiumos-image-archive", "cros_board": "octopus", - "cros_img": "chromiumos-image-archive/octopus-public/R105-14988.0.0", + "cros_img": "octopus-public/R105-14988.0.0", "name": "lacros_fyi_tast_tests OCTOPUS_FULL", "swarming": {}, "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", @@ -90001,8 +90168,9 @@ }, { "args": [], + "bucket": "chromiumos-image-archive", "cros_board": "eve", - "cros_img": "chromiumos-image-archive/eve-public/R105-14988.0.0", + "cros_img": "eve-public/R105-14988.0.0", "name": "lacros_fyi_tast_tests EVE_FULL", "swarming": {}, "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", @@ -90013,8 +90181,9 @@ }, { "args": [], + "bucket": "chromiumos-image-archive", "cros_board": "octopus", - "cros_img": "chromiumos-image-archive/octopus-public/R105-14988.0.0", + "cros_img": "octopus-public/R105-14988.0.0", "name": "ozone_unittests OCTOPUS_FULL", "swarming": {}, "test": "ozone_unittests", @@ -90024,8 +90193,9 @@ }, { "args": [], + "bucket": "chromiumos-image-archive", "cros_board": "eve", - "cros_img": "chromiumos-image-archive/eve-public/R105-14988.0.0", + "cros_img": "eve-public/R105-14988.0.0", "name": "ozone_unittests EVE_FULL", "swarming": {}, "test": "ozone_unittests", @@ -106429,10 +106599,10 @@ "--child-processes=8", "--run-by-dir=0", "--no-restart-on-new-group", - "--product=content_shell" + "--xvfb" ], "experiment_percentage": 100, - "isolate_name": "wpt_tests_isolate", + "isolate_name": "wpt_tests_isolate_content_shell", "merge": { "args": [ "--verbose" @@ -106455,7 +106625,7 @@ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 15 }, - "test_id_prefix": "ninja://:wpt_tests_isolate/" + "test_id_prefix": "ninja://:wpt_tests_isolate_content_shell/" } ] },
diff --git a/testing/buildbot/chromium.mac.json b/testing/buildbot/chromium.mac.json index de9ab7d..fee78f1 100644 --- a/testing/buildbot/chromium.mac.json +++ b/testing/buildbot/chromium.mac.json
@@ -11006,7 +11006,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11060,7 +11060,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11114,7 +11114,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11168,7 +11168,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11222,7 +11222,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11276,7 +11276,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11330,7 +11330,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11384,7 +11384,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11438,7 +11438,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11492,7 +11492,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11546,7 +11546,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11600,7 +11600,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11654,7 +11654,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11708,7 +11708,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11762,7 +11762,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11816,7 +11816,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11870,7 +11870,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11924,7 +11924,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -11979,7 +11979,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12035,7 +12035,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12091,7 +12091,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12146,7 +12146,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12200,7 +12200,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12254,7 +12254,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12308,7 +12308,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12362,7 +12362,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12416,7 +12416,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12471,7 +12471,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12525,7 +12525,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12579,7 +12579,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12633,7 +12633,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12687,7 +12687,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12741,7 +12741,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12796,7 +12796,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12850,7 +12850,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12904,7 +12904,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -12958,7 +12958,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13012,7 +13012,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13066,7 +13066,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13120,7 +13120,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13174,7 +13174,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13228,7 +13228,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13282,7 +13282,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13336,7 +13336,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13390,7 +13390,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13444,7 +13444,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13498,7 +13498,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13552,7 +13552,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13606,7 +13606,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13660,7 +13660,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13714,7 +13714,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13768,7 +13768,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13822,7 +13822,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13876,7 +13876,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13930,7 +13930,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -13984,7 +13984,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -14038,7 +14038,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [ @@ -14092,7 +14092,7 @@ { "cpu": "x86-64", "mac_model": "Macmini8,1", - "os": "Mac-12" + "os": "Mac-12.4" } ], "named_caches": [
diff --git a/testing/buildbot/filters/fuchsia.browser_tests.filter b/testing/buildbot/filters/fuchsia.browser_tests.filter index 4c56be52..b4280b1 100644 --- a/testing/buildbot/filters/fuchsia.browser_tests.filter +++ b/testing/buildbot/filters/fuchsia.browser_tests.filter
@@ -381,33 +381,6 @@ -BluetoothPrivateApiTest.PincodePairing -BluetoothPrivateApiTest.SetAdapterState -# TODO(crbug.com/1321153): SQLite database could not set locking_mode to normal, Unable to turn on -# incremental auto-vacuum (3850 disk I/O error) --All/BrowsingDataRemoverBrowserTestP.WebSqlDeletion/0 --All/BrowsingDataRemoverBrowserTestP.WebSqlDeletion/1 --All/BrowsingDataRemoverBrowserTestP.WebSqlIncognitoDeletion/0 --All/BrowsingDataRemoverBrowserTestP.WebSqlIncognitoDeletion/1 --AccessContextAuditBrowserTest.CheckSessionOnly --AccessContextAuditBrowserTest.MultipleAccesses --AccessContextAuditBrowserTest.RemoveHistory --AccessContextAuditBrowserTest.RemoveRecords --AccessContextAuditBrowserTest.TabClosed --AccessContextAuditBrowserTest.TreeModelDeletion --AccessContextAuditSessionRestoreBrowserTest.RestoreSession --All/ChromeBrowsingDataLifetimeManagerScheduledRemovalTest.KeepsOtherTabData/0 --All/ChromeBrowsingDataLifetimeManagerScheduledRemovalTest.KeepsOtherWindowData/0 --All/ChromeBrowsingDataLifetimeManagerScheduledRemovalTest.SiteData/0 --All/ChromeBrowsingDataLifetimeManagerScheduledRemovalTest.SiteData/1 --BrowsingDataRemoverBrowserTest.Database --BrowsingDataRemoverBrowserTest.SessionOnlyStorageRemoved --BrowsingDataRemoverBrowserTest.StorageRemovedFromDisk --CookiePolicyBrowserTest.NestedFirstPartyIFrameStorageForFrame --ExtensionApiTest.Storage --ExtensionBackForwardCacheBrowserTest.StorageCallbackEvicts --IncognitoBrowsingDataBrowserTest.Database --IncognitoBrowsingDataBrowserTest.StorageDoesntWriteToDisk --IncognitoBrowsingDataBrowserTest.WebSqlDeletion - # TODO(crbug.com/1326988): GPU process isn't usable -RestoreOnStartupPolicyTestInstance/RestoreOnStartupPolicyTest.RunTest/0 -RestoreOnStartupPolicyTestInstance/RestoreOnStartupPolicyTest.RunTest/1
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index dc1d49ad..3dc5c68 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -547,6 +547,10 @@ "label": "//:wpt_tests_isolate", "type": "generated_script", }, + "wpt_tests_isolate_content_shell": { + "label": "//:wpt_tests_isolate_content_shell", + "type": "generated_script", + }, "chrome/browser/media/router": { "label": "//chrome/browser/media/router:router", "type": "additional_compile_target",
diff --git a/testing/buildbot/mixins.pyl b/testing/buildbot/mixins.pyl index 8e1da0a2..607a1e85 100644 --- a/testing/buildbot/mixins.pyl +++ b/testing/buildbot/mixins.pyl
@@ -809,7 +809,7 @@ 'dimensions': { 'cpu': 'x86-64', 'mac_model': 'Macmini8,1', - 'os': 'Mac-12', + 'os': 'Mac-12.4', }, }, }, @@ -1361,13 +1361,13 @@ '$mixin_append': { 'args': [ '--xcode-build-version', - '14a5294e' + '14a5294g' ], }, 'swarming': { 'named_caches': [ { - 'name': 'xcode_ios_14a5294e', + 'name': 'xcode_ios_14a5294g', 'path': 'Xcode.app', }, ],
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index fa412a3..9083123 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -5129,7 +5129,7 @@ '--child-processes=8', '--run-by-dir=0', '--no-restart-on-new-group', - '--product=content_shell' + '--xvfb' ], 'merge': { 'args': [ @@ -5137,7 +5137,7 @@ ], 'script': '//third_party/blink/tools/merge_web_test_results.py', }, - 'isolate_name': 'wpt_tests_isolate', + 'isolate_name': 'wpt_tests_isolate_content_shell', 'results_handler': 'layout tests', 'swarming': { 'shards': 15,
diff --git a/testing/buildbot/variants.pyl b/testing/buildbot/variants.pyl index c27130f..460a7ca0 100644 --- a/testing/buildbot/variants.pyl +++ b/testing/buildbot/variants.pyl
@@ -910,7 +910,8 @@ 'skylab': { 'cros_board': 'eve', 'cros_chrome_version': '105.0.5190.0', - 'cros_img': 'chromiumos-image-archive/eve-public/R105-14988.0.0', + 'cros_img': 'eve-public/R105-14988.0.0', + 'bucket': 'chromiumos-image-archive', }, 'enabled': True, 'identifier': 'EVE_FULL', @@ -1000,7 +1001,8 @@ 'skylab': { 'cros_board': 'octopus', 'cros_chrome_version': '105.0.5190.0', - 'cros_img': 'chromiumos-image-archive/octopus-public/R105-14988.0.0', + 'cros_img': 'octopus-public/R105-14988.0.0', + 'bucket': 'chromiumos-image-archive', }, 'enabled': True, 'identifier': 'OCTOPUS_FULL',
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 13ce7eb..d3c638a2 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -3463,7 +3463,7 @@ ], 'mixins': [ 'has_native_resultdb_integration', - 'mac_beta_x64', + 'mac_12_t2_x64', 'mac_toolchain', 'out_dir_arg', 'xcode_14_beta',
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 2935166..c88d807 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -3256,21 +3256,6 @@ ] } ], - "ContextualSearchSuppressShortView": [ - { - "platforms": [ - "android" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "ContextualSearchSuppressShortView" - ] - } - ] - } - ], "ContextualTriggers": [ { "platforms": [ @@ -4739,32 +4724,6 @@ ] } ], - "GreedyWakeupsStrategy": [ - { - "platforms": [ - "android", - "android_weblayer", - "android_webview", - "chromeos", - "chromeos_lacros", - "ios", - "linux", - "mac", - "windows" - ], - "experiments": [ - { - "name": "Enabled", - "params": { - "strategy": "greedy-wakeups" - }, - "enable_features": [ - "WakeUpStrategyFeature" - ] - } - ] - } - ], "GridAndGroupAndroidM5": [ { "platforms": [
diff --git a/third_party/androidx/bisect_androidx_pinpoint.sh b/third_party/androidx/bisect_androidx_pinpoint.sh new file mode 100755 index 0000000..bac1d60f --- /dev/null +++ b/third_party/androidx/bisect_androidx_pinpoint.sh
@@ -0,0 +1,115 @@ +#!/bin/bash +# Copyright 2022 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. + +####################################################################### +# See go/clank-autoroll#androidx-bisect for instructions. +####################################################################### + +function abort() { + echo "$1" >&2 + # 255 will abort the bisect. 125 marks commit as "unknown". + exit ${2-255} +} + +if [[ -z "$PERF_BENCHMARK" || -z "$PERF_BOT" || -z "$PERF_STORY" || -z "$PERF_METRIC" ]]; then + abort 'Example Usage: +PERF_BENCHMARK="startup.mobile" \ +PERF_BOT="android-pixel4-perf" \ +PERF_STORY="cct_coldish_bbc" \ +PERF_METRIC="messageloop_start_time" '$0 "$@" +fi + +# Determine Chromium src path based on script location. +CHROMIUM_SRC="$(dirname $0)/../.." +# Determine Android src path based on current directory (git bisect must be run from it). +# Allow running from superproject root, or from within frameworks/support. +if [[ -d frameworks/support ]]; then + SUPERPROJECT_DIR="$(pwd)" +elif [[ -d ../../frameworks/support ]]; then + SUPERPROJECT_DIR="$(pwd)/../.." +else + abort "Expected to have been run from androidx checkout." +fi +FRAMEWORKS_SUPPORT_DIR="$SUPERPROJECT_DIR/frameworks/support" + +set -x +set -o pipefail + +cd "$CHROMIUM_SRC" +# Sanity checks: +pinpoint auth-info >/dev/null || abort "First run: pinpoint auth-login" +cipd auth-info >/dev/null || abort "First run: cipd auth-login" +# Needed for androidx sync. +gcertstatus -check_ssh=false || abort "First run: gcert" + +# Allow //third_party/androidx/cipd.yaml to be listed. +local changes=$(git status --porcelain | grep -v cipd.yaml) +[[ -n "$changes" ]] && abort "git status reports changes present." + +# Ensure we're on a non-main branch. +git_branch=$(git rev-parse --abbrev-ref HEAD) +[[ "$git_branch" = HEAD ]] && abort "Need to be on a branch" +[[ "$git_branch" = main ]] && abort "Need to be on a non-main branch" + +# Use the most recent non-local commit as the diffbase. +git_base_rev=$(git merge-base origin/main HEAD) + +cd "$SUPERPROJECT_DIR" +git submodule update --recursive --init || abort "AndroidX sync Failed" +cd "$FRAMEWORKS_SUPPORT_DIR" +# Creates a local maven repo in: out/dist/repository. Aborts bisect upon failure. + +SNAPSHOT=true ./gradlew createArchive || abort "AndroidX Build Failed" 125 +cd $CHROMIUM_SRC +third_party/androidx/fetch_all_androidx.py \ + --local-repo "$SUPERPROJECT_DIR/out/dist/repository" || abort "fetch_all_androidx.py failure" + +super_rev=$(git -C "$SUPERPROJECT_DIR" rev-parse HEAD) +support_rev=$(git -C "$FRAMEWORKS_SUPPORT_DIR" rev-parse HEAD) +cipd_output=$(cipd create -pkg-def third_party/androidx/cipd.yaml \ + -tag super_rev:$super_rev \ + -tag support_rev:$support_rev | grep Instance:) || abort "cipd failure" +# E.g.: Instance: experimental/google.com/agrieve/androidx:3iiAIwUqY5nB5O9ArpioN... +cipd_output=${cipd_output#*Instance: } +cipd_package=${cipd_output%:*} # Strip after colon. +cipd_package_escaped=${cipd_package//\//\\/} +cipd_instance=${cipd_output#*:} # Strip before colon. +# This needs to be run only once per package, but it's simpler to run it every time. +cipd acl-edit "$cipd_package" -reader group:all || abort "cipd acl failure" +# gclient setdep does not allow changing CIPD package, so perl it is. +perl -0777 -i -pe "s/(.*src\/third_party\/androidx.*?packages.*?package': ')(.*?)('.*?version': ')(.*?)('.*)/\${1}${cipd_package_escaped}\${3}${cipd_instance}\$5/s" DEPS + +git add DEPS || abort "git add failed" +git commit -m "androidx bisect super_rev=${super_rev::9} support_rev=${support_rev::9}" +EDITOR=true git cl upload --bypass-hooks --bypass-watchlists --no-autocc --message "androidx bisect review" \ + --title "super_rev=${super_rev::9} support_rev=${support_rev::9}" || abort "Upload CL failed" +review_number=$(git cl issue | grep -P --only-matching '(?<=Issue number: )(\d+)') || abort "parsing issue failed" + +review_url="https://chromium-review.googlesource.com/c/chromium/src/+/$review_number" +# Returns non-zero if metric changed or if command fails. +pinpoint_job=$(pinpoint experiment-telemetry-start \ + -base-commit $git_base_rev -exp-commit $git_base_rev \ + -benchmark $PERF_BENCHMARK -cfg $PERF_BOT \ + -story $PERF_STORY -measurement $PERF_METRIC \ + -check-experiment -wait -quiet \ + -exp-patch-url "$review_url" \ + | tee /dev/stderr \ + | grep -P --only-matching '(?<=/job/)\S+') +# E.g.: Pinpoint job scheduled: https://pinpoint-dot-chromeperf.appspot.com/job/13af94f2ea0000 +retcode=$? + +if [[ -z "$pinpoint_job" ]]; then + abort "Failed to parse pinpoint job" +fi +# E.g.: state: SUCCEEDED +if ! pinpoint get-job -name $pinpoint_job | grep -q "state.*SUCCEEDED"; then + abort "Pinpoint did not finish successfully." +fi + +# Expect a significant difference for good changes. +if [[ $retcode = 0 ]]; then + exit 1 +fi +exit 0
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc index 30ce14202..58d81e9 100644 --- a/third_party/blink/common/features.cc +++ b/third_party/blink/common/features.cc
@@ -1632,6 +1632,12 @@ const base::Feature kWebRtcThreadsUseResourceEfficientType{ "WebRtcThreadsUseResourceEfficientType", base::FEATURE_DISABLED_BY_DEFAULT}; +// TODO(wangxianzhu): We plan to enable this feature for several canary builds, +// to see if the simulation is accurate. Then we'll disable it by default and +// finch, and eventually remove this feature. +const base::Feature kOldCullRectUpdater{"OldCullRectUpdater", + base::FEATURE_ENABLED_BY_DEFAULT}; + const base::Feature kThrottleIntersectionObserverUMA{ "ThrottleIntersectionObserverUMA", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h index 6a27e7c..e6df461 100644 --- a/third_party/blink/public/common/features.h +++ b/third_party/blink/public/common/features.h
@@ -884,6 +884,10 @@ BLINK_COMMON_EXPORT extern const base::Feature kWebRtcThreadsUseResourceEfficientType; +// If enabled, CullRectUpdater will simulate the old behavior before +// crrev.com/1033837, for comparison with the new behavior. +BLINK_COMMON_EXPORT extern const base::Feature kOldCullRectUpdater; + // If enabled, fine-grained UMA metrics for IntersectionObserver will only be // collected on 10% of animation frames. BLINK_COMMON_EXPORT extern const base::Feature kThrottleIntersectionObserverUMA;
diff --git a/third_party/blink/public/mojom/frame/frame.mojom b/third_party/blink/public/mojom/frame/frame.mojom index cc48c69..75f5daaf 100644 --- a/third_party/blink/public/mojom/frame/frame.mojom +++ b/third_party/blink/public/mojom/frame/frame.mojom
@@ -56,6 +56,7 @@ import "third_party/blink/public/mojom/tokens/tokens.mojom"; import "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom"; import "third_party/blink/public/mojom/widget/platform_widget.mojom"; +import "third_party/blink/public/mojom/window_features/window_features.mojom"; import "ui/base/mojom/window_open_disposition.mojom"; import "ui/events/mojom/scroll_granularity.mojom"; import "ui/gfx/geometry/mojom/geometry.mojom"; @@ -996,7 +997,8 @@ // which is always set. This is called on the main frame of the window to be shown. ShowCreatedWindow(blink.mojom.LocalFrameToken opener_frame_token, ui.mojom.WindowOpenDisposition disposition, - gfx.mojom.Rect rect, bool opened_by_user_gesture) => (); + blink.mojom.WindowFeatures window_features, + bool opened_by_user_gesture) => (); // Request that the browser change the bounds of the window. // This corresponds to the window.resizeTo() and window.moveTo() APIs, and the browser
diff --git a/third_party/blink/public/mojom/webid/federated_auth_request.mojom b/third_party/blink/public/mojom/webid/federated_auth_request.mojom index 1df8053f..b670e2f 100644 --- a/third_party/blink/public/mojom/webid/federated_auth_request.mojom +++ b/third_party/blink/public/mojom/webid/federated_auth_request.mojom
@@ -59,7 +59,7 @@ // Requests a token to be generated, given an array of IdentityProviders. // Returns the raw content of the token. RequestToken(array<IdentityProvider> identity_providers, - bool prefer_auto_sign_in) => + bool prefer_auto_sign_in, bool show_iframe_requester) => (RequestTokenStatus status, string? token); // Cancels the pending token request, if any.
diff --git a/third_party/blink/public/mojom/window_features/window_features.mojom b/third_party/blink/public/mojom/window_features/window_features.mojom index dac13c38..5d7e3a8 100644 --- a/third_party/blink/public/mojom/window_features/window_features.mojom +++ b/third_party/blink/public/mojom/window_features/window_features.mojom
@@ -4,17 +4,16 @@ module blink.mojom; +import "ui/gfx/geometry/mojom/geometry.mojom"; + struct WindowFeatures { - float x; + gfx.mojom.Rect bounds; + + // Rect cannot differentiate between 0 and unset values. + // These explicitly define which values were set in |bounds|. bool has_x = false; - - float y; bool has_y = false; - - float width; bool has_width = false; - - float height; bool has_height = false; bool menu_bar_visible = true;
diff --git a/third_party/blink/renderer/bindings/generated_in_modules.gni b/third_party/blink/renderer/bindings/generated_in_modules.gni index 93ebfd1c..05df7e22 100644 --- a/third_party/blink/renderer/bindings/generated_in_modules.gni +++ b/third_party/blink/renderer/bindings/generated_in_modules.gni
@@ -1208,6 +1208,8 @@ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_transaction_durability.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_transaction_mode.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_transaction_mode.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_identity_credential_show_requester_mode.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_identity_credential_show_requester_mode.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_image_smoothing_quality.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_image_smoothing_quality.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_item_type.cc",
diff --git a/third_party/blink/renderer/core/animation/animation_test.cc b/third_party/blink/renderer/core/animation/animation_test.cc index cf1628f..a2665b9 100644 --- a/third_party/blink/renderer/core/animation/animation_test.cc +++ b/third_party/blink/renderer/core/animation/animation_test.cc
@@ -1542,9 +1542,6 @@ // of the animation if running. TEST_P(AnimationAnimationTestCompositing, RestartCompositedAnimationOnSizeChange) { - // TODO(crbug.com/389359): Remove forced feature enabling once on by - // default. - ScopedCompositeRelativeKeyframesForTest composite_relative_keyframes(true); SetBodyInnerHTML(R"HTML( <div id="target" style="width: 100px; height: 200px; background: blue; will-change: transform"> @@ -1595,9 +1592,6 @@ // depends on width and a change to the height does not trigger a restart. TEST_P(AnimationAnimationTestCompositing, RestartCompositedAnimationOnWidthChange) { - // TODO(crbug.com/389359): Remove forced feature enabling once on by - // default. - ScopedCompositeRelativeKeyframesForTest composite_relative_keyframes(true); SetBodyInnerHTML(R"HTML( <div id="target" style="width: 100px; height: 200px; background: blue; will-change: transform"> @@ -1638,9 +1632,6 @@ // affects height and a change to the width does not trigger a restart. TEST_P(AnimationAnimationTestCompositing, RestartCompositedAnimationOnHeightChange) { - // TODO(crbug.com/389359): Remove forced feature enabling once on by - // default. - ScopedCompositeRelativeKeyframesForTest composite_relative_keyframes(true); SetBodyInnerHTML(R"HTML( <div id="target" style="width: 100px; height: 200px; background: blue; will-change: transform">
diff --git a/third_party/blink/renderer/core/animation/compositor_animations.cc b/third_party/blink/renderer/core/animation/compositor_animations.cc index 8827e869..58fcc97 100644 --- a/third_party/blink/renderer/core/animation/compositor_animations.cc +++ b/third_party/blink/renderer/core/animation/compositor_animations.cc
@@ -310,20 +310,6 @@ case CSSPropertyID::kScale: case CSSPropertyID::kTranslate: case CSSPropertyID::kTransform: - // TODO(crbug.com/389359): Currently only CSS boxes support - // compositing box-size-dependent transform animations. Once such - // support is fully working for SVG, this section (and the flag) - // should be removed. - if (!RuntimeEnabledFeatures::CompositeRelativeKeyframesEnabled() || - (layout_object && layout_object->IsSVGChild())) { - if (keyframe->GetCompositorKeyframeValue() && - To<CompositorKeyframeTransform>( - keyframe->GetCompositorKeyframeValue()) - ->GetTransformOperations() - .BoxSizeDependencies()) { - reasons |= kTransformRelatedPropertyDependsOnBoxSize; - } - } break; case CSSPropertyID::kFilter: if (keyframe->GetCompositorKeyframeValue() &&
diff --git a/third_party/blink/renderer/core/animation/compositor_animations.h b/third_party/blink/renderer/core/animation/compositor_animations.h index 9ebf1a23..15843ee 100644 --- a/third_party/blink/renderer/core/animation/compositor_animations.h +++ b/third_party/blink/renderer/core/animation/compositor_animations.h
@@ -96,7 +96,6 @@ // Cases relating to the properties being animated. kAnimationAffectsNonCSSProperties = 1 << 9, kTransformRelatedPropertyCannotBeAcceleratedOnTarget = 1 << 10, - kTransformRelatedPropertyDependsOnBoxSize = 1 << 11, kFilterRelatedPropertyMayMovePixels = 1 << 12, kUnsupportedCSSProperty = 1 << 13,
diff --git a/third_party/blink/renderer/core/animation/compositor_animations_test.cc b/third_party/blink/renderer/core/animation/compositor_animations_test.cc index e2a3883..fdba78cd 100644 --- a/third_party/blink/renderer/core/animation/compositor_animations_test.cc +++ b/third_party/blink/renderer/core/animation/compositor_animations_test.cc
@@ -622,33 +622,6 @@ } TEST_P(AnimationCompositorAnimationsTest, - IsNotCandidateForCompositorAnimationTransformDependsOnBoxSize) { - ScopedCompositeRelativeKeyframesForTest no_relative_keyframes(false); - - // Absolute transforms can be animated on the compositor. - String transform = "translateX(2px) translateY(2px)"; - StringKeyframe* good_keyframe = - CreateReplaceOpKeyframe(CSSPropertyID::kTransform, transform); - EXPECT_EQ(DuplicateSingleKeyframeAndTestIsCandidateOnResult(good_keyframe), - CompositorAnimations::kNoFailure); - - // Transforms that rely on the box size, such as percent calculations, cannot - // be animated on the compositor (as the box size may change). - String transform2 = "translateX(50%) translateY(2px)"; - StringKeyframe* bad_keyframe = - CreateReplaceOpKeyframe(CSSPropertyID::kTransform, transform2); - EXPECT_TRUE(DuplicateSingleKeyframeAndTestIsCandidateOnResult(bad_keyframe) & - CompositorAnimations::kTransformRelatedPropertyDependsOnBoxSize); - - // Similarly, calc transforms cannot be animated on the compositor. - String transform3 = "translateX(calc(100% + (0.5 * 100px)))"; - StringKeyframe* bad_keyframe2 = - CreateReplaceOpKeyframe(CSSPropertyID::kTransform, transform3); - EXPECT_TRUE(DuplicateSingleKeyframeAndTestIsCandidateOnResult(bad_keyframe2) & - CompositorAnimations::kTransformRelatedPropertyDependsOnBoxSize); -} - -TEST_P(AnimationCompositorAnimationsTest, CanStartEffectOnCompositorKeyframeEffectModel) { StringKeyframeVector frames_same; frames_same.push_back(CreateDefaultKeyframe(
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer.cc b/third_party/blink/renderer/core/clipboard/data_transfer.cc index e4fff2f..6078a56 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer.cc +++ b/third_party/blink/renderer/core/clipboard/data_transfer.cc
@@ -432,9 +432,11 @@ float device_scale_factor, LocalFrame* frame) const { if (drag_image_element_) { - loc = drag_loc_; - // The image below is already rendered, so shouldn't be scaled (using - // device_scale_factor). + // Convert `drag_loc_` from CSS px to physical pixels. This makes it + // match the units used in the rendered image below. + // `LocalFrame::PageZoomFactor` converts from CSS px to physical px by + // taking into account both device scale factor and page zoom. + loc = gfx::ScaleToRoundedPoint(drag_loc_, frame->PageZoomFactor()); return NodeImage(*frame, *drag_image_element_); } if (drag_image_) {
diff --git a/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.cc b/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.cc index ef9ee7f4..0ee6d52 100644 --- a/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.cc +++ b/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.cc
@@ -93,33 +93,39 @@ } } -uint8_t CheckPseudoHasCacheScope::Context::SetMatchedAndGetOldResult( - Element* element) { - return SetResultAndGetOld(element, kChecked | kMatched); +CheckPseudoHasResult +CheckPseudoHasCacheScope::Context::SetMatchedAndGetOldResult(Element* element) { + return SetResultAndGetOld( + element, kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched); } void CheckPseudoHasCacheScope::Context::SetChecked(Element* element) { - SetResultAndGetOld(element, kChecked); + SetResultAndGetOld(element, kCheckPseudoHasResultChecked); } -uint8_t CheckPseudoHasCacheScope::Context::SetResultAndGetOld(Element* element, - uint8_t result) { +CheckPseudoHasResult CheckPseudoHasCacheScope::Context::SetResultAndGetOld( + Element* element, + CheckPseudoHasResult result) { DCHECK(cache_allowed_); DCHECK(result_map_); - uint8_t old_result = kNotCached; + CheckPseudoHasResult old_result = kCheckPseudoHasResultNotCached; auto cache_result = result_map_->insert(element, result); if (!cache_result.is_new_entry) { old_result = cache_result.stored_value->value; cache_result.stored_value->value |= result; } - // kMatched must set with kChecked - DCHECK_NE(cache_result.stored_value->value & (kMatched | kChecked), kMatched); - - // kAllDescendantsOrNextSiblingsChecked must set with kChecked + // kCheckPseudoHasResultMatched must set with kCheckPseudoHasResultChecked DCHECK_NE(cache_result.stored_value->value & - (kAllDescendantsOrNextSiblingsChecked | kChecked), - kAllDescendantsOrNextSiblingsChecked); + (kCheckPseudoHasResultMatched | kCheckPseudoHasResultChecked), + kCheckPseudoHasResultMatched); + + // kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked must set with + // kCheckPseudoHasResultChecked + DCHECK_NE(cache_result.stored_value->value & + (kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked | + kCheckPseudoHasResultChecked), + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked); return old_result; } @@ -130,9 +136,11 @@ DCHECK(traversed_element); DCHECK(parent); DCHECK_EQ(traversed_element->parentElement(), parent); - SetResultAndGetOld(traversed_element, - kChecked | kAllDescendantsOrNextSiblingsChecked); - SetResultAndGetOld(parent, kSomeChildrenChecked); + SetResultAndGetOld( + traversed_element, + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked); + SetResultAndGetOld(parent, kCheckPseudoHasResultSomeChildrenChecked); } void CheckPseudoHasCacheScope::Context::SetAllTraversedElementsAsChecked( @@ -190,21 +198,24 @@ } } -uint8_t CheckPseudoHasCacheScope::Context::GetResult(Element* element) const { +CheckPseudoHasResult CheckPseudoHasCacheScope::Context::GetResult( + Element* element) const { DCHECK(cache_allowed_); DCHECK(result_map_); auto iterator = result_map_->find(element); - return iterator == result_map_->end() ? kNotCached : iterator->value; + return iterator == result_map_->end() ? kCheckPseudoHasResultNotCached + : iterator->value; } bool CheckPseudoHasCacheScope::Context:: HasSiblingsWithAllDescendantsOrNextSiblingsChecked(Element* element) const { for (Element* sibling = ElementTraversal::PreviousSibling(*element); sibling; sibling = ElementTraversal::PreviousSibling(*sibling)) { - uint8_t sibling_result = GetResult(sibling); - if (sibling_result == kNotCached) + CheckPseudoHasResult sibling_result = GetResult(sibling); + if (sibling_result == kCheckPseudoHasResultNotCached) continue; - if (sibling_result & kAllDescendantsOrNextSiblingsChecked) + if (sibling_result & + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked) return true; } return false; @@ -215,12 +226,13 @@ Element* element) const { for (Element* parent = element->parentElement(); parent; element = parent, parent = element->parentElement()) { - uint8_t parent_result = GetResult(parent); - if (parent_result == kNotCached) + CheckPseudoHasResult parent_result = GetResult(parent); + if (parent_result == kCheckPseudoHasResultNotCached) continue; - if (parent_result & kAllDescendantsOrNextSiblingsChecked) + if (parent_result & + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked) return true; - if (parent_result & kSomeChildrenChecked) { + if (parent_result & kCheckPseudoHasResultSomeChildrenChecked) { if (HasSiblingsWithAllDescendantsOrNextSiblingsChecked(element)) return true; } @@ -236,7 +248,7 @@ return HasAncestorsWithAllDescendantsOrNextSiblingsChecked(element); case CheckPseudoHasArgumentTraversalScope::kAllNextSiblings: if (Element* parent = element->parentElement()) { - if (!(GetResult(parent) & kSomeChildrenChecked)) + if (!(GetResult(parent) & kCheckPseudoHasResultSomeChildrenChecked)) return false; return HasSiblingsWithAllDescendantsOrNextSiblingsChecked(element); }
diff --git a/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.h b/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.h index 0c79b906..82c4997 100644 --- a/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.h +++ b/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.h
@@ -44,7 +44,7 @@ // // - flag4 (SomeChildrenChecked) : Indicates that some children of the element // were already checked. This flag is set on the parent of the -// kAllDescendantsOrNextSiblingsChecked element. +// kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked element. // If the parent of an not-cached element has this flag set, we can // determine whether the element is 'already checked as not-matched' or // 'not yet checked' by checking the AllDescendantsOrNextSiblingsChecked @@ -118,13 +118,14 @@ // // Please refer the check_pseudo_has_cache_scope_context_test.cc for other // cases. -enum CheckPseudoHasResult : uint8_t { - kNotCached = 0, - kChecked = 1 << 0, - kMatched = 1 << 1, - kAllDescendantsOrNextSiblingsChecked = 1 << 2, - kSomeChildrenChecked = 1 << 3, -}; +using CheckPseudoHasResult = uint8_t; +constexpr CheckPseudoHasResult kCheckPseudoHasResultNotCached = 0; +constexpr CheckPseudoHasResult kCheckPseudoHasResultChecked = 1 << 0; +constexpr CheckPseudoHasResult kCheckPseudoHasResultMatched = 1 << 1; +constexpr CheckPseudoHasResult + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked = 1 << 2; +constexpr CheckPseudoHasResult kCheckPseudoHasResultSomeChildrenChecked = 1 + << 3; // The :has() result cache keeps the :has() pseudo class checking result // regardless of the :has() pseudo class location (whether it is for subject or @@ -151,7 +152,7 @@ // :has(<argument-selector>) checking result on each element. // - hashmap[<element>] = <result> using ElementCheckPseudoHasResultMap = - HeapHashMap<Member<const Element>, uint8_t>; + HeapHashMap<Member<const Element>, CheckPseudoHasResult>; using CheckPseudoHasResultCache = HeapHashMap<String, Member<ElementCheckPseudoHasResultMap>>; @@ -238,14 +239,14 @@ Context() = delete; Context(const Document*, const CheckPseudoHasArgumentContext&); - uint8_t SetMatchedAndGetOldResult(Element* element); + CheckPseudoHasResult SetMatchedAndGetOldResult(Element* element); void SetChecked(Element* element); void SetAllTraversedElementsAsChecked(Element* last_traversed_element, int last_traversed_depth); - uint8_t GetResult(Element*) const; + CheckPseudoHasResult GetResult(Element*) const; bool AlreadyChecked(Element*) const; @@ -257,7 +258,8 @@ private: friend class CheckPseudoHasCacheScopeContextTest; - uint8_t SetResultAndGetOld(Element*, uint8_t result); + CheckPseudoHasResult SetResultAndGetOld(Element*, + CheckPseudoHasResult result); void SetTraversedElementAsChecked(Element* traversed_element, Element* parent);
diff --git a/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope_context_test.cc b/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope_context_test.cc index 78f647a..060ff39f 100644 --- a/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope_context_test.cc +++ b/third_party/blink/renderer/core/css/check_pseudo_has_cache_scope_context_test.cc
@@ -20,34 +20,6 @@ class CheckPseudoHasCacheScopeContextTest : public PageTestBase { protected: - enum CachedCheckPseudoHasResult { - kNotCached = CheckPseudoHasResult::kNotCached, - kNotMatched = CheckPseudoHasResult::kChecked, - kMatched = CheckPseudoHasResult::kChecked | CheckPseudoHasResult::kMatched, - kNotMatchedAndAllDescendantsOrNextSiblingsChecked = - CheckPseudoHasResult::kChecked | - CheckPseudoHasResult::kAllDescendantsOrNextSiblingsChecked, - kMatchedAndAllDescendantsOrNextSiblingsChecked = - CheckPseudoHasResult::kChecked | CheckPseudoHasResult::kMatched | - CheckPseudoHasResult::kAllDescendantsOrNextSiblingsChecked, - kNotCheckedAndSomeChildrenChecked = - CheckPseudoHasResult::kSomeChildrenChecked, - kNotMatchedAndSomeChildrenChecked = - CheckPseudoHasResult::kChecked | - CheckPseudoHasResult::kSomeChildrenChecked, - kMatchedAndSomeChildrenChecked = CheckPseudoHasResult::kChecked | - CheckPseudoHasResult::kMatched | - CheckPseudoHasResult::kSomeChildrenChecked, - kNotMatchedAndAllDescendantsOrNextSiblingsCheckedAndSomeChildrenChecked = - CheckPseudoHasResult::kChecked | - CheckPseudoHasResult::kAllDescendantsOrNextSiblingsChecked | - CheckPseudoHasResult::kSomeChildrenChecked, - kMatchedAndAllDescendantsOrNextSiblingsCheckedAndSomeChildrenChecked = - CheckPseudoHasResult::kChecked | CheckPseudoHasResult::kMatched | - CheckPseudoHasResult::kAllDescendantsOrNextSiblingsChecked | - CheckPseudoHasResult::kSomeChildrenChecked, - }; - enum ExpectedCheckPseudoHasResult { kSameAsCached, kNotYetChecked, @@ -56,42 +28,41 @@ struct ExpectedResultCacheEntry { const char* element_query; - CachedCheckPseudoHasResult cached_result; + CheckPseudoHasResult cached_result; ExpectedCheckPseudoHasResult expected_result; }; - static uint8_t GetResult( + static CheckPseudoHasResult GetResult( CheckPseudoHasCacheScope::Context& cache_scope_context, Element* element) { return cache_scope_context.CacheAllowed() ? cache_scope_context.GetResult(element) - : CheckPseudoHasResult::kNotCached; + : kCheckPseudoHasResultNotCached; } static bool ElementCached( CheckPseudoHasCacheScope::Context& cache_scope_context, Element* element) { return GetResult(cache_scope_context, element) != - CheckPseudoHasResult::kNotCached; + kCheckPseudoHasResultNotCached; } static bool ElementChecked( CheckPseudoHasCacheScope::Context& cache_scope_context, Element* element) { return GetResult(cache_scope_context, element) & - CheckPseudoHasResult::kChecked; + kCheckPseudoHasResultChecked; } - static String TestResultToString(uint8_t test_result) { + static String TestResultToString(CheckPseudoHasResult test_result) { return String::Format( "0b%c%c%c%c", - (test_result & CheckPseudoHasResult::kSomeChildrenChecked ? '1' : '0'), - (test_result & - CheckPseudoHasResult::kAllDescendantsOrNextSiblingsChecked + (test_result & kCheckPseudoHasResultSomeChildrenChecked ? '1' : '0'), + (test_result & kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked ? '1' : '0'), - (test_result & CheckPseudoHasResult::kMatched ? '1' : '0'), - (test_result & CheckPseudoHasResult::kChecked ? '1' : '0')); + (test_result & kCheckPseudoHasResultMatched ? '1' : '0'), + (test_result & kCheckPseudoHasResultChecked ? '1' : '0')); } template <unsigned length> @@ -290,103 +261,134 @@ </main> )HTML"); - TestMatches(document, "div2", ":has(.a)", - /* expected_match_result */ true, - /* expected_result_cache_count */ 7, - {{"main", kMatched, kSameAsCached}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div211", kNotCached, kNotYetChecked}, - {"#div22", kMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div221", kNotCached, kNotYetChecked}, - {"#div222", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div2221", kNotCached, kAlreadyNotMatched}, - {"#div223", kNotCached, kAlreadyNotMatched}, - {"#div2231", kNotCached, kAlreadyNotMatched}, - {"#div2232", kNotCached, kAlreadyNotMatched}, - {"#div22321", kNotCached, kAlreadyNotMatched}, - {"#div22322", kNotCached, kAlreadyNotMatched}, - {"#div223221", kNotCached, kAlreadyNotMatched}, - {"#div22323", kNotCached, kAlreadyNotMatched}, - {"#div23", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div231", kNotCached, kAlreadyNotMatched}, - {"#div24", kNotCached, kAlreadyNotMatched}, - {"#div241", kNotCached, kAlreadyNotMatched}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div4", kNotCached, kNotYetChecked}, - {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div2", ":has(.a)", + /* expected_match_result */ true, + /* expected_result_cache_count */ 7, + {{"main", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div222", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div2221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div223", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2232", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22321", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22322", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div223221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div4", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div41", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div2", ":has(.b)", - /* expected_match_result */ true, - /* expected_result_cache_count */ 9, - {{"main", kMatched, kSameAsCached}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div211", kNotCached, kNotYetChecked}, - {"#div22", kMatched, kSameAsCached}, - {"#div221", kNotCached, kNotYetChecked}, - {"#div222", kNotCached, kNotYetChecked}, - {"#div2221", kNotCached, kNotYetChecked}, - {"#div223", kMatched, kSameAsCached}, - {"#div2231", kNotCached, kNotYetChecked}, - {"#div2232", kMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div22321", kNotCached, kNotYetChecked}, - {"#div22322", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div223221", kNotCached, kAlreadyNotMatched}, - {"#div22323", kNotCached, kAlreadyNotMatched}, - {"#div23", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div231", kNotCached, kAlreadyNotMatched}, - {"#div24", kNotCached, kAlreadyNotMatched}, - {"#div241", kNotCached, kAlreadyNotMatched}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div4", kNotCached, kNotYetChecked}, - {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div2", ":has(.b)", + /* expected_match_result */ true, + /* expected_result_cache_count */ 9, + {{"main", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div222", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div223", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div2231", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2232", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div22321", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22322", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div223221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div4", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div41", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div2", ":has(.c)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 2, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div21", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div211", kNotCached, kAlreadyNotMatched}, - {"#div22", kNotCached, kAlreadyNotMatched}, - {"#div221", kNotCached, kAlreadyNotMatched}, - {"#div222", kNotCached, kAlreadyNotMatched}, - {"#div2221", kNotCached, kAlreadyNotMatched}, - {"#div223", kNotCached, kAlreadyNotMatched}, - {"#div2231", kNotCached, kAlreadyNotMatched}, - {"#div2232", kNotCached, kAlreadyNotMatched}, - {"#div22321", kNotCached, kAlreadyNotMatched}, - {"#div22322", kNotCached, kAlreadyNotMatched}, - {"#div223221", kNotCached, kAlreadyNotMatched}, - {"#div22323", kNotCached, kAlreadyNotMatched}, - {"#div23", kNotCached, kAlreadyNotMatched}, - {"#div231", kNotCached, kAlreadyNotMatched}, - {"#div24", kNotCached, kAlreadyNotMatched}, - {"#div241", kNotCached, kAlreadyNotMatched}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div4", kNotCached, kNotYetChecked}, - {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div2", ":has(.c)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 2, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div21", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div211", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div222", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div223", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2232", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22321", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22322", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div223221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div4", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div41", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, Case1StartsWithChildCombinator) { @@ -456,147 +458,168 @@ </main> )HTML"); - TestMatches(document, "div22", ":has(> .a .b)", - /* expected_match_result */ true, - /* expected_result_cache_count */ 5, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div211", kNotCached, kNotYetChecked}, - {"#div22", kMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div221", kNotCached, kNotYetChecked}, - {"#div2211", kNotCached, kNotYetChecked}, - {"#div222", kNotCached, kNotYetChecked}, - {"#div2221", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div22211", kNotCached, kNotYetChecked}, - {"#div22212", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div222121", kNotCached, kAlreadyNotMatched}, - {"#div22213", kNotCached, kAlreadyNotMatched}, - {"#div223", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div2231", kNotCached, kAlreadyNotMatched}, - {"#div224", kMatched, kSameAsCached}, - {"#div2241", kNotCached, kAlreadyNotMatched}, - {"#div2242", kNotCached, kAlreadyNotMatched}, - {"#div22421", kNotCached, kAlreadyNotMatched}, - {"#div22422", kNotCached, kAlreadyNotMatched}, - {"#div224221", kNotCached, kAlreadyNotMatched}, - {"#div224222", kNotCached, kAlreadyNotMatched}, - {"#div2242221", kNotCached, kAlreadyNotMatched}, - {"#div224223", kNotCached, kAlreadyNotMatched}, - {"#div22423", kNotCached, kAlreadyNotMatched}, - {"#div224231", kNotCached, kAlreadyNotMatched}, - {"#div22424", kNotCached, kAlreadyNotMatched}, - {"#div2243", kNotCached, kAlreadyNotMatched}, - {"#div22431", kNotCached, kAlreadyNotMatched}, - {"#div2244", kNotCached, kAlreadyNotMatched}, - {"#div225", kNotCached, kAlreadyNotMatched}, - {"#div2251", kNotCached, kAlreadyNotMatched}, - {"#div226", kNotCached, kAlreadyNotMatched}, - {"#div23", kNotCached, kNotYetChecked}, - {"#div231", kNotCached, kNotYetChecked}, - {"#div24", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div22", ":has(> .a .b)", + /* expected_match_result */ true, + /* expected_result_cache_count */ 5, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div222", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2221", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div22211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22212", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div222121", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22213", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div223", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div2231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div2241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2242", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22421", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22422", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224222", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2242221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224223", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22423", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22424", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2243", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22431", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2244", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div225", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2251", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div226", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div231", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div24", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div2", ":has(> .a .b)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 4, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div21", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div211", kNotCached, kAlreadyNotMatched}, - {"#div22", kMatched, kSameAsCached}, - {"#div221", kNotCached, kAlreadyNotMatched}, - {"#div2211", kNotCached, kAlreadyNotMatched}, - {"#div222", kNotCached, kAlreadyNotMatched}, - {"#div2221", kNotCached, kAlreadyNotMatched}, - {"#div22211", kNotCached, kAlreadyNotMatched}, - {"#div22212", kNotCached, kAlreadyNotMatched}, - {"#div222121", kNotCached, kAlreadyNotMatched}, - {"#div22213", kNotCached, kAlreadyNotMatched}, - {"#div223", kNotCached, kAlreadyNotMatched}, - {"#div2231", kNotCached, kAlreadyNotMatched}, - {"#div224", kMatched, kSameAsCached}, - {"#div2241", kNotCached, kAlreadyNotMatched}, - {"#div2242", kNotCached, kAlreadyNotMatched}, - {"#div22421", kNotCached, kAlreadyNotMatched}, - {"#div22422", kNotCached, kAlreadyNotMatched}, - {"#div224221", kNotCached, kAlreadyNotMatched}, - {"#div224222", kNotCached, kAlreadyNotMatched}, - {"#div2242221", kNotCached, kAlreadyNotMatched}, - {"#div224223", kNotCached, kAlreadyNotMatched}, - {"#div22423", kNotCached, kAlreadyNotMatched}, - {"#div224231", kNotCached, kAlreadyNotMatched}, - {"#div22424", kNotCached, kAlreadyNotMatched}, - {"#div2243", kNotCached, kAlreadyNotMatched}, - {"#div22431", kNotCached, kAlreadyNotMatched}, - {"#div2244", kNotCached, kAlreadyNotMatched}, - {"#div225", kNotCached, kAlreadyNotMatched}, - {"#div2251", kNotCached, kAlreadyNotMatched}, - {"#div226", kNotCached, kAlreadyNotMatched}, - {"#div23", kNotCached, kAlreadyNotMatched}, - {"#div231", kNotCached, kAlreadyNotMatched}, - {"#div24", kNotCached, kAlreadyNotMatched}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div2", ":has(> .a .b)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 4, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div21", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div211", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2211", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div222", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22211", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22212", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div222121", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22213", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div223", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div2241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2242", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22421", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22422", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224222", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2242221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224223", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22423", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22424", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2243", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22431", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2244", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div225", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2251", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div226", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div2", ":has(> .a .c)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 2, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div21", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div211", kNotCached, kAlreadyNotMatched}, - {"#div22", kNotCached, kAlreadyNotMatched}, - {"#div221", kNotCached, kAlreadyNotMatched}, - {"#div2211", kNotCached, kAlreadyNotMatched}, - {"#div222", kNotCached, kAlreadyNotMatched}, - {"#div2221", kNotCached, kAlreadyNotMatched}, - {"#div22211", kNotCached, kAlreadyNotMatched}, - {"#div22212", kNotCached, kAlreadyNotMatched}, - {"#div222121", kNotCached, kAlreadyNotMatched}, - {"#div22213", kNotCached, kAlreadyNotMatched}, - {"#div223", kNotCached, kAlreadyNotMatched}, - {"#div2231", kNotCached, kAlreadyNotMatched}, - {"#div224", kNotCached, kAlreadyNotMatched}, - {"#div2241", kNotCached, kAlreadyNotMatched}, - {"#div2242", kNotCached, kAlreadyNotMatched}, - {"#div22421", kNotCached, kAlreadyNotMatched}, - {"#div22422", kNotCached, kAlreadyNotMatched}, - {"#div224221", kNotCached, kAlreadyNotMatched}, - {"#div224222", kNotCached, kAlreadyNotMatched}, - {"#div2242221", kNotCached, kAlreadyNotMatched}, - {"#div224223", kNotCached, kAlreadyNotMatched}, - {"#div22423", kNotCached, kAlreadyNotMatched}, - {"#div224231", kNotCached, kAlreadyNotMatched}, - {"#div22424", kNotCached, kAlreadyNotMatched}, - {"#div2243", kNotCached, kAlreadyNotMatched}, - {"#div22431", kNotCached, kAlreadyNotMatched}, - {"#div2244", kNotCached, kAlreadyNotMatched}, - {"#div225", kNotCached, kAlreadyNotMatched}, - {"#div2251", kNotCached, kAlreadyNotMatched}, - {"#div226", kNotCached, kAlreadyNotMatched}, - {"#div23", kNotCached, kAlreadyNotMatched}, - {"#div231", kNotCached, kAlreadyNotMatched}, - {"#div24", kNotCached, kAlreadyNotMatched}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div2", ":has(> .a .c)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 2, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div21", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div211", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2211", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div222", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22211", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22212", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div222121", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22213", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div223", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2242", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22421", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22422", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224222", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2242221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224223", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22423", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div224231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22424", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2243", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22431", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2244", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div225", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2251", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div226", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, Case2StartsWithIndirectAdjacent) { @@ -637,61 +660,70 @@ </main> )HTML"); - TestMatches(document, "div22", ":has(~ .a)", - /* expected_match_result */ true, - /* expected_result_cache_count */ 5, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCheckedAndSomeChildrenChecked}, - {"#div21", kMatched, kSameAsCached}, - {"#div211", kNotCached, kNotYetChecked}, - {"#div212", kNotCached, kNotYetChecked}, - {"#div22", kMatched, kSameAsCached}, - {"#div221", kNotCached, kNotYetChecked}, - {"#div222", kNotCached, kNotYetChecked}, - {"#div23", kMatched, kSameAsCached}, - {"#div231", kNotCached, kNotYetChecked}, - {"#div232", kNotCached, kNotYetChecked}, - {"#div24", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div241", kNotCached, kNotYetChecked}, - {"#div242", kNotCached, kNotYetChecked}, - {"#div25", kNotCached, kAlreadyNotMatched}, - {"#div251", kNotCached, kNotYetChecked}, - {"#div252", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div22", ":has(~ .a)", + /* expected_match_result */ true, + /* expected_result_cache_count */ 5, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultSomeChildrenChecked}, + {"#div21", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div212", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div222", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div231", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div232", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div24", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div241", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div242", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div25", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div251", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div252", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div22", ":has(~ .b)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 3, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div211", kNotCached, kNotYetChecked}, - {"#div212", kNotCached, kNotYetChecked}, - {"#div22", kNotMatched, kSameAsCached}, - {"#div221", kNotCached, kNotYetChecked}, - {"#div222", kNotCached, kNotYetChecked}, - {"#div23", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div231", kNotCached, kNotYetChecked}, - {"#div232", kNotCached, kNotYetChecked}, - {"#div24", kNotCached, kAlreadyNotMatched}, - {"#div241", kNotCached, kNotYetChecked}, - {"#div242", kNotCached, kNotYetChecked}, - {"#div25", kNotCached, kAlreadyNotMatched}, - {"#div251", kNotCached, kNotYetChecked}, - {"#div252", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div22", ":has(~ .b)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 3, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div212", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultChecked, kSameAsCached}, + {"#div221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div222", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div231", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div232", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div24", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div241", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div242", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div25", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div251", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div252", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, Case2StartsWithDirectAdjacent) { @@ -750,132 +782,140 @@ </main> )HTML"); - TestMatches(document, "div23", ":has(+ .a ~ .b)", - /* expected_match_result */ true, - /* expected_result_cache_count */ 3, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div211", kNotCached, kNotYetChecked}, - {"#div212", kNotCached, kNotYetChecked}, - {"#div213", kNotCached, kNotYetChecked}, - {"#div22", kNotCached, kNotYetChecked}, - {"#div221", kNotCached, kNotYetChecked}, - {"#div222", kNotCached, kNotYetChecked}, - {"#div223", kNotCached, kNotYetChecked}, - {"#div23", kMatched, kSameAsCached}, - {"#div231", kNotCached, kNotYetChecked}, - {"#div232", kNotCached, kNotYetChecked}, - {"#div233", kNotCached, kNotYetChecked}, - {"#div24", kNotCached, kNotYetChecked}, - {"#div241", kNotCached, kNotYetChecked}, - {"#div242", kNotCached, kNotYetChecked}, - {"#div243", kNotCached, kNotYetChecked}, - {"#div25", kNotCached, kNotYetChecked}, - {"#div251", kNotCached, kNotYetChecked}, - {"#div252", kNotCached, kNotYetChecked}, - {"#div253", kNotCached, kNotYetChecked}, - {"#div26", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div261", kNotCached, kNotYetChecked}, - {"#div262", kNotCached, kNotYetChecked}, - {"#div263", kNotCached, kNotYetChecked}, - {"#div27", kNotCached, kAlreadyNotMatched}, - {"#div271", kNotCached, kNotYetChecked}, - {"#div272", kNotCached, kNotYetChecked}, - {"#div273", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div4", kNotCached, kNotYetChecked}, - {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div23", ":has(+ .a ~ .b)", + /* expected_match_result */ true, + /* expected_result_cache_count */ 3, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div212", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div213", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div222", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div223", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div231", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div232", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div233", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div24", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div241", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div242", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div243", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div25", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div251", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div252", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div253", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div26", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div261", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div262", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div263", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div27", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div271", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div272", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div273", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div4", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div41", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div22", ":has(+ .a ~ .b)", /* expected_match_result */ false, /* expected_result_cache_count */ 3, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCheckedAndSomeChildrenChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div211", kNotCached, kNotYetChecked}, - {"#div212", kNotCached, kNotYetChecked}, - {"#div213", kNotCached, kNotYetChecked}, - {"#div22", kNotMatched, kSameAsCached}, - {"#div221", kNotCached, kNotYetChecked}, - {"#div222", kNotCached, kNotYetChecked}, - {"#div223", kNotCached, kNotYetChecked}, - {"#div23", kMatchedAndAllDescendantsOrNextSiblingsChecked, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultSomeChildrenChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div212", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div213", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultChecked, kSameAsCached}, + {"#div221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div222", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div223", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}, - {"#div231", kNotCached, kNotYetChecked}, - {"#div232", kNotCached, kNotYetChecked}, - {"#div233", kNotCached, kNotYetChecked}, - {"#div24", kNotCached, kAlreadyNotMatched}, - {"#div241", kNotCached, kNotYetChecked}, - {"#div242", kNotCached, kNotYetChecked}, - {"#div243", kNotCached, kNotYetChecked}, - {"#div25", kNotCached, kAlreadyNotMatched}, - {"#div251", kNotCached, kNotYetChecked}, - {"#div252", kNotCached, kNotYetChecked}, - {"#div253", kNotCached, kNotYetChecked}, - {"#div26", kNotCached, kAlreadyNotMatched}, - {"#div261", kNotCached, kNotYetChecked}, - {"#div262", kNotCached, kNotYetChecked}, - {"#div263", kNotCached, kNotYetChecked}, - {"#div27", kNotCached, kAlreadyNotMatched}, - {"#div271", kNotCached, kNotYetChecked}, - {"#div272", kNotCached, kNotYetChecked}, - {"#div273", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div4", kNotCached, kNotYetChecked}, - {"#div41", kNotCached, kNotYetChecked}}, + {"#div231", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div232", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div233", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div24", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div241", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div242", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div243", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div25", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div251", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div252", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div253", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div26", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div261", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div262", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div263", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div27", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div271", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div272", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div273", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div4", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div41", kCheckPseudoHasResultNotCached, kNotYetChecked}}, /* expected_fast_reject_filter_cache_count */ 1, /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div22", ":has(+ .a ~ .c)", /* expected_match_result */ false, /* expected_result_cache_count */ 3, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCheckedAndSomeChildrenChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div211", kNotCached, kNotYetChecked}, - {"#div212", kNotCached, kNotYetChecked}, - {"#div213", kNotCached, kNotYetChecked}, - {"#div22", kNotMatched, kSameAsCached}, - {"#div221", kNotCached, kNotYetChecked}, - {"#div222", kNotCached, kNotYetChecked}, - {"#div223", kNotCached, kNotYetChecked}, - {"#div23", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultSomeChildrenChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div212", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div213", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultChecked, kSameAsCached}, + {"#div221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div222", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div223", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}, - {"#div231", kNotCached, kNotYetChecked}, - {"#div232", kNotCached, kNotYetChecked}, - {"#div233", kNotCached, kNotYetChecked}, - {"#div24", kNotCached, kAlreadyNotMatched}, - {"#div241", kNotCached, kNotYetChecked}, - {"#div242", kNotCached, kNotYetChecked}, - {"#div243", kNotCached, kNotYetChecked}, - {"#div25", kNotCached, kAlreadyNotMatched}, - {"#div251", kNotCached, kNotYetChecked}, - {"#div252", kNotCached, kNotYetChecked}, - {"#div253", kNotCached, kNotYetChecked}, - {"#div26", kNotCached, kAlreadyNotMatched}, - {"#div261", kNotCached, kNotYetChecked}, - {"#div262", kNotCached, kNotYetChecked}, - {"#div263", kNotCached, kNotYetChecked}, - {"#div27", kNotCached, kAlreadyNotMatched}, - {"#div271", kNotCached, kNotYetChecked}, - {"#div272", kNotCached, kNotYetChecked}, - {"#div273", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div4", kNotCached, kNotYetChecked}, - {"#div41", kNotCached, kNotYetChecked}}, + {"#div231", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div232", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div233", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div24", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div241", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div242", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div243", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div25", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div251", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div252", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div253", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div26", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div261", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div262", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div263", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div27", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div271", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div272", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div273", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div4", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div41", kCheckPseudoHasResultNotCached, kNotYetChecked}}, /* expected_fast_reject_filter_cache_count */ 1, /* expected_bloom_filter_allocation_count */ 0); } @@ -940,143 +980,162 @@ </main> )HTML"); - TestMatches(document, "div22", ":has(+ .a .b)", - /* expected_match_result */ true, - /* expected_result_cache_count */ 10, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div22", kMatched, kSameAsCached}, - {"#div23", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div231", kNotCached, kNotYetChecked}, - {"#div232", kNotCached, kNotYetChecked}, - {"#div2321", kNotCached, kNotYetChecked}, - {"#div2322", kNotCached, kNotYetChecked}, - {"#div23221", kNotCached, kNotYetChecked}, - {"#div2323", kNotCached, kNotYetChecked}, - {"#div233", kNotCached, kNotYetChecked}, - {"#div234", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div2341", kNotCached, kNotYetChecked}, - {"#div2342", kMatched, kSameAsCached}, - {"#div2343", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div23431", kNotCached, kNotYetChecked}, - {"#div23432", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div234321", kNotCached, kNotYetChecked}, - {"#div234322", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div2343221", kNotCached, kAlreadyNotMatched}, - {"#div234323", kNotCached, kAlreadyNotMatched}, - {"#div23433", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div234331", kNotCached, kAlreadyNotMatched}, - {"#div23434", kNotCached, kAlreadyNotMatched}, - {"#div2344", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div23441", kNotCached, kAlreadyNotMatched}, - {"#div2345", kNotCached, kAlreadyNotMatched}, - {"#div235", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div2351", kNotCached, kAlreadyNotMatched}, - {"#div236", kNotCached, kAlreadyNotMatched}, - {"#div24", kNotCached, kNotYetChecked}, - {"#div241", kNotCached, kNotYetChecked}, - {"#div25", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div4", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div22", ":has(+ .a .b)", + /* expected_match_result */ true, + /* expected_result_cache_count */ 10, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div23", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div231", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div232", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2321", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2322", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2323", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div233", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div234", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div2341", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2342", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div2343", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div23431", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23432", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div234321", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div234322", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div2343221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div234323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23433", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div234331", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23434", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2344", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div23441", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2345", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div235", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div2351", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div236", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div241", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div25", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div4", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div1", ":has(+ .a .b)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 5, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotMatched, kSameAsCached}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div21", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div22", kMatched, kSameAsCached}, - {"#div23", kNotCached, kAlreadyNotMatched}, - {"#div231", kNotCached, kAlreadyNotMatched}, - {"#div232", kNotCached, kAlreadyNotMatched}, - {"#div2321", kNotCached, kAlreadyNotMatched}, - {"#div2322", kNotCached, kAlreadyNotMatched}, - {"#div23221", kNotCached, kAlreadyNotMatched}, - {"#div2323", kNotCached, kAlreadyNotMatched}, - {"#div233", kNotCached, kAlreadyNotMatched}, - {"#div234", kNotCached, kAlreadyNotMatched}, - {"#div2341", kNotCached, kAlreadyNotMatched}, - {"#div2342", kMatched, kSameAsCached}, - {"#div2343", kNotCached, kAlreadyNotMatched}, - {"#div23431", kNotCached, kAlreadyNotMatched}, - {"#div23432", kNotCached, kAlreadyNotMatched}, - {"#div234321", kNotCached, kAlreadyNotMatched}, - {"#div234322", kNotCached, kAlreadyNotMatched}, - {"#div2343221", kNotCached, kAlreadyNotMatched}, - {"#div234323", kNotCached, kAlreadyNotMatched}, - {"#div23433", kNotCached, kAlreadyNotMatched}, - {"#div234331", kNotCached, kAlreadyNotMatched}, - {"#div23434", kNotCached, kAlreadyNotMatched}, - {"#div2344", kNotCached, kAlreadyNotMatched}, - {"#div23441", kNotCached, kAlreadyNotMatched}, - {"#div2345", kNotCached, kAlreadyNotMatched}, - {"#div235", kNotCached, kAlreadyNotMatched}, - {"#div2351", kNotCached, kAlreadyNotMatched}, - {"#div236", kNotCached, kAlreadyNotMatched}, - {"#div24", kNotCached, kAlreadyNotMatched}, - {"#div241", kNotCached, kAlreadyNotMatched}, - {"#div25", kNotCached, kAlreadyNotMatched}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div4", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div1", ":has(+ .a .b)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 5, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultChecked, kSameAsCached}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div21", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div22", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div23", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div232", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2321", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2322", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div233", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div234", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2341", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2342", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div2343", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23431", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23432", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div234321", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div234322", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2343221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div234323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23433", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div234331", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23434", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2344", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23441", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2345", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div235", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2351", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div236", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div25", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div4", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div22", ":has(+ .a .c)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 3, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div22", kNotMatched, kSameAsCached}, - {"#div23", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div231", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div232", kNotCached, kAlreadyNotMatched}, - {"#div2321", kNotCached, kAlreadyNotMatched}, - {"#div2322", kNotCached, kAlreadyNotMatched}, - {"#div23221", kNotCached, kAlreadyNotMatched}, - {"#div2323", kNotCached, kAlreadyNotMatched}, - {"#div233", kNotCached, kAlreadyNotMatched}, - {"#div234", kNotCached, kAlreadyNotMatched}, - {"#div2341", kNotCached, kAlreadyNotMatched}, - {"#div2342", kNotCached, kAlreadyNotMatched}, - {"#div2343", kNotCached, kAlreadyNotMatched}, - {"#div23431", kNotCached, kAlreadyNotMatched}, - {"#div23432", kNotCached, kAlreadyNotMatched}, - {"#div234321", kNotCached, kAlreadyNotMatched}, - {"#div234322", kNotCached, kAlreadyNotMatched}, - {"#div2343221", kNotCached, kAlreadyNotMatched}, - {"#div234323", kNotCached, kAlreadyNotMatched}, - {"#div23433", kNotCached, kAlreadyNotMatched}, - {"#div234331", kNotCached, kAlreadyNotMatched}, - {"#div23434", kNotCached, kAlreadyNotMatched}, - {"#div2344", kNotCached, kAlreadyNotMatched}, - {"#div23441", kNotCached, kAlreadyNotMatched}, - {"#div2345", kNotCached, kAlreadyNotMatched}, - {"#div235", kNotCached, kAlreadyNotMatched}, - {"#div2351", kNotCached, kAlreadyNotMatched}, - {"#div236", kNotCached, kAlreadyNotMatched}, - {"#div24", kNotCached, kNotYetChecked}, - {"#div241", kNotCached, kNotYetChecked}, - {"#div25", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div4", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div22", ":has(+ .a .c)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 3, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultChecked, kSameAsCached}, + {"#div23", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div231", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div232", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2321", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2322", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div233", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div234", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2341", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2342", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2343", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23431", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23432", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div234321", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div234322", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2343221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div234323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23433", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div234331", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23434", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2344", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23441", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2345", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div235", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2351", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div236", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div241", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div25", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div4", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, Case4) { @@ -1148,209 +1207,241 @@ </main> )HTML"); - TestMatches(document, "div22", ":has(~ .a .b)", - /* expected_match_result */ true, - /* expected_result_cache_count */ 10, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div21", kMatched, kSameAsCached}, - {"#div22", kMatched, kSameAsCached}, - {"#div23", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div231", kNotCached, kNotYetChecked}, - {"#div232", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div2321", kNotCached, kNotYetChecked}, - {"#div2322", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div23221", kNotCached, kAlreadyNotMatched}, - {"#div2323", kNotCached, kAlreadyNotMatched}, - {"#div233", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div24", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div241", kNotCached, kAlreadyNotMatched}, - {"#div242", kNotCached, kAlreadyNotMatched}, - {"#div2421", kMatched, kSameAsCached}, - {"#div2422", kMatched, kSameAsCached}, - {"#div2423", kNotCached, kAlreadyNotMatched}, - {"#div24231", kNotCached, kAlreadyNotMatched}, - {"#div24232", kNotCached, kAlreadyNotMatched}, - {"#div242321", kNotCached, kAlreadyNotMatched}, - {"#div242322", kNotCached, kAlreadyNotMatched}, - {"#div2423221", kNotCached, kAlreadyNotMatched}, - {"#div242323", kNotCached, kAlreadyNotMatched}, - {"#div24233", kNotCached, kAlreadyNotMatched}, - {"#div242331", kNotCached, kAlreadyNotMatched}, - {"#div24234", kNotCached, kAlreadyNotMatched}, - {"#div2424", kNotCached, kAlreadyNotMatched}, - {"#div24241", kNotCached, kAlreadyNotMatched}, - {"#div2425", kNotCached, kAlreadyNotMatched}, - {"#div243", kNotCached, kAlreadyNotMatched}, - {"#div2431", kNotCached, kAlreadyNotMatched}, - {"#div244", kNotCached, kAlreadyNotMatched}, - {"#div25", kNotCached, kAlreadyNotMatched}, - {"#div251", kNotCached, kAlreadyNotMatched}, - {"#div26", kNotCached, kAlreadyNotMatched}, - {"#div261", kNotCached, kAlreadyNotMatched}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div4", kNotCached, kNotYetChecked}, - {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div22", ":has(~ .a .b)", + /* expected_match_result */ true, + /* expected_result_cache_count */ 10, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div22", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div23", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div231", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div232", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div2321", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2322", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div23221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div233", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div24", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2421", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div2422", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div2423", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24232", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242321", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242322", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2423221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24233", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242331", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24234", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2424", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2425", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div243", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2431", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div244", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div25", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div251", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div26", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div261", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div4", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div41", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div21", ":has(~ .a .b)", - /* expected_match_result */ true, - /* expected_result_cache_count */ 10, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div21", kMatched, kSameAsCached}, - {"#div22", kMatched, kSameAsCached}, - {"#div23", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div231", kNotCached, kNotYetChecked}, - {"#div232", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div2321", kNotCached, kNotYetChecked}, - {"#div2322", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div23221", kNotCached, kAlreadyNotMatched}, - {"#div2323", kNotCached, kAlreadyNotMatched}, - {"#div233", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div24", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div241", kNotCached, kAlreadyNotMatched}, - {"#div242", kNotCached, kAlreadyNotMatched}, - {"#div2421", kMatched, kSameAsCached}, - {"#div2422", kMatched, kSameAsCached}, - {"#div2423", kNotCached, kAlreadyNotMatched}, - {"#div24231", kNotCached, kAlreadyNotMatched}, - {"#div24232", kNotCached, kAlreadyNotMatched}, - {"#div242321", kNotCached, kAlreadyNotMatched}, - {"#div242322", kNotCached, kAlreadyNotMatched}, - {"#div2423221", kNotCached, kAlreadyNotMatched}, - {"#div242323", kNotCached, kAlreadyNotMatched}, - {"#div24233", kNotCached, kAlreadyNotMatched}, - {"#div242331", kNotCached, kAlreadyNotMatched}, - {"#div24234", kNotCached, kAlreadyNotMatched}, - {"#div2424", kNotCached, kAlreadyNotMatched}, - {"#div24241", kNotCached, kAlreadyNotMatched}, - {"#div2425", kNotCached, kAlreadyNotMatched}, - {"#div243", kNotCached, kAlreadyNotMatched}, - {"#div2431", kNotCached, kAlreadyNotMatched}, - {"#div244", kNotCached, kAlreadyNotMatched}, - {"#div25", kNotCached, kAlreadyNotMatched}, - {"#div251", kNotCached, kAlreadyNotMatched}, - {"#div26", kNotCached, kAlreadyNotMatched}, - {"#div261", kNotCached, kAlreadyNotMatched}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div4", kNotCached, kNotYetChecked}, - {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div21", ":has(~ .a .b)", + /* expected_match_result */ true, + /* expected_result_cache_count */ 10, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div22", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div23", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div231", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div232", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div2321", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2322", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div23221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div233", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div24", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2421", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div2422", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div2423", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24232", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242321", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242322", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2423221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24233", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242331", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24234", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2424", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2425", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div243", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2431", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div244", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div25", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div251", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div26", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div261", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div4", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div41", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div1", ":has(~ .a .b)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 7, - {{"main", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div1", kNotMatched, kSameAsCached}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div21", kMatched, kSameAsCached}, - {"#div22", kMatched, kSameAsCached}, - {"#div23", kNotCached, kAlreadyNotMatched}, - {"#div231", kNotCached, kAlreadyNotMatched}, - {"#div232", kNotCached, kAlreadyNotMatched}, - {"#div2321", kNotCached, kAlreadyNotMatched}, - {"#div2322", kNotCached, kAlreadyNotMatched}, - {"#div23221", kNotCached, kAlreadyNotMatched}, - {"#div2323", kNotCached, kAlreadyNotMatched}, - {"#div233", kNotCached, kAlreadyNotMatched}, - {"#div24", kNotCached, kAlreadyNotMatched}, - {"#div241", kNotCached, kAlreadyNotMatched}, - {"#div242", kNotCached, kAlreadyNotMatched}, - {"#div2421", kMatched, kSameAsCached}, - {"#div2422", kMatched, kSameAsCached}, - {"#div2423", kNotCached, kAlreadyNotMatched}, - {"#div24231", kNotCached, kAlreadyNotMatched}, - {"#div24232", kNotCached, kAlreadyNotMatched}, - {"#div242321", kNotCached, kAlreadyNotMatched}, - {"#div242322", kNotCached, kAlreadyNotMatched}, - {"#div2423221", kNotCached, kAlreadyNotMatched}, - {"#div242323", kNotCached, kAlreadyNotMatched}, - {"#div24233", kNotCached, kAlreadyNotMatched}, - {"#div242331", kNotCached, kAlreadyNotMatched}, - {"#div24234", kNotCached, kAlreadyNotMatched}, - {"#div2424", kNotCached, kAlreadyNotMatched}, - {"#div24241", kNotCached, kAlreadyNotMatched}, - {"#div2425", kNotCached, kAlreadyNotMatched}, - {"#div243", kNotCached, kAlreadyNotMatched}, - {"#div2431", kNotCached, kAlreadyNotMatched}, - {"#div244", kNotCached, kAlreadyNotMatched}, - {"#div25", kNotCached, kAlreadyNotMatched}, - {"#div251", kNotCached, kAlreadyNotMatched}, - {"#div26", kNotCached, kAlreadyNotMatched}, - {"#div261", kNotCached, kAlreadyNotMatched}, - {"#div3", kNotCached, kAlreadyNotMatched}, - {"#div31", kNotCached, kAlreadyNotMatched}, - {"#div4", kNotCached, kAlreadyNotMatched}, - {"#div41", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div1", ":has(~ .a .b)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 7, + {{"main", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultChecked, kSameAsCached}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div21", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div22", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div23", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div232", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2321", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2322", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div233", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2421", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div2422", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div2423", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24232", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242321", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242322", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2423221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24233", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242331", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24234", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2424", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2425", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div243", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2431", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div244", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div25", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div251", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div26", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div261", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div3", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div31", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div4", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div41", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div22", ":has(~ .a .c)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 3, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div22", kNotMatched, kSameAsCached}, - {"#div23", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div231", kNotCached, kAlreadyNotMatched}, - {"#div232", kNotCached, kAlreadyNotMatched}, - {"#div2321", kNotCached, kAlreadyNotMatched}, - {"#div2322", kNotCached, kAlreadyNotMatched}, - {"#div23221", kNotCached, kAlreadyNotMatched}, - {"#div2323", kNotCached, kAlreadyNotMatched}, - {"#div233", kNotCached, kAlreadyNotMatched}, - {"#div24", kNotCached, kAlreadyNotMatched}, - {"#div241", kNotCached, kAlreadyNotMatched}, - {"#div242", kNotCached, kAlreadyNotMatched}, - {"#div2421", kNotCached, kAlreadyNotMatched}, - {"#div2422", kNotCached, kAlreadyNotMatched}, - {"#div2423", kNotCached, kAlreadyNotMatched}, - {"#div24231", kNotCached, kAlreadyNotMatched}, - {"#div24232", kNotCached, kAlreadyNotMatched}, - {"#div242321", kNotCached, kAlreadyNotMatched}, - {"#div242322", kNotCached, kAlreadyNotMatched}, - {"#div2423221", kNotCached, kAlreadyNotMatched}, - {"#div242323", kNotCached, kAlreadyNotMatched}, - {"#div24233", kNotCached, kAlreadyNotMatched}, - {"#div242331", kNotCached, kAlreadyNotMatched}, - {"#div24234", kNotCached, kAlreadyNotMatched}, - {"#div2424", kNotCached, kAlreadyNotMatched}, - {"#div24241", kNotCached, kAlreadyNotMatched}, - {"#div2425", kNotCached, kAlreadyNotMatched}, - {"#div243", kNotCached, kAlreadyNotMatched}, - {"#div2431", kNotCached, kAlreadyNotMatched}, - {"#div244", kNotCached, kAlreadyNotMatched}, - {"#div25", kNotCached, kAlreadyNotMatched}, - {"#div251", kNotCached, kAlreadyNotMatched}, - {"#div26", kNotCached, kAlreadyNotMatched}, - {"#div261", kNotCached, kAlreadyNotMatched}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div4", kNotCached, kNotYetChecked}, - {"#div41", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div22", ":has(~ .a .c)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 3, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultChecked, kSameAsCached}, + {"#div23", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div232", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2321", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2322", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div23221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div233", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2421", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2422", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2423", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24231", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24232", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242321", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242322", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2423221", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242323", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24233", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div242331", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24234", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2424", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div24241", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2425", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div243", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2431", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div244", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div25", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div251", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div26", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div261", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div4", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div41", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, @@ -1378,113 +1469,171 @@ </main> )HTML"); - TestMatches(document, "div1", ":has(.a .b)", - /* expected_match_result */ true, - /* expected_result_cache_count */ 7, - {{"html", kMatched, kSameAsCached}, - {"body", kMatched, kSameAsCached}, - {"#main", kMatched, kSameAsCached}, - {"#div1", kMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div121", kNotCached, kNotYetChecked}, - {"#div1211", kNotCached, kNotYetChecked}, - {"#div12111", kNotCached, kNotYetChecked}, - {"#div13", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div131", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div14", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div1", ":has(.a .b)", + /* expected_match_result */ true, + /* expected_result_cache_count */ 7, + {{"html", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"body", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#main", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div121", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12111", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div131", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div14", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div11", ":has(.a .b)", /* expected_match_result */ false, /* expected_result_cache_count */ 1, - {{"#div11", kNotMatched, kSameAsCached}}, + {{"#div11", kCheckPseudoHasResultChecked, kSameAsCached}}, /* expected_fast_reject_filter_cache_count */ 1, /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div12", ":has(.a .b)", - /* expected_match_result */ true, - /* expected_result_cache_count */ 8, - {{"html", kMatched, kSameAsCached}, - {"body", kMatched, kSameAsCached}, - {"#main", kMatched, kSameAsCached}, - {"#div1", kMatched, kSameAsCached}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kMatched, kSameAsCached}, - {"#div121", kMatched, kSameAsCached}, - {"#div1211", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div12111", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div13", kNotCached, kNotYetChecked}, - {"#div131", kNotCached, kNotYetChecked}, - {"#div14", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div12", ":has(.a .b)", + /* expected_match_result */ true, + /* expected_result_cache_count */ 8, + {{"html", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"body", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#main", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div121", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1211", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div12111", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div13", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div131", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div14", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); // ':has(.a .b)' does not match #div1211 but this caches possibly matched // elements because argument selector checking can cross over the :has() // anchor element. - TestMatches(document, "div1211", ":has(.a .b)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 8, - {{"html", kMatched, kSameAsCached}, - {"body", kMatched, kSameAsCached}, - {"#main", kMatched, kSameAsCached}, - {"#div1", kMatched, kSameAsCached}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kMatched, kSameAsCached}, - {"#div121", kMatched, kSameAsCached}, - {"#div1211", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div12111", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div13", kNotCached, kNotYetChecked}, - {"#div131", kNotCached, kNotYetChecked}, - {"#div14", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div1211", ":has(.a .b)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 8, + {{"html", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"body", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#main", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div121", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1211", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div12111", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div13", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div131", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div14", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); // ':has(.a .b)' does not match #div13 but this caches possibly matched // elements because argument selector checking can cross over the :has() // anchor element. - TestMatches(document, "div13", ":has(.a .b)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 6, - {{"html", kMatched, kSameAsCached}, - {"body", kMatched, kSameAsCached}, - {"#main", kMatched, kSameAsCached}, - {"#div1", kMatched, kSameAsCached}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div121", kNotCached, kNotYetChecked}, - {"#div1211", kNotCached, kNotYetChecked}, - {"#div12111", kNotCached, kNotYetChecked}, - {"#div13", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div131", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div14", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div13", ":has(.a .b)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 6, + {{"html", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"body", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#main", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div121", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12111", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div131", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div14", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(.a .b)", {"div1", "div12", "div121"}, /* expected_result_cache_count */ 12, - {{"html", kMatched, kSameAsCached}, - {"body", kMatched, kSameAsCached}, - {"#main", kMatched, kSameAsCached}, - {"#div1", kMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div11", kNotMatched, kSameAsCached}, - {"#div12", kMatched, kSameAsCached}, - {"#div121", kMatched, kSameAsCached}, - {"#div1211", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div12111", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {{"html", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, kSameAsCached}, - {"#div13", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div131", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"body", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, kSameAsCached}, - {"#div14", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#main", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div11", kCheckPseudoHasResultChecked, kSameAsCached}, + {"#div12", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div121", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1211", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div12111", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div13", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div131", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div14", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, /* expected_fast_reject_filter_cache_count */ 5, /* expected_bloom_filter_allocation_count */ 0); @@ -1492,20 +1641,38 @@ TestQuerySelectorAll( document, "main", ":has(.a .b), :has(.c .d)", {"div1", "div12", "div121"}, /* expected_result_cache_count */ 12, - {{"html", kMatched, kSameAsCached}, - {"body", kMatched, kSameAsCached}, - {"#main", kMatched, kSameAsCached}, - {"#div1", kMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div11", kNotMatched, kSameAsCached}, - {"#div12", kMatched, kSameAsCached}, - {"#div121", kMatched, kSameAsCached}, - {"#div1211", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div12111", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {{"html", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, kSameAsCached}, - {"#div13", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div131", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"body", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, kSameAsCached}, - {"#div14", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#main", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div11", kCheckPseudoHasResultChecked, kSameAsCached}, + {"#div12", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div121", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1211", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div12111", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div13", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div131", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div14", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, /* expected_fast_reject_filter_cache_count */ 6, /* expected_bloom_filter_allocation_count */ 3); @@ -1531,39 +1698,59 @@ </main> )HTML"); - TestMatches(document, "div1", ":has(> .a .b)", - /* expected_match_result */ true, - /* expected_result_cache_count */ 4, - {{"#div1", kMatched, kSameAsCached}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div111", kMatched, kSameAsCached}, - {"#div1111", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div11111", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div1", ":has(> .a .b)", + /* expected_match_result */ true, + /* expected_result_cache_count */ 4, + {{"#div1", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div111", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1111", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div11111", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div11", ":has(> .a .b)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 3, - {{"#div1", kMatched, kSameAsCached}, - {"#div11", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div111", kMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div1111", kNotCached, kAlreadyNotMatched}, - {"#div11111", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div11", ":has(> .a .b)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 3, + {{"#div1", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div11", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div111", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div1111", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div11111", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(> .a .b)", {"div1", "div111"}, /* expected_result_cache_count */ 5, - {{"#div1", kMatched, kSameAsCached}, - {"#div11", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div111", kMatchedAndAllDescendantsOrNextSiblingsChecked, + {{"#div1", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, kSameAsCached}, - {"#div1111", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div11111", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div11", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div111", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div1111", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div11111", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, /* expected_fast_reject_filter_cache_count */ 2, /* expected_bloom_filter_allocation_count */ 0); @@ -1571,12 +1758,21 @@ TestQuerySelectorAll( document, "main", ":has(> .a .b), :has(> .c .d)", {"div1", "div111"}, /* expected_result_cache_count */ 5, - {{"#div1", kMatched, kSameAsCached}, - {"#div11", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div111", kMatchedAndAllDescendantsOrNextSiblingsChecked, + {{"#div1", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, kSameAsCached}, - {"#div1111", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div11111", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div11", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div111", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div1111", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div11111", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, /* expected_fast_reject_filter_cache_count */ 2, /* expected_bloom_filter_allocation_count */ 1); @@ -1615,88 +1811,136 @@ </main> )HTML"); - TestMatches(document, "div112", ":has(> .a .b)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 2, - {{"#div112", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div1121", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div112", ":has(> .a .b)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 2, + {{"#div112", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div1121", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div111", ":has(> .a .b)", - /* expected_match_result */ true, - /* expected_result_cache_count */ 4, - {{"#div111", kMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div1111", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div11111", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div1112", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div111", ":has(> .a .b)", + /* expected_match_result */ true, + /* expected_result_cache_count */ 4, + {{"#div111", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div1111", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div11111", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div1112", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div11", ":has(> .a .b)", - /* expected_match_result */ true, - /* expected_result_cache_count */ 6, - {{"#div11", kMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div111", kMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div1111", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div11111", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div1112", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div112", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div1121", kNotCached, kAlreadyNotMatched}, - {"#div113", kNotCached, kAlreadyNotMatched}, - {"#div1131", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div11", ":has(> .a .b)", + /* expected_match_result */ true, + /* expected_result_cache_count */ 6, + {{"#div11", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div111", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div1111", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div11111", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div1112", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div112", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div1121", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div113", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div1131", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div1", ":has(> .a .b)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 3, - {{"#div1", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div11", kMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div111", kMatched, kSameAsCached}, - {"#div1111", kNotCached, kAlreadyNotMatched}, - {"#div11111", kNotCached, kAlreadyNotMatched}, - {"#div1112", kNotCached, kAlreadyNotMatched}, - {"#div112", kNotCached, kAlreadyNotMatched}, - {"#div1121", kNotCached, kAlreadyNotMatched}, - {"#div113", kNotCached, kAlreadyNotMatched}, - {"#div1131", kNotCached, kAlreadyNotMatched}, - {"#div12", kNotCached, kAlreadyNotMatched}, - {"#div121", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div1", ":has(> .a .b)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 3, + {{"#div1", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div11", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div111", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1111", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div11111", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div1112", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div112", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div1121", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div113", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div1131", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div12", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div121", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(> .a .b) ~ .c .d", {"div1131", "div121"}, /* expected_result_cache_count */ 8, - {{"#div1", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, + {{"#div1", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, {"#div11", - kMatchedAndAllDescendantsOrNextSiblingsCheckedAndSomeChildrenChecked, + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked | + kCheckPseudoHasResultSomeChildrenChecked, kSameAsCached}, - {"#div111", kMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div1111", kNotCheckedAndSomeChildrenChecked, kAlreadyNotMatched}, - {"#div11111", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div111", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultSomeChildrenChecked, kSameAsCached}, - {"#div1112", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div1111", kCheckPseudoHasResultSomeChildrenChecked, + kAlreadyNotMatched}, + {"#div11111", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div1112", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}, {"#div112", - kNotMatchedAndAllDescendantsOrNextSiblingsCheckedAndSomeChildrenChecked, + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked | + kCheckPseudoHasResultSomeChildrenChecked, kSameAsCached}, - {"#div1121", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div1121", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}, - {"#div113", kNotCached, kAlreadyNotMatched}, - {"#div1131", kNotCached, kAlreadyNotMatched}, - {"#div12", kNotCached, kAlreadyNotMatched}, - {"#div121", kNotCached, kAlreadyNotMatched}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}}, + {"#div113", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div1131", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div12", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div121", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}}, /* expected_fast_reject_filter_cache_count */ 4, /* expected_bloom_filter_allocation_count */ 0); } @@ -1728,64 +1972,94 @@ </main> )HTML"); - TestMatches(document, "div1111", ":has(~ .a) .b", - /* expected_match_result */ true, - /* expected_result_cache_count */ 3, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div111", kMatched, kSameAsCached}, - {"#div1111", kNotCached, kNotYetChecked}, - {"#div112", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div121", kNotCached, kNotYetChecked}, - {"#div1211", kNotCached, kNotYetChecked}, - {"#div122", kNotCached, kNotYetChecked}, - {"#div13", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div1111", ":has(~ .a) .b", + /* expected_match_result */ true, + /* expected_result_cache_count */ 3, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div111", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div1111", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div112", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div121", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div122", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div1211", ":has(~ .a) .b", - /* expected_match_result */ true, - /* expected_result_cache_count */ 7, - {{"main", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div1", kMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div111", kNotCached, kNotYetChecked}, - {"#div1111", kNotCached, kNotYetChecked}, - {"#div112", kNotCached, kNotYetChecked}, - {"#div12", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div121", kNotMatched, kSameAsCached}, - {"#div1211", kNotCached, kNotYetChecked}, - {"#div122", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div13", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div2", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 3, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div1211", ":has(~ .a) .b", + /* expected_match_result */ true, + /* expected_result_cache_count */ 7, + {{"main", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div1", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div111", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1111", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div112", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div121", kCheckPseudoHasResultChecked, kSameAsCached}, + {"#div1211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div122", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div13", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div2", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}}, + /* expected_fast_reject_filter_cache_count */ 3, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(~ .a) .b", {"div1111", "div1211"}, /* expected_result_cache_count */ 10, - {{"main", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div1", kMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div11", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div111", kMatched, kSameAsCached}, - {"#div1111", kNotCached, kNotYetChecked}, - {"#div112", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {{"main", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div1", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched | + kCheckPseudoHasResultSomeChildrenChecked, kSameAsCached}, - {"#div12", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div121", kNotMatched, kSameAsCached}, - {"#div1211", kNotCached, kNotYetChecked}, - {"#div122", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div11", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div111", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, kSameAsCached}, - {"#div13", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div1111", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div112", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}, - {"#div2", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div12", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div121", kCheckPseudoHasResultChecked, kSameAsCached}, + {"#div1211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div122", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div13", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div2", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, /* expected_fast_reject_filter_cache_count */ 4, /* expected_bloom_filter_allocation_count */ 0); @@ -1816,54 +2090,68 @@ </main> )HTML"); - TestMatches(document, "div11", ":has(+ .a .b) .c", - /* expected_match_result */ true, - /* expected_result_cache_count */ 3, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kMatched, kSameAsCached}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div211", kNotCached, kNotYetChecked}, - {"#div22", kNotCached, kNotYetChecked}, - {"#div221", kNotCached, kNotYetChecked}, - {"#div23", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div231", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div11", ":has(+ .a .b) .c", + /* expected_match_result */ true, + /* expected_result_cache_count */ 3, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div231", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div211", ":has(+ .a .b) .c", - /* expected_match_result */ true, - /* expected_result_cache_count */ 3, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kMatched, kSameAsCached}, - {"#div211", kNotCached, kNotYetChecked}, - {"#div22", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div221", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div23", kNotCached, kNotYetChecked}, - {"#div231", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div211", ":has(+ .a .b) .c", + /* expected_match_result */ true, + /* expected_result_cache_count */ 3, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div221", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div23", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div231", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(+ .a .b) .c", {"div11", "div211"}, /* expected_result_cache_count */ 6, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kMatched, kSameAsCached}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kMatched, kSameAsCached}, - {"#div211", kNotCached, kNotYetChecked}, - {"#div22", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div221", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, kSameAsCached}, - {"#div23", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div231", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div221", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div23", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div231", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, /* expected_fast_reject_filter_cache_count */ 2, /* expected_bloom_filter_allocation_count */ 0); @@ -1896,57 +2184,71 @@ </main> )HTML"); - TestMatches(document, "div11", ":has(~ .a .b) .c", - /* expected_match_result */ true, - /* expected_result_cache_count */ 3, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kMatched, kSameAsCached}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div211", kNotCached, kNotYetChecked}, - {"#div2111", kNotCached, kNotYetChecked}, - {"#div212", kNotCached, kNotYetChecked}, - {"#div2121", kNotCached, kNotYetChecked}, - {"#div22", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div221", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div11", ":has(~ .a .b) .c", + /* expected_match_result */ true, + /* expected_result_cache_count */ 3, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div211", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2111", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div212", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2121", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div221", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div2111", ":has(~ .a .b) .c", - /* expected_match_result */ true, - /* expected_result_cache_count */ 3, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div211", kMatched, kSameAsCached}, - {"#div2111", kNotCached, kNotYetChecked}, - {"#div212", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div2121", kNotCached, kAlreadyNotMatched}, - {"#div22", kNotCached, kNotYetChecked}, - {"#div221", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div2111", ":has(~ .a .b) .c", + /* expected_match_result */ true, + /* expected_result_cache_count */ 3, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div211", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div2111", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div212", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div2121", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div221", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(~ .a .b) .c", {"div11", "div2111"}, /* expected_result_cache_count */ 6, - {{"main", kNotCached, kNotYetChecked}, - {"#div1", kMatched, kSameAsCached}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div211", kMatched, kSameAsCached}, - {"#div2111", kNotCached, kNotYetChecked}, - {"#div212", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {{"main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, kSameAsCached}, - {"#div2121", kNotCached, kAlreadyNotMatched}, - {"#div22", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div221", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div211", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div2111", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div212", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div2121", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div22", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div221", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}}, /* expected_fast_reject_filter_cache_count */ 2, /* expected_bloom_filter_allocation_count */ 0); @@ -1990,125 +2292,163 @@ </main> )HTML"); - TestMatches(document, "div1", ":has(+ .a ~ .b .c)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 4, - {{"main", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div1", kNotMatched, kSameAsCached}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div13", kNotCached, kNotYetChecked}, - {"#div131", kNotCached, kNotYetChecked}, - {"#div132", kNotCached, kNotYetChecked}, - {"#div14", kNotCached, kNotYetChecked}, - {"#div141", kNotCached, kNotYetChecked}, - {"#div15", kNotCached, kNotYetChecked}, - {"#div2", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div21", kNotCached, kAlreadyNotMatched}, - {"#div3", kNotCached, kAlreadyNotMatched}, - {"#div31", kNotCached, kAlreadyNotMatched}, - {"#div4", kMatched, kSameAsCached}, - {"#div41", kNotCached, kAlreadyNotMatched}, - {"#div5", kNotCached, kAlreadyNotMatched}, - {"#div51", kNotCached, kAlreadyNotMatched}, - {"#div6", kNotCached, kAlreadyNotMatched}, - {"#div61", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div1", ":has(+ .a ~ .b .c)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 4, + {{"main", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultChecked, kSameAsCached}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div131", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div132", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div14", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div141", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div15", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div21", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div3", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div31", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div4", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div41", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div5", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div51", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div6", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div61", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div11", ":has(+ .a ~ .b .c)", - /* expected_match_result */ true, - /* expected_result_cache_count */ 5, - {{"#div1", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div11", kMatched, kSameAsCached}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div13", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div131", kNotCached, kNotYetChecked}, - {"#div132", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div14", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div141", kNotCached, kAlreadyNotMatched}, - {"#div15", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div11", ":has(+ .a ~ .b .c)", + /* expected_match_result */ true, + /* expected_result_cache_count */ 5, + {{"#div1", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div131", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div132", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div14", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div141", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div15", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); - TestMatches(document, "div12", ":has(+ .a ~ .b .c)", - /* expected_match_result */ false, - /* expected_result_cache_count */ 4, - {{"#div1", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div11", kMatched, kSameAsCached}, - {"#div12", kNotMatched, kSameAsCached}, - {"#div13", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, - kSameAsCached}, - {"#div131", kNotCached, kAlreadyNotMatched}, - {"#div132", kNotCached, kAlreadyNotMatched}, - {"#div14", kNotCached, kAlreadyNotMatched}, - {"#div141", kNotCached, kAlreadyNotMatched}, - {"#div15", kNotCached, kAlreadyNotMatched}}, - /* expected_fast_reject_filter_cache_count */ 1, - /* expected_bloom_filter_allocation_count */ 0); + TestMatches( + document, "div12", ":has(+ .a ~ .b .c)", + /* expected_match_result */ false, + /* expected_result_cache_count */ 4, + {{"#div1", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div12", kCheckPseudoHasResultChecked, kSameAsCached}, + {"#div13", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, + kSameAsCached}, + {"#div131", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div132", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div14", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div141", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div15", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}}, + /* expected_fast_reject_filter_cache_count */ 1, + /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(+ .a ~ .b .c)", {"div11", "div4"}, /* expected_result_cache_count */ 9, - {{"main", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div1", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div11", kMatched, kSameAsCached}, - {"#div12", kNotMatched, kSameAsCached}, + {{"main", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div1", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div11", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div12", kCheckPseudoHasResultChecked, kSameAsCached}, {"#div13", - kNotMatchedAndAllDescendantsOrNextSiblingsCheckedAndSomeChildrenChecked, + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked | + kCheckPseudoHasResultSomeChildrenChecked, kSameAsCached}, - {"#div131", kNotCached, kAlreadyNotMatched}, - {"#div132", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div131", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div132", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}, - {"#div14", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div14", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}, - {"#div141", kNotCached, kAlreadyNotMatched}, - {"#div15", kNotCached, kAlreadyNotMatched}, - {"#div2", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div141", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div15", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}, - {"#div21", kNotCached, kAlreadyNotMatched}, - {"#div3", kNotCached, kAlreadyNotMatched}, - {"#div31", kNotCached, kAlreadyNotMatched}, - {"#div4", kMatched, kSameAsCached}, - {"#div41", kNotCached, kAlreadyNotMatched}, - {"#div5", kNotCached, kAlreadyNotMatched}, - {"#div51", kNotCached, kAlreadyNotMatched}, - {"#div6", kNotCached, kAlreadyNotMatched}, - {"#div61", kNotCached, kAlreadyNotMatched}}, + {"#div21", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div3", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div31", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div4", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div41", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div5", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div51", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div6", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div61", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}}, /* expected_fast_reject_filter_cache_count */ 3, /* expected_bloom_filter_allocation_count */ 0); TestQuerySelectorAll( document, "main", ":has(+ .a ~ .b .c), :has(+ .d ~ .e .f)", {"div11", "div4"}, /* expected_result_cache_count */ 9, - {{"main", kNotCheckedAndSomeChildrenChecked, kNotYetChecked}, - {"#div1", kNotMatchedAndSomeChildrenChecked, kSameAsCached}, - {"#div11", kMatched, kSameAsCached}, - {"#div12", kNotMatched, kSameAsCached}, + {{"main", kCheckPseudoHasResultSomeChildrenChecked, kNotYetChecked}, + {"#div1", + kCheckPseudoHasResultChecked | kCheckPseudoHasResultSomeChildrenChecked, + kSameAsCached}, + {"#div11", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div12", kCheckPseudoHasResultChecked, kSameAsCached}, {"#div13", - kNotMatchedAndAllDescendantsOrNextSiblingsCheckedAndSomeChildrenChecked, + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked | + kCheckPseudoHasResultSomeChildrenChecked, kSameAsCached}, - {"#div131", kNotCached, kAlreadyNotMatched}, - {"#div132", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div131", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div132", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}, - {"#div14", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div14", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}, - {"#div141", kNotCached, kAlreadyNotMatched}, - {"#div15", kNotCached, kAlreadyNotMatched}, - {"#div2", kNotMatchedAndAllDescendantsOrNextSiblingsChecked, + {"#div141", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div15", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div2", + kCheckPseudoHasResultChecked | + kCheckPseudoHasResultAllDescendantsOrNextSiblingsChecked, kSameAsCached}, - {"#div21", kNotCached, kAlreadyNotMatched}, - {"#div3", kNotCached, kAlreadyNotMatched}, - {"#div31", kNotCached, kAlreadyNotMatched}, - {"#div4", kMatched, kSameAsCached}, - {"#div41", kNotCached, kAlreadyNotMatched}, - {"#div5", kNotCached, kAlreadyNotMatched}, - {"#div51", kNotCached, kAlreadyNotMatched}, - {"#div6", kNotCached, kAlreadyNotMatched}, - {"#div61", kNotCached, kAlreadyNotMatched}}, + {"#div21", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div3", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div31", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div4", kCheckPseudoHasResultChecked | kCheckPseudoHasResultMatched, + kSameAsCached}, + {"#div41", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div5", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div51", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div6", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}, + {"#div61", kCheckPseudoHasResultNotCached, kAlreadyNotMatched}}, /* expected_fast_reject_filter_cache_count */ 3, /* expected_bloom_filter_allocation_count */ 2); } @@ -2141,58 +2481,59 @@ TestMatches(document, "div2", ":has(+ .a)", /* expected_match_result */ true, /* expected_result_cache_count */ 0, - {{"#main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div13", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div22", kNotCached, kNotYetChecked}, - {"#div23", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div32", kNotCached, kNotYetChecked}, - {"#div33", kNotCached, kNotYetChecked}}, + {{"#main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div32", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div33", kCheckPseudoHasResultNotCached, kNotYetChecked}}, /* expected_fast_reject_filter_cache_count */ 0, /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div21", ":has(+ .a)", /* expected_match_result */ true, /* expected_result_cache_count */ 0, - {{"#main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div13", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div22", kNotCached, kNotYetChecked}, - {"#div23", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div32", kNotCached, kNotYetChecked}, - {"#div33", kNotCached, kNotYetChecked}}, + {{"#main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div32", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div33", kCheckPseudoHasResultNotCached, kNotYetChecked}}, /* expected_fast_reject_filter_cache_count */ 0, /* expected_bloom_filter_allocation_count */ 0); - TestQuerySelectorAll(document, "main", ":has(+ .a)", {"div2", "div21"}, - /* expected_result_cache_count */ 0, - {{"#main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div13", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div22", kNotCached, kNotYetChecked}, - {"#div23", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div32", kNotCached, kNotYetChecked}, - {"#div33", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0, - /* expected_bloom_filter_allocation_count */ 0); + TestQuerySelectorAll( + document, "main", ":has(+ .a)", {"div2", "div21"}, + /* expected_result_cache_count */ 0, + {{"#main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div32", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div33", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, QuerySelectorAllCase6) { @@ -2224,78 +2565,78 @@ TestMatches(document, "div1", ":has(> .a)", /* expected_match_result */ true, /* expected_result_cache_count */ 0, - {{"#main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div111", kNotCached, kNotYetChecked}, - {"#div112", kNotCached, kNotYetChecked}, - {"#div1121", kNotCached, kNotYetChecked}, - {"#div1122", kNotCached, kNotYetChecked}, - {"#div1123", kNotCached, kNotYetChecked}, - {"#div113", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div121", kNotCached, kNotYetChecked}, - {"#div122", kNotCached, kNotYetChecked}, - {"#div123", kNotCached, kNotYetChecked}}, + {{"#main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div111", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div112", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1121", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1122", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1123", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div113", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div121", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div122", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div123", kCheckPseudoHasResultNotCached, kNotYetChecked}}, /* expected_fast_reject_filter_cache_count */ 0, /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div112", ":has(> .a)", /* expected_match_result */ true, /* expected_result_cache_count */ 0, - {{"#main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div111", kNotCached, kNotYetChecked}, - {"#div112", kNotCached, kNotYetChecked}, - {"#div1121", kNotCached, kNotYetChecked}, - {"#div1122", kNotCached, kNotYetChecked}, - {"#div1123", kNotCached, kNotYetChecked}, - {"#div113", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div121", kNotCached, kNotYetChecked}, - {"#div122", kNotCached, kNotYetChecked}, - {"#div123", kNotCached, kNotYetChecked}}, + {{"#main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div111", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div112", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1121", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1122", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1123", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div113", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div121", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div122", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div123", kCheckPseudoHasResultNotCached, kNotYetChecked}}, /* expected_fast_reject_filter_cache_count */ 0, /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div12", ":has(> .a)", /* expected_match_result */ true, /* expected_result_cache_count */ 0, - {{"#main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div111", kNotCached, kNotYetChecked}, - {"#div112", kNotCached, kNotYetChecked}, - {"#div1121", kNotCached, kNotYetChecked}, - {"#div1122", kNotCached, kNotYetChecked}, - {"#div1123", kNotCached, kNotYetChecked}, - {"#div113", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div121", kNotCached, kNotYetChecked}, - {"#div122", kNotCached, kNotYetChecked}, - {"#div123", kNotCached, kNotYetChecked}}, + {{"#main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div111", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div112", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1121", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1122", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1123", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div113", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div121", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div122", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div123", kCheckPseudoHasResultNotCached, kNotYetChecked}}, /* expected_fast_reject_filter_cache_count */ 0, /* expected_bloom_filter_allocation_count */ 0); - TestQuerySelectorAll(document, "main", ":has(> .a)", - {"div1", "div112", "div12"}, - /* expected_result_cache_count */ 0, - {{"#main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div111", kNotCached, kNotYetChecked}, - {"#div112", kNotCached, kNotYetChecked}, - {"#div1121", kNotCached, kNotYetChecked}, - {"#div1122", kNotCached, kNotYetChecked}, - {"#div1123", kNotCached, kNotYetChecked}, - {"#div113", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div121", kNotCached, kNotYetChecked}, - {"#div122", kNotCached, kNotYetChecked}, - {"#div123", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0, - /* expected_bloom_filter_allocation_count */ 0); + TestQuerySelectorAll( + document, "main", ":has(> .a)", {"div1", "div112", "div12"}, + /* expected_result_cache_count */ 0, + {{"#main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div111", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div112", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1121", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1122", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1123", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div113", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div121", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div122", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div123", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, QuerySelectorAllCase7) { @@ -2325,55 +2666,56 @@ TestMatches(document, "div1", ":has(+ .a > .b)", /* expected_match_result */ true, /* expected_result_cache_count */ 0, - {{"#main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div13", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div22", kNotCached, kNotYetChecked}, - {"#div23", kNotCached, kNotYetChecked}, - {"#div231", kNotCached, kNotYetChecked}, - {"#div232", kNotCached, kNotYetChecked}, - {"#div233", kNotCached, kNotYetChecked}}, + {{"#main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div231", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div232", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div233", kCheckPseudoHasResultNotCached, kNotYetChecked}}, /* expected_fast_reject_filter_cache_count */ 0, /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div22", ":has(+ .a > .b)", /* expected_match_result */ true, /* expected_result_cache_count */ 0, - {{"#main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div13", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div22", kNotCached, kNotYetChecked}, - {"#div23", kNotCached, kNotYetChecked}, - {"#div231", kNotCached, kNotYetChecked}, - {"#div232", kNotCached, kNotYetChecked}, - {"#div233", kNotCached, kNotYetChecked}}, + {{"#main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div231", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div232", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div233", kCheckPseudoHasResultNotCached, kNotYetChecked}}, /* expected_fast_reject_filter_cache_count */ 0, /* expected_bloom_filter_allocation_count */ 0); - TestQuerySelectorAll(document, "main", ":has(+ .a > .b)", {"div1", "div22"}, - /* expected_result_cache_count */ 0, - {{"#main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div13", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div22", kNotCached, kNotYetChecked}, - {"#div23", kNotCached, kNotYetChecked}, - {"#div231", kNotCached, kNotYetChecked}, - {"#div232", kNotCached, kNotYetChecked}, - {"#div233", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0, - /* expected_bloom_filter_allocation_count */ 0); + TestQuerySelectorAll( + document, "main", ":has(+ .a > .b)", {"div1", "div22"}, + /* expected_result_cache_count */ 0, + {{"#main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div231", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div232", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div233", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); } TEST_F(CheckPseudoHasCacheScopeContextTest, QuerySelectorAllCase8) { @@ -2408,90 +2750,90 @@ TestMatches(document, "div1", ":has(~ .a > .b)", /* expected_match_result */ true, /* expected_result_cache_count */ 0, - {{"#main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div13", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div22", kNotCached, kNotYetChecked}, - {"#div221", kNotCached, kNotYetChecked}, - {"#div222", kNotCached, kNotYetChecked}, - {"#div223", kNotCached, kNotYetChecked}, - {"#div23", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div32", kNotCached, kNotYetChecked}, - {"#div33", kNotCached, kNotYetChecked}}, + {{"#main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div222", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div223", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div32", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div33", kCheckPseudoHasResultNotCached, kNotYetChecked}}, /* expected_fast_reject_filter_cache_count */ 0, /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div2", ":has(~ .a > .b)", /* expected_match_result */ true, /* expected_result_cache_count */ 0, - {{"#main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div13", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div22", kNotCached, kNotYetChecked}, - {"#div221", kNotCached, kNotYetChecked}, - {"#div222", kNotCached, kNotYetChecked}, - {"#div223", kNotCached, kNotYetChecked}, - {"#div23", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div32", kNotCached, kNotYetChecked}, - {"#div33", kNotCached, kNotYetChecked}}, + {{"#main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div222", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div223", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div32", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div33", kCheckPseudoHasResultNotCached, kNotYetChecked}}, /* expected_fast_reject_filter_cache_count */ 0, /* expected_bloom_filter_allocation_count */ 0); TestMatches(document, "div21", ":has(~ .a > .b)", /* expected_match_result */ true, /* expected_result_cache_count */ 0, - {{"#main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div13", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div22", kNotCached, kNotYetChecked}, - {"#div221", kNotCached, kNotYetChecked}, - {"#div222", kNotCached, kNotYetChecked}, - {"#div223", kNotCached, kNotYetChecked}, - {"#div23", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div32", kNotCached, kNotYetChecked}, - {"#div33", kNotCached, kNotYetChecked}}, + {{"#main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div222", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div223", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div32", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div33", kCheckPseudoHasResultNotCached, kNotYetChecked}}, /* expected_fast_reject_filter_cache_count */ 0, /* expected_bloom_filter_allocation_count */ 0); - TestQuerySelectorAll(document, "main", ":has(~ .a > .b)", - {"div1", "div2", "div21"}, - /* expected_result_cache_count */ 0, - {{"#main", kNotCached, kNotYetChecked}, - {"#div1", kNotCached, kNotYetChecked}, - {"#div11", kNotCached, kNotYetChecked}, - {"#div12", kNotCached, kNotYetChecked}, - {"#div13", kNotCached, kNotYetChecked}, - {"#div2", kNotCached, kNotYetChecked}, - {"#div21", kNotCached, kNotYetChecked}, - {"#div22", kNotCached, kNotYetChecked}, - {"#div221", kNotCached, kNotYetChecked}, - {"#div222", kNotCached, kNotYetChecked}, - {"#div223", kNotCached, kNotYetChecked}, - {"#div23", kNotCached, kNotYetChecked}, - {"#div3", kNotCached, kNotYetChecked}, - {"#div31", kNotCached, kNotYetChecked}, - {"#div32", kNotCached, kNotYetChecked}, - {"#div33", kNotCached, kNotYetChecked}}, - /* expected_fast_reject_filter_cache_count */ 0, - /* expected_bloom_filter_allocation_count */ 0); + TestQuerySelectorAll( + document, "main", ":has(~ .a > .b)", {"div1", "div2", "div21"}, + /* expected_result_cache_count */ 0, + {{"#main", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div1", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div11", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div12", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div13", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div2", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div21", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div22", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div221", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div222", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div223", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div23", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div3", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div31", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div32", kCheckPseudoHasResultNotCached, kNotYetChecked}, + {"#div33", kCheckPseudoHasResultNotCached, kNotYetChecked}}, + /* expected_fast_reject_filter_cache_count */ 0, + /* expected_bloom_filter_allocation_count */ 0); } } // namespace blink
diff --git a/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc b/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc index d72260f..792c443 100644 --- a/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc +++ b/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc
@@ -547,9 +547,10 @@ return false; if (string[0] != '0' && string[0] != '1' && string[0] != '.') { - int length = FindLengthOfValidDouble(string, end); - if (length > 0 && ContainsCharAtPos(string, end, length, terminator, - /*also_accept_whitespace=*/false)) { + int double_length = FindLengthOfValidDouble(string, end); + if (double_length > 0 && + ContainsCharAtPos(string, end, double_length, terminator, + /*also_accept_whitespace=*/false)) { value = negative ? 0 : 255; string = end; return true;
diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc index 50cedb1..76a6880 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
@@ -2423,8 +2423,8 @@ DCHECK_LE(1u, states_list->length()); ToggleRoot::States::NamesType states_vec; states_vec.ReserveInitialCapacity(states_list->length()); - for (const auto& item : *states_list) { - states_vec.push_back(To<CSSCustomIdentValue>(*item).Value()); + for (const auto& state : *states_list) { + states_vec.push_back(To<CSSCustomIdentValue>(*state).Value()); } states = ToggleRoot::States(std::move(states_vec)); } else if (const auto* maximum_state_number = @@ -2531,21 +2531,22 @@ } } - ToggleTrigger::State value(1); + ToggleTrigger::State trigger_value(1); if (item_list->length() == 3u) { const CSSValue& target_value = item_list->Item(2); if (const auto* target_ident = DynamicTo<CSSCustomIdentValue>(target_value)) { - value = ToggleTrigger::State(target_ident->Value()); + trigger_value = ToggleTrigger::State(target_ident->Value()); } else { const auto& target_number = To<CSSPrimitiveValue>(target_value); - value = ToggleTrigger::State(target_number.GetValue<uint32_t>()); + trigger_value = + ToggleTrigger::State(target_number.GetValue<uint32_t>()); } } else { DCHECK_NE(mode, ToggleTriggerMode::kSet); } - result->Append(ToggleTrigger(name, mode, value)); + result->Append(ToggleTrigger(name, mode, trigger_value)); } return result; } @@ -2567,10 +2568,10 @@ } if (css_value_list.length() > 1) { - const auto& value = css_value_list.Item(1); - DCHECK(value.IsPrimitiveValue()); + const auto& primitive_value = css_value_list.Item(1); + DCHECK(primitive_value.IsPrimitiveValue()); DCHECK(!length_value); - length_value = &To<CSSPrimitiveValue>(value); + length_value = &To<CSSPrimitiveValue>(primitive_value); } auto reference_box = StyleOverflowClipMargin::ReferenceBox::kPaddingBox;
diff --git a/third_party/blink/renderer/core/css/selector_checker.cc b/third_party/blink/renderer/core/css/selector_checker.cc index 36f8c99..44b322c3 100644 --- a/third_party/blink/renderer/core/css/selector_checker.cc +++ b/third_party/blink/renderer/core/css/selector_checker.cc
@@ -683,9 +683,9 @@ selector_matched = true; uint8_t old_result = cache_scope_context.SetMatchedAndGetOldResult(has_matched_element); - if (old_result == kNotCached) + if (old_result == kCheckPseudoHasResultNotCached) continue; - if (old_result & kMatched) + if (old_result & kCheckPseudoHasResultMatched) break; } } @@ -769,7 +769,7 @@ CSSSelector::kPseudoHas); Element* has_anchor_element = has_checking_context.element; uint8_t previous_result = cache_scope_context.GetResult(has_anchor_element); - if (previous_result & kChecked) + if (previous_result & kCheckPseudoHasResultChecked) return previous_result; // If the selector checking context is for the subject :has() in the argument @@ -779,12 +779,12 @@ cache_scope_context.AlreadyChecked(has_anchor_element)) { // If the element already have cache item, set the element as checked. // Otherwise, skip to set to prevent increasing unnecessary cache item. - if (previous_result != kNotCached) + if (previous_result != kCheckPseudoHasResultNotCached) cache_scope_context.SetChecked(has_anchor_element); // If the :has() anchor element was already checked previously, return the - // previous result with the kChecked flag set. - return previous_result | kChecked; + // previous result with the kCheckPseudoHasResultChecked flag set. + return previous_result | kCheckPseudoHasResultChecked; } cache_scope_context.SetChecked(has_anchor_element); @@ -1008,13 +1008,14 @@ // - Otherwise, check :has() argument. uint8_t previous_result = SetHasAnchorElementAsCheckedAndGetOldResult(context, cache_scope_context); - if (previous_result & kChecked) { + if (previous_result & kCheckPseudoHasResultChecked) { if (update_affected_by_has_flags) { SetAffectedByHasFlagsForHasAnchorSiblings(argument_context, has_anchor_element); } - return previous_result & kMatched ? kBreakEarlyAndReturnAsMatched - : kBreakEarlyAndMoveToNextArgument; + return previous_result & kCheckPseudoHasResultMatched + ? kBreakEarlyAndReturnAsMatched + : kBreakEarlyAndMoveToNextArgument; } // Check fast reject filter to reject :has() argument checking early.
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_document_state.cc b/third_party/blink/renderer/core/display_lock/display_lock_document_state.cc index dfa07d90..7cbe627f 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_document_state.cc +++ b/third_party/blink/renderer/core/display_lock/display_lock_document_state.cc
@@ -557,13 +557,14 @@ LayoutObject* object = target_object; while (!object->ContainingBlock()->IsLayoutView()) object = object->ContainingBlock(); - const ComputedStyle& style = object->StyleRef(); + const ComputedStyle& object_style = object->StyleRef(); if (object->IsOutOfFlowPositioned() && - (!style.Left().IsAuto() || !style.Right().IsAuto()) && - (!style.Top().IsAuto() || !style.Bottom().IsAuto())) + (!object_style.Left().IsAuto() || !object_style.Right().IsAuto()) && + (!object_style.Top().IsAuto() || !object_style.Bottom().IsAuto())) { UnlockShapingDeferredInclusiveDescendants(*object); - else + } else { UnlockShapingDeferredElements(); + } } } }
diff --git a/third_party/blink/renderer/core/document_transition/document_transition_style_tracker.cc b/third_party/blink/renderer/core/document_transition/document_transition_style_tracker.cc index 07e0511..0a6962a3 100644 --- a/third_party/blink/renderer/core/document_transition/document_transition_style_tracker.cc +++ b/third_party/blink/renderer/core/document_transition/document_transition_style_tracker.cc
@@ -522,9 +522,9 @@ if (found_new_tags) { VectorOf<std::pair<AtomicString, int>> new_tag_pairs; - int next_index = 0; + int next_tag_index = 0; for (const auto& root_tag : AllRootTags()) - new_tag_pairs.push_back(std::make_pair(root_tag, ++next_index)); + new_tag_pairs.push_back(std::make_pair(root_tag, ++next_tag_index)); for (auto& [tag, data] : element_data_map_) new_tag_pairs.push_back(std::make_pair(tag, data->element_index));
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index 323e07a..017244cd 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc
@@ -708,11 +708,10 @@ DCHECK( !GetDocument().IsActive() || GetDocument().InStyleRecalc() || !GetDocument().NeedsLayoutTreeUpdateForNodeIncludingDisplayLocked(*this)); - return IsBaseElementFocusableStyle(GetLayoutObject()); + return IsBaseElementFocusableStyle(); } -bool Element::IsBaseElementFocusableStyle( - const LayoutObject* layout_object) const { +bool Element::IsBaseElementFocusableStyle() const { if (LayoutObject* layout_object = GetLayoutObject()) return layout_object->StyleRef().IsFocusable(); @@ -8582,7 +8581,7 @@ // Check for opacity:0 if (options->checkOpacity()) { - if (auto* style = ancestor.GetComputedStyle()) { + if (style = ancestor.GetComputedStyle(); style) { if (style->Opacity() == 0.f) { return false; }
diff --git a/third_party/blink/renderer/core/dom/element.h b/third_party/blink/renderer/core/dom/element.h index 3aa520ef..adb691c1 100644 --- a/third_party/blink/renderer/core/dom/element.h +++ b/third_party/blink/renderer/core/dom/element.h
@@ -1285,10 +1285,8 @@ // This method cannot be moved to LayoutObject because some focusable nodes // don't have layoutObjects. e.g., HTMLOptionElement. virtual bool IsFocusableStyle() const; - // Contains the base logic for IsFocusableStyle. Doesn't require the node to - // have an up-to-date LayoutObject, it's up to the caller to pass the right - // one as an argument. - bool IsBaseElementFocusableStyle(const LayoutObject*) const; + // Contains the base logic for IsFocusableStyle. + bool IsBaseElementFocusableStyle() const; // Similar to IsFocusableStyle, except that it will ensure that any deferred // work to create layout objects is completed (e.g. in display-locked trees). bool IsFocusableStyleAfterUpdate() const;
diff --git a/third_party/blink/renderer/core/exported/web_page_popup_impl.cc b/third_party/blink/renderer/core/exported/web_page_popup_impl.cc index 24cbad7..4aeceba5 100644 --- a/third_party/blink/renderer/core/exported/web_page_popup_impl.cc +++ b/third_party/blink/renderer/core/exported/web_page_popup_impl.cc
@@ -350,8 +350,8 @@ DCHECK(popup_client_); popup_widget_host_.set_disconnect_handler(WTF::Bind( &WebPagePopupImpl::WidgetHostDisconnected, WTF::Unretained(this))); - if (auto* widget = opener_web_view->MainFrameViewWidget()) { - if (auto* device_emulator = widget->DeviceEmulator()) { + if (auto* main_frame_widget = opener_web_view->MainFrameViewWidget()) { + if (auto* device_emulator = main_frame_widget->DeviceEmulator()) { opener_widget_screen_origin_ = device_emulator->ViewRectOrigin(); opener_original_widget_screen_origin_ = device_emulator->original_view_rect().origin();
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index 2b4daea..a29d97603 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -57,6 +57,7 @@ #include "third_party/blink/public/common/web_preferences/web_preferences.h" #include "third_party/blink/public/mojom/frame/frame_replication_state.mojom-blink.h" #include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom-blink.h" #include "third_party/blink/public/platform/interface_registry.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/scheduler/web_thread_scheduler.h" @@ -2953,9 +2954,12 @@ DCHECK(local_main_frame_host_remote_); DCHECK(web_widget_); web_widget_->SetPendingWindowRect(adjusted_rect); + mojom::blink::WindowFeaturesPtr window_features = + mojom::blink::WindowFeatures::New(); + window_features->bounds = requested_rect; local_main_frame_host_remote_->ShowCreatedWindow( - opener_frame_token, NavigationPolicyToDisposition(policy), requested_rect, - opened_by_user_gesture, + opener_frame_token, NavigationPolicyToDisposition(policy), + std::move(window_features), opened_by_user_gesture, WTF::Bind(&WebViewImpl::DidShowCreatedWindow, WTF::Unretained(this))); MainFrameDevToolsAgentImpl()->DidShowNewWindow();
diff --git a/third_party/blink/renderer/core/frame/attribution_response_parsing.cc b/third_party/blink/renderer/core/frame/attribution_response_parsing.cc index b36418a..25a773f 100644 --- a/third_party/blink/renderer/core/frame/attribution_response_parsing.cc +++ b/third_party/blink/renderer/core/frame/attribution_response_parsing.cc
@@ -125,14 +125,16 @@ WTF::Vector<String> values; for (wtf_size_t j = 0; j < num_values; ++j) { - String value; - if (!array->at(j)->AsString(&value)) + String value_str; + if (!array->at(j)->AsString(&value_str)) return false; - if (value.CharactersSizeInBytes() > kMaxBytesPerAttributionFilterString) + if (value_str.CharactersSizeInBytes() > + kMaxBytesPerAttributionFilterString) { return false; + } - values.push_back(std::move(value)); + values.push_back(std::move(value_str)); } filter_data.filter_values.insert(entry.first, std::move(values));
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.cc b/third_party/blink/renderer/core/frame/local_frame_view.cc index 98b8f7c..8827b24 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -3053,9 +3053,8 @@ layer_debug_info_enabled_); PaintArtifactCompositor::ViewportProperties viewport_properties; - const auto& viewport = page->GetVisualViewport(); - if (GetFrame().IsMainFrame() && viewport.IsActiveViewport()) { - const auto& viewport = page->GetVisualViewport(); + if (const auto& viewport = page->GetVisualViewport(); + GetFrame().IsMainFrame() && viewport.IsActiveViewport()) { viewport_properties.overscroll_elasticity_effect = viewport.GetOverscrollElasticityEffectNode(); viewport_properties.overscroll_elasticity_transform =
diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc index 1b6b5a0..740d34a 100644 --- a/third_party/blink/renderer/core/frame/web_frame_test.cc +++ b/third_party/blink/renderer/core/frame/web_frame_test.cc
@@ -73,6 +73,7 @@ #include "third_party/blink/public/mojom/page_state/page_state.mojom-blink.h" #include "third_party/blink/public/mojom/scroll/scrollbar_mode.mojom-blink.h" #include "third_party/blink/public/mojom/webpreferences/web_preferences.mojom-blink.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom-blink.h" #include "third_party/blink/public/platform/scheduler/web_thread_scheduler.h" #include "third_party/blink/public/platform/web_cache.h" #include "third_party/blink/public/platform/web_security_origin.h" @@ -7226,7 +7227,7 @@ void RequestClose() override {} void ShowCreatedWindow(const ::blink::LocalFrameToken& opener_frame_token, ::ui::mojom::blink::WindowOpenDisposition disposition, - const ::gfx::Rect& rect, + const mojom::blink::WindowFeaturesPtr window_features, bool opened_by_user_gesture, ShowCreatedWindowCallback callback) override { std::move(callback).Run();
diff --git a/third_party/blink/renderer/core/html/build.gni b/third_party/blink/renderer/core/html/build.gni index c5298eb..1cbdd39 100644 --- a/third_party/blink/renderer/core/html/build.gni +++ b/third_party/blink/renderer/core/html/build.gni
@@ -634,7 +634,6 @@ "parser/resource_preloader.h", "parser/special_sequences_tracker.cc", "parser/special_sequences_tracker.h", - "parser/tag_parsing_group.h", "parser/text_document_parser.cc", "parser/text_document_parser.h", "parser/text_resource_decoder.cc", @@ -727,7 +726,6 @@ "parser/background_html_scanner_test.cc", "parser/html_resource_preloader_test.cc", "parser/html_srcset_parser_test.cc", - "parser/html_tree_builder_test.cc", "parser/html_tokenizer_test.cc", "parser/html_view_source_parser_test.cc", "parser/special_sequences_tracker_test.cc",
diff --git a/third_party/blink/renderer/core/html/html_frame_set_element.cc b/third_party/blink/renderer/core/html/html_frame_set_element.cc index e21f41d1..cb7c1c6 100644 --- a/third_party/blink/renderer/core/html/html_frame_set_element.cc +++ b/third_party/blink/renderer/core/html/html_frame_set_element.cc
@@ -77,8 +77,7 @@ border_set_(false), border_color_set_(false), frameborder_(true), - frameborder_set_(false), - noresize_(false) { + frameborder_set_(false) { SetHasCustomStyleCallbacks(); UseCounter::Count(document, WebFeature::kHTMLFrameSetElement); } @@ -138,7 +137,6 @@ } DirtyEdgeInfoAndFullPaintInvalidation(); } else if (name == html_names::kNoresizeAttr) { - noresize_ = true; DirtyEdgeInfo(); } else if (name == html_names::kBorderAttr) { if (!value.IsNull()) { @@ -268,6 +266,14 @@ } } +bool HTMLFrameSetElement::NoResize() const { + if (FastHasAttribute(html_names::kNoresizeAttr)) + return true; + if (const auto* frame_set = DynamicTo<HTMLFrameSetElement>(parentNode())) + return frame_set->NoResize(); + return false; +} + int HTMLFrameSetElement::Border(const ComputedStyle& style) const { if (!HasFrameBorder() || border_ == 0) return 0; @@ -398,8 +404,6 @@ if (!border_color_set_) border_color_set_ = frameset->HasBorderColor(); } - if (!noresize_) - noresize_ = frameset->NoResize(); } HTMLElement::AttachLayoutTree(context); @@ -409,7 +413,7 @@ void HTMLFrameSetElement::DefaultEventHandler(Event& evt) { auto* mouse_event = DynamicTo<MouseEvent>(evt); - if (mouse_event && !noresize_ && GetLayoutObject() && + if (mouse_event && !NoResize() && GetLayoutObject() && GetLayoutObject()->IsFrameSetIncludingNG()) { if (UserResize(*mouse_event)) { evt.SetDefaultHandled();
diff --git a/third_party/blink/renderer/core/html/html_frame_set_element.h b/third_party/blink/renderer/core/html/html_frame_set_element.h index b38e298..f2c0233 100644 --- a/third_party/blink/renderer/core/html/html_frame_set_element.h +++ b/third_party/blink/renderer/core/html/html_frame_set_element.h
@@ -44,7 +44,7 @@ bool IsHTMLFrameSetElement() const override { return true; } bool HasFrameBorder() const { return frameborder_; } - bool NoResize() const { return noresize_; } + bool NoResize() const; wtf_size_t TotalRows() const { return std::max<wtf_size_t>(1, row_lengths_.size()); @@ -150,7 +150,6 @@ bool frameborder_; bool frameborder_set_; - bool noresize_; bool is_edge_info_dirty_ = true; bool is_resizing_ = false; };
diff --git a/third_party/blink/renderer/core/html/parser/atomic_html_token.h b/third_party/blink/renderer/core/html/parser/atomic_html_token.h index fbec459..bf65dd8 100644 --- a/third_party/blink/renderer/core/html/parser/atomic_html_token.h +++ b/third_party/blink/renderer/core/html/parser/atomic_html_token.h
@@ -119,6 +119,9 @@ explicit HTMLTokenName(const AtomicString& name) : HTMLTokenName(html_names::HTMLTag::kUnknown, name) {} + // Store both the tag and the name. The tag is enough to lookup the name, but + // enough code makes use of the name that's it's worth caching (this performs + // a bit better than using a variant for the two and looking up on demand). html_names::HTMLTag tag_; AtomicString local_name_; }; @@ -140,9 +143,9 @@ return name_.GetLocalName(); } - void SetName(const AtomicString& name) { + void SetTokenName(const HTMLTokenName& name) { DCHECK(UsesName()); - name_ = HTMLTokenName::FromLocalName(name); + name_ = name; } html_names::HTMLTag GetHTMLTag() const { return name_.GetHTMLTag(); } @@ -237,11 +240,16 @@ : type_(type), name_(html_names::HTMLTag::kUnknown) {} AtomicHTMLToken(HTMLToken::TokenType type, - const AtomicString& name, + html_names::HTMLTag tag, const Vector<Attribute>& attributes = Vector<Attribute>()) - : type_(type), - name_(HTMLTokenName::FromLocalName(name)), - attributes_(attributes) { + : type_(type), name_(tag), attributes_(attributes) { + DCHECK(UsesName()); + } + + AtomicHTMLToken(HTMLToken::TokenType type, + const HTMLTokenName& name, + const Vector<Attribute>& attributes = Vector<Attribute>()) + : type_(type), name_(name), attributes_(attributes) { DCHECK(UsesName()); }
diff --git a/third_party/blink/renderer/core/html/parser/html_construction_site.cc b/third_party/blink/renderer/core/html/parser/html_construction_site.cc index 2e2fc84d..5de6c8d891 100644 --- a/third_party/blink/renderer/core/html/parser/html_construction_site.cc +++ b/third_party/blink/renderer/core/html/parser/html_construction_site.cc
@@ -1067,7 +1067,7 @@ for (Attribute& attr : item->Attributes()) { attributes.push_back(std::move(attr)); } - AtomicHTMLToken fake_token(HTMLToken::kStartTag, item->LocalName(), + AtomicHTMLToken fake_token(HTMLToken::kStartTag, item->GetTokenName(), std::move(attributes)); element = CreateElement(&fake_token, item->NamespaceURI()); return HTMLStackItem::Create(element, &fake_token, item->NamespaceURI()); @@ -1132,11 +1132,11 @@ void HTMLConstructionSite::FindFosterSite(HTMLConstructionSiteTask& task) { // 2.1 HTMLElementStack::ElementRecord* last_template = - open_elements_.Topmost(html_names::kTemplateTag.LocalName()); + open_elements_.Topmost(html_names::HTMLTag::kTemplate); // 2.2 HTMLElementStack::ElementRecord* last_table = - open_elements_.Topmost(html_names::kTableTag.LocalName()); + open_elements_.Topmost(html_names::HTMLTag::kTable); // 2.3 if (last_template && (!last_table || last_template->IsAbove(last_table))) {
diff --git a/third_party/blink/renderer/core/html/parser/html_element_stack.cc b/third_party/blink/renderer/core/html/parser/html_element_stack.cc index 2dca0a9b..a0a59f28 100644 --- a/third_party/blink/renderer/core/html/parser/html_element_stack.cc +++ b/third_party/blink/renderer/core/html/parser/html_element_stack.cc
@@ -36,72 +36,135 @@ namespace blink { +using HTMLTag = html_names::HTMLTag; + namespace { +// The following macro is used in switch statements for common types. It is +// defined so that it looks like a normal case statement, e.g.: +// case FOO_CASES: + +// Disable formatting as it mangles the formatting. +// clang-format off + +#define SCOPE_MARKER_CASES \ + HTMLTag::kApplet: \ + case HTMLTag::kCaption: \ + case HTMLTag::kHTML: \ + case HTMLTag::kMarquee: \ + case HTMLTag::kObject: \ + case HTMLTag::kTable: \ + case HTMLTag::kTd: \ + case HTMLTag::kTemplate: \ + case HTMLTag::kTh + +// clang-format on + inline bool IsRootNode(HTMLStackItem* item) { return item->IsDocumentFragmentNode() || item->HasTagName(html_names::kHTMLTag); } +inline bool IsScopeMarkerNonHTML(HTMLStackItem* item) { + return item->IsDocumentFragmentNode() || + item->HasTagName(mathml_names::kMiTag) || + item->HasTagName(mathml_names::kMoTag) || + item->HasTagName(mathml_names::kMnTag) || + item->HasTagName(mathml_names::kMsTag) || + item->HasTagName(mathml_names::kMtextTag) || + item->HasTagName(mathml_names::kAnnotationXmlTag) || + item->HasTagName(svg_names::kForeignObjectTag) || + item->HasTagName(svg_names::kDescTag) || + item->HasTagName(svg_names::kTitleTag); +} + inline bool IsScopeMarker(HTMLStackItem* item) { - if (item->NamespaceURI() == html_names::xhtmlNamespaceURI) { + if (item->IsHTMLNamespace()) { switch (item->GetHTMLTag()) { - case html_names::HTMLTag::kApplet: - case html_names::HTMLTag::kCaption: - case html_names::HTMLTag::kMarquee: - case html_names::HTMLTag::kObject: - case html_names::HTMLTag::kTable: - case html_names::HTMLTag::kTd: - case html_names::HTMLTag::kTemplate: - case html_names::HTMLTag::kTh: + case SCOPE_MARKER_CASES: + return true; + default: + return item->IsDocumentFragmentNode(); + } + } + return IsScopeMarkerNonHTML(item); +} + +inline bool IsListItemScopeMarker(HTMLStackItem* item) { + if (item->IsHTMLNamespace()) { + switch (item->GetHTMLTag()) { + case SCOPE_MARKER_CASES: + case HTMLTag::kOl: + case HTMLTag::kUl: + return true; + default: + return item->IsDocumentFragmentNode(); + } + } + return IsScopeMarkerNonHTML(item); +} + +inline bool IsTableScopeMarker(HTMLStackItem* item) { + if (item->IsHTMLNamespace()) { + switch (item->GetHTMLTag()) { + case HTMLTag::kHTML: + case HTMLTag::kTable: + case HTMLTag::kTemplate: return true; default: break; } - } else if (item->HasTagName(mathml_names::kMiTag) || - item->HasTagName(mathml_names::kMoTag) || - item->HasTagName(mathml_names::kMnTag) || - item->HasTagName(mathml_names::kMsTag) || - item->HasTagName(mathml_names::kMtextTag) || - item->HasTagName(mathml_names::kAnnotationXmlTag) || - item->HasTagName(svg_names::kForeignObjectTag) || - item->HasTagName(svg_names::kDescTag) || - item->HasTagName(svg_names::kTitleTag)) { - return true; } - return IsRootNode(item); -} - -inline bool IsListItemScopeMarker(HTMLStackItem* item) { - return IsScopeMarker(item) || item->HasTagName(html_names::kOlTag) || - item->HasTagName(html_names::kUlTag); -} - -inline bool IsTableScopeMarker(HTMLStackItem* item) { - return item->HasTagName(html_names::kTableTag) || - item->HasTagName(html_names::kTemplateTag) || IsRootNode(item); + return item->IsDocumentFragmentNode(); } inline bool IsTableBodyScopeMarker(HTMLStackItem* item) { - return item->HasTagName(html_names::kTbodyTag) || - item->HasTagName(html_names::kTfootTag) || - item->HasTagName(html_names::kTheadTag) || - item->HasTagName(html_names::kTemplateTag) || IsRootNode(item); + if (item->IsHTMLNamespace()) { + switch (item->GetHTMLTag()) { + case HTMLTag::kHTML: + case HTMLTag::kTbody: + case HTMLTag::kTfoot: + case HTMLTag::kThead: + case HTMLTag::kTemplate: + return true; + default: + break; + } + } + return item->IsDocumentFragmentNode(); } inline bool IsTableRowScopeMarker(HTMLStackItem* item) { - return item->HasTagName(html_names::kTrTag) || - item->HasTagName(html_names::kTemplateTag) || IsRootNode(item); + if (item->IsHTMLNamespace()) { + switch (item->GetHTMLTag()) { + case HTMLTag::kHTML: + case HTMLTag::kTr: + case HTMLTag::kTemplate: + return true; + default: + break; + } + } + return item->IsDocumentFragmentNode(); } inline bool IsForeignContentScopeMarker(HTMLStackItem* item) { - return HTMLElementStack::IsMathMLTextIntegrationPoint(item) || - HTMLElementStack::IsHTMLIntegrationPoint(item) || - item->IsInHTMLNamespace(); + return item->IsInHTMLNamespace() || + HTMLElementStack::IsMathMLTextIntegrationPoint(item) || + HTMLElementStack::IsHTMLIntegrationPoint(item); } inline bool IsButtonScopeMarker(HTMLStackItem* item) { - return IsScopeMarker(item) || item->HasTagName(html_names::kButtonTag); + if (item->IsHTMLNamespace()) { + switch (item->GetHTMLTag()) { + case SCOPE_MARKER_CASES: + case HTMLTag::kButton: + return true; + default: + return item->IsDocumentFragmentNode(); + } + } + return IsScopeMarkerNonHTML(item); } inline bool IsSelectScopeMarker(HTMLStackItem* item) { @@ -188,19 +251,24 @@ } void HTMLElementStack::Pop() { - DCHECK(!TopStackItem()->HasTagName(html_names::kHeadTag)); + DCHECK(TopStackItem()->GetHTMLTag() != HTMLTag::kHead || + !TopStackItem()->IsHTMLNamespace()); PopCommon(); } -void HTMLElementStack::PopUntil(const AtomicString& tag_name) { - while (!TopStackItem()->MatchesHTMLTag(tag_name)) { +void HTMLElementStack::PopUntil(html_names::HTMLTag tag) { + // kUnknown by itself is not enough to uniquely a tag. This code should only + // be called with HTMLTags other than kUnknown. + DCHECK_NE(tag, HTMLTag::kUnknown); + while (!TopStackItem()->IsHTMLNamespace() || + TopStackItem()->GetHTMLTag() != tag) { // pop() will ASSERT if a <body>, <head> or <html> will be popped. Pop(); } } -void HTMLElementStack::PopUntilPopped(const AtomicString& tag_name) { - PopUntil(tag_name); +void HTMLElementStack::PopUntilPopped(html_names::HTMLTag tag) { + PopUntil(tag); Pop(); } @@ -383,10 +451,15 @@ } HTMLElementStack::ElementRecord* HTMLElementStack::Topmost( - const AtomicString& tag_name) const { + html_names::HTMLTag tag) const { + // kUnknown by itself is not enough to uniquely a tag. This code should only + // be called with HTMLTags other than kUnknown. + DCHECK_NE(tag, HTMLTag::kUnknown); for (ElementRecord* pos = top_.Get(); pos; pos = pos->Next()) { - if (pos->StackItem()->MatchesHTMLTag(tag_name)) + if (pos->StackItem()->IsHTMLNamespace() && + tag == pos->StackItem()->GetHTMLTag()) { return pos; + } } return nullptr; } @@ -395,16 +468,15 @@ return !!Find(element); } -bool HTMLElementStack::Contains(const AtomicString& tag_name) const { - return !!Topmost(tag_name); -} - template <bool isMarker(HTMLStackItem*)> bool InScopeCommon(HTMLElementStack::ElementRecord* top, - const AtomicString& target_tag) { + html_names::HTMLTag tag) { + // kUnknown by itself is not enough to uniquely a tag. This code should only + // be called with HTMLTags other than kUnknown. + DCHECK_NE(HTMLTag::kUnknown, tag); for (HTMLElementStack::ElementRecord* pos = top; pos; pos = pos->Next()) { HTMLStackItem* item = pos->StackItem(); - if (item->MatchesHTMLTag(target_tag)) + if (tag == item->GetHTMLTag() && item->IsHTMLNamespace()) return true; if (isMarker(item)) return false; @@ -437,49 +509,28 @@ return false; } -bool HTMLElementStack::InScope(const AtomicString& target_tag) const { - return InScopeCommon<IsScopeMarker>(top_.Get(), target_tag); +bool HTMLElementStack::InScope(html_names::HTMLTag tag) const { + return InScopeCommon<IsScopeMarker>(top_.Get(), tag); } -bool HTMLElementStack::InScope(const QualifiedName& tag_name) const { - return InScope(tag_name.LocalName()); +bool HTMLElementStack::InListItemScope(html_names::HTMLTag tag) const { + return InScopeCommon<IsListItemScopeMarker>(top_.Get(), tag); } -bool HTMLElementStack::InListItemScope(const AtomicString& target_tag) const { - return InScopeCommon<IsListItemScopeMarker>(top_.Get(), target_tag); +bool HTMLElementStack::InTableScope(html_names::HTMLTag tag) const { + return InScopeCommon<IsTableScopeMarker>(top_.Get(), tag); } -bool HTMLElementStack::InListItemScope(const QualifiedName& tag_name) const { - return InListItemScope(tag_name.LocalName()); +bool HTMLElementStack::InButtonScope(html_names::HTMLTag tag) const { + return InScopeCommon<IsButtonScopeMarker>(top_.Get(), tag); } -bool HTMLElementStack::InTableScope(const AtomicString& target_tag) const { - return InScopeCommon<IsTableScopeMarker>(top_.Get(), target_tag); -} - -bool HTMLElementStack::InTableScope(const QualifiedName& tag_name) const { - return InTableScope(tag_name.LocalName()); -} - -bool HTMLElementStack::InButtonScope(const AtomicString& target_tag) const { - return InScopeCommon<IsButtonScopeMarker>(top_.Get(), target_tag); -} - -bool HTMLElementStack::InButtonScope(const QualifiedName& tag_name) const { - return InButtonScope(tag_name.LocalName()); -} - -bool HTMLElementStack::InSelectScope(const AtomicString& target_tag) const { - return InScopeCommon<IsSelectScopeMarker>(top_.Get(), target_tag); -} - -bool HTMLElementStack::InSelectScope(const QualifiedName& tag_name) const { - return InSelectScope(tag_name.LocalName()); +bool HTMLElementStack::InSelectScope(html_names::HTMLTag tag) const { + return InScopeCommon<IsSelectScopeMarker>(top_.Get(), tag); } bool HTMLElementStack::HasTemplateInHTMLScope() const { - return InScopeCommon<IsRootNode>(top_.Get(), - html_names::kTemplateTag.LocalName()); + return InScopeCommon<IsRootNode>(top_.Get(), HTMLTag::kTemplate); } Element* HTMLElementStack::HtmlElement() const {
diff --git a/third_party/blink/renderer/core/html/parser/html_element_stack.h b/third_party/blink/renderer/core/html/parser/html_element_stack.h index fc50b2a..0d6a26f 100644 --- a/third_party/blink/renderer/core/html/parser/html_element_stack.h +++ b/third_party/blink/renderer/core/html/parser/html_element_stack.h
@@ -35,7 +35,6 @@ class ContainerNode; class Element; -class QualifiedName; // NOTE: The HTML5 spec uses a backwards (grows downward) stack. We're using // more standard (grows upwards) stack terminology here. @@ -98,7 +97,7 @@ ElementRecord* TopRecord() const; ElementRecord* Find(Element*) const; ElementRecord* FurthestBlockForFormattingElement(Element*) const; - ElementRecord* Topmost(const AtomicString& tag_name) const; + ElementRecord* Topmost(html_names::HTMLTag tag) const; void InsertAbove(HTMLStackItem*, ElementRecord*); @@ -109,14 +108,11 @@ void PushHTMLBodyElement(HTMLStackItem*); void Pop(); - void PopUntil(const AtomicString& tag_name); + void PopUntil(html_names::HTMLTag tag); void PopUntil(Element*); - void PopUntilPopped(const AtomicString& tag_name); - void PopUntilPopped(const QualifiedName& tag_name) { - PopUntilPopped(tag_name.LocalName()); - } - void PopUntilPopped(Element*); + void PopUntilPopped(html_names::HTMLTag tag); + void PopUntilNumberedHeaderElementPopped(); // "clear the stack back to a table context" in the spec. @@ -140,19 +136,13 @@ void RemoveHTMLHeadElement(Element*); bool Contains(Element*) const; - bool Contains(const AtomicString& tag_name) const; bool InScope(Element*) const; - bool InScope(const AtomicString& tag_name) const; - bool InScope(const QualifiedName&) const; - bool InListItemScope(const AtomicString& tag_name) const; - bool InListItemScope(const QualifiedName&) const; - bool InTableScope(const AtomicString& tag_name) const; - bool InTableScope(const QualifiedName&) const; - bool InButtonScope(const AtomicString& tag_name) const; - bool InButtonScope(const QualifiedName&) const; - bool InSelectScope(const AtomicString& tag_name) const; - bool InSelectScope(const QualifiedName&) const; + bool InScope(html_names::HTMLTag tag) const; + bool InListItemScope(html_names::HTMLTag tag) const; + bool InTableScope(html_names::HTMLTag tag) const; + bool InButtonScope(html_names::HTMLTag tag) const; + bool InSelectScope(html_names::HTMLTag tag) const; bool HasNumberedHeaderElementInScope() const;
diff --git a/third_party/blink/renderer/core/html/parser/html_stack_item.h b/third_party/blink/renderer/core/html/parser/html_stack_item.h index 408c89d..e9b91b43 100644 --- a/third_party/blink/renderer/core/html/parser/html_stack_item.h +++ b/third_party/blink/renderer/core/html/parser/html_stack_item.h
@@ -104,6 +104,8 @@ const AtomicString& NamespaceURI() const { return namespace_uri_; } const AtomicString& LocalName() const { return token_name_.GetLocalName(); } + const HTMLTokenName& GetTokenName() const { return token_name_; } + const base::span<Attribute> Attributes() { DCHECK(LocalName()); return {TokenAttributesData(), num_token_attributes_}; @@ -122,22 +124,29 @@ bool HasLocalName(const AtomicString& name) const { return token_name_.GetLocalName() == name; } + bool HasTagName(const QualifiedName& name) const { - return HasLocalName(name.LocalName()) && + return token_name_.GetLocalName() == name.LocalName() && namespace_uri_ == name.NamespaceURI(); } - bool MatchesHTMLTag(const AtomicString& name) const { - return HasLocalName(name) && - namespace_uri_ == html_names::xhtmlNamespaceURI; + bool IsHTMLNamespace() const { + return namespace_uri_ == html_names::xhtmlNamespaceURI; } - bool MatchesHTMLTag(const QualifiedName& name) const { - return HasLocalName(name.LocalName()) && - namespace_uri_ == html_names::xhtmlNamespaceURI; - } + bool MatchesHTMLTag(const HTMLTokenName& name) const { - return name == token_name_ && - namespace_uri_ == html_names::xhtmlNamespaceURI; + return name == token_name_ && IsHTMLNamespace(); + } + + bool MatchesHTMLTag(const AtomicString& name) const { + return HasLocalName(name) && IsHTMLNamespace(); + } + + bool MatchesHTMLTag(html_names::HTMLTag tag) const { + // Equality of HTMLTag only works if supplied a value other than + // kUnknownTag. + DCHECK_NE(tag, html_names::HTMLTag::kUnknown); + return tag == GetHTMLTag() && IsHTMLNamespace(); } bool CausesFosterParenting() {
diff --git a/third_party/blink/renderer/core/html/parser/html_tree_builder.cc b/third_party/blink/renderer/core/html/parser/html_tree_builder.cc index fc527ba..c5af4cb2 100644 --- a/third_party/blink/renderer/core/html/parser/html_tree_builder.cc +++ b/third_party/blink/renderer/core/html/parser/html_tree_builder.cc
@@ -44,7 +44,6 @@ #include "third_party/blink/renderer/core/html/parser/html_token.h" #include "third_party/blink/renderer/core/html/parser/html_token_producer.h" #include "third_party/blink/renderer/core/html/parser/html_tokenizer.h" -#include "third_party/blink/renderer/core/html/parser/tag_parsing_group.h" #include "third_party/blink/renderer/core/html_names.h" #include "third_party/blink/renderer/core/inspector/console_message.h" #include "third_party/blink/renderer/core/mathml_names.h" @@ -64,6 +63,8 @@ namespace blink { +using HTMLTag = html_names::HTMLTag; + namespace { inline bool IsHTMLSpaceOrReplacementCharacter(UChar character) { @@ -86,26 +87,47 @@ .IsAllSpecialCharacters<IsHTMLSpaceOrReplacementCharacter>(); } -static bool IsNonAnchorNonNobrFormattingTag(const AtomicString& tag_name) { - return tag_name == html_names::kBTag || tag_name == html_names::kBigTag || - tag_name == html_names::kCodeTag || tag_name == html_names::kEmTag || - tag_name == html_names::kFontTag || tag_name == html_names::kITag || - tag_name == html_names::kSTag || tag_name == html_names::kSmallTag || - tag_name == html_names::kStrikeTag || - tag_name == html_names::kStrongTag || tag_name == html_names::kTtTag || - tag_name == html_names::kUTag; -} +// The following macros are used in switch statements for some common types. +// They are defined so that they can look like a normal case statement, e.g.: +// case FOO_CASES: -static bool IsNonAnchorFormattingTag(const AtomicString& tag_name) { - return tag_name == html_names::kNobrTag || - IsNonAnchorNonNobrFormattingTag(tag_name); +// Disable formatting as it mangles these macros. +// clang-format off + +#define CAPTION_COL_OR_COLGROUP_CASES \ + HTMLTag::kCaption: \ + case HTMLTag::kCol: \ + case HTMLTag::kColgroup + +#define NUMBERED_HEADER_CASES \ + HTMLTag::kH1: \ + case HTMLTag::kH2: \ + case HTMLTag::kH3: \ + case HTMLTag::kH4: \ + case HTMLTag::kH5: \ + case HTMLTag::kH6 + +#define TABLE_BODY_CONTEXT_CASES \ + HTMLTag::kTbody: \ + case HTMLTag::kTfoot: \ + case HTMLTag::kThead + +#define TABLE_CELL_CONTEXT_CASES \ + HTMLTag::kTh: \ + case HTMLTag::kTd + +// clang-format on + +static bool IsTableBodyContextTag(HTMLTag tag) { + switch (tag) { + case TABLE_BODY_CONTEXT_CASES: + return true; + default: + return false; + } } // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#formatting -static bool IsFormattingTag(const AtomicString& tag_name) { - return tag_name == html_names::kATag || IsNonAnchorFormattingTag(tag_name); -} - class HTMLTreeBuilder::CharacterTokenBuffer { public: explicit CharacterTokenBuffer(AtomicHTMLToken* token) @@ -385,42 +407,40 @@ ParseError(token); } -void HTMLTreeBuilder::ProcessFakeStartTag(const QualifiedName& tag_name, +void HTMLTreeBuilder::ProcessFakeStartTag(HTMLTag tag, const Vector<Attribute>& attributes) { // FIXME: We'll need a fancier conversion than just "localName" for SVG/MathML // tags. - AtomicHTMLToken fake_token(HTMLToken::kStartTag, tag_name.LocalName(), - attributes); + AtomicHTMLToken fake_token(HTMLToken::kStartTag, tag, attributes); ProcessStartTag(&fake_token); } -void HTMLTreeBuilder::ProcessFakeEndTag(const AtomicString& tag_name) { - AtomicHTMLToken fake_token(HTMLToken::kEndTag, tag_name); +void HTMLTreeBuilder::ProcessFakeEndTag(HTMLTag tag) { + AtomicHTMLToken fake_token(HTMLToken::kEndTag, tag); ProcessEndTag(&fake_token); } -void HTMLTreeBuilder::ProcessFakeEndTag(const QualifiedName& tag_name) { - // FIXME: We'll need a fancier conversion than just "localName" for SVG/MathML - // tags. - ProcessFakeEndTag(tag_name.LocalName()); +void HTMLTreeBuilder::ProcessFakeEndTag(const HTMLStackItem& stack_item) { + AtomicHTMLToken fake_token(HTMLToken::kEndTag, stack_item.GetTokenName()); + ProcessEndTag(&fake_token); } void HTMLTreeBuilder::ProcessFakePEndTagIfPInButtonScope() { - if (!tree_.OpenElements()->InButtonScope(html_names::kPTag.LocalName())) + if (!tree_.OpenElements()->InButtonScope(HTMLTag::kP)) return; - AtomicHTMLToken end_p(HTMLToken::kEndTag, html_names::kPTag.LocalName()); + AtomicHTMLToken end_p(HTMLToken::kEndTag, HTMLTag::kP); ProcessEndTag(&end_p); } namespace { bool IsLi(const HTMLStackItem* item) { - return item->HasTagName(html_names::kLiTag); + return item->MatchesHTMLTag(HTMLTag::kLi); } bool IsDdOrDt(const HTMLStackItem* item) { - return item->HasTagName(html_names::kDdTag) || - item->HasTagName(html_names::kDtTag); + return item->MatchesHTMLTag(HTMLTag::kDd) || + item->MatchesHTMLTag(HTMLTag::kDt); } } // namespace @@ -434,12 +454,12 @@ HTMLStackItem* item = node_record->StackItem(); if (shouldClose(item)) { DCHECK(item->IsElementNode()); - ProcessFakeEndTag(item->LocalName()); + ProcessFakeEndTag(*item); break; } - if (item->IsSpecialNode() && !item->HasTagName(html_names::kAddressTag) && - !item->HasTagName(html_names::kDivTag) && - !item->HasTagName(html_names::kPTag)) + if (item->IsSpecialNode() && !item->MatchesHTMLTag(HTMLTag::kAddress) && + !item->MatchesHTMLTag(HTMLTag::kDiv) && + !item->MatchesHTMLTag(HTMLTag::kP)) break; node_record = node_record->Next(); } @@ -488,7 +508,7 @@ const auto it = case_map->find(token->GetName()); if (it != case_map->end()) { DCHECK(!it->value.LocalName().IsNull()); - token->SetName(it->value.LocalName()); + token->SetTokenName(HTMLTokenName::FromLocalName(it->value.LocalName())); } } @@ -574,16 +594,26 @@ void HTMLTreeBuilder::ProcessStartTagForInBody(AtomicHTMLToken* token) { DCHECK_EQ(token->GetType(), HTMLToken::kStartTag); - switch (GetTagParsingGroup(token->GetName())) { - case TagParsingGroup::kHTMLTag: + switch (token->GetHTMLTag()) { + case HTMLTag::kHTML: ProcessHtmlStartTagForInBody(token); break; - case TagParsingGroup::kTagsThatBelongInHead: { + case HTMLTag::kBase: + case HTMLTag::kBasefont: + case HTMLTag::kBgsound: + case HTMLTag::kCommand: + case HTMLTag::kLink: + case HTMLTag::kMeta: + case HTMLTag::kNoframes: + case HTMLTag::kScript: + case HTMLTag::kStyle: + case HTMLTag::kTitle: + case HTMLTag::kTemplate: { bool did_process = ProcessStartTagForInHead(token); DCHECK(did_process); break; } - case TagParsingGroup::kBodyTag: + case HTMLTag::kBody: ParseError(token); if (!tree_.OpenElements()->SecondElementIsHTMLBodyElement() || tree_.OpenElements()->HasOnlyOneElement() || @@ -594,7 +624,7 @@ frameset_ok_ = false; tree_.InsertHTMLBodyStartTagInBody(token); break; - case TagParsingGroup::kFramesetTag: + case HTMLTag::kFrameset: ParseError(token); if (!tree_.OpenElements()->SecondElementIsHTMLBodyElement() || tree_.OpenElements()->HasOnlyOneElement()) { @@ -617,16 +647,38 @@ tree_.InsertHTMLElement(token); SetInsertionMode(kInFramesetMode); break; - case TagParsingGroup::kTagsThatCloseP: - // Spec: + case HTMLTag::kAddress: + case HTMLTag::kArticle: + case HTMLTag::kAside: + case HTMLTag::kBlockquote: + case HTMLTag::kCenter: + case HTMLTag::kDetails: + case HTMLTag::kDialog: + case HTMLTag::kDir: + case HTMLTag::kDiv: + case HTMLTag::kDl: + case HTMLTag::kFieldset: + case HTMLTag::kFigcaption: + case HTMLTag::kFigure: + case HTMLTag::kFooter: + case HTMLTag::kHeader: + case HTMLTag::kHgroup: + case HTMLTag::kMain: + case HTMLTag::kMenu: + case HTMLTag::kNav: + case HTMLTag::kOl: + case HTMLTag::kP: + case HTMLTag::kSection: + case HTMLTag::kSummary: + case HTMLTag::kUl: // https://html.spec.whatwg.org/multipage/parsing.html#:~:text=A%20start%20tag%20whose%20tag%20name%20is%20one%20of%3A%20%22address%22%2C ProcessFakePEndTagIfPInButtonScope(); tree_.InsertHTMLElement(token); break; - case TagParsingGroup::kLiTag: + case HTMLTag::kLi: ProcessCloseWhenNestedTag<IsLi>(token); break; - case TagParsingGroup::kInputTag: { + case HTMLTag::kInput: { // Per spec https://html.spec.whatwg.org/C/#parsing-main-inbody, // section "A start tag whose tag name is "input"" @@ -643,10 +695,10 @@ frameset_ok_ = false; break; } - case TagParsingGroup::kButtonTag: - if (tree_.OpenElements()->InScope(html_names::kButtonTag)) { + case HTMLTag::kButton: + if (tree_.OpenElements()->InScope(HTMLTag::kButton)) { ParseError(token); - ProcessFakeEndTag(html_names::kButtonTag); + ProcessFakeEndTag(HTMLTag::kButton); ProcessStartTag(token); // FIXME: Could we just fall through here? break; } @@ -654,7 +706,7 @@ tree_.InsertHTMLElement(token); frameset_ok_ = false; break; - case TagParsingGroup::kNumberedHeaderTag: + case NUMBERED_HEADER_CASES: ProcessFakePEndTagIfPInButtonScope(); if (tree_.CurrentStackItem()->IsNumberedHeaderElement()) { ParseError(token); @@ -662,13 +714,14 @@ } tree_.InsertHTMLElement(token); break; - case TagParsingGroup::kListingOrPreTag: + case HTMLTag::kListing: + case HTMLTag::kPre: ProcessFakePEndTagIfPInButtonScope(); tree_.InsertHTMLElement(token); should_skip_leading_newline_ = true; frameset_ok_ = false; break; - case TagParsingGroup::kFormTag: + case HTMLTag::kForm: if (tree_.IsFormElementPointerNonNull() && !IsParsingTemplateContents()) { ParseError(token); UseCounter::Count(tree_.CurrentNode()->GetDocument(), @@ -678,21 +731,22 @@ ProcessFakePEndTagIfPInButtonScope(); tree_.InsertHTMLFormElement(token); break; - case TagParsingGroup::kDdOrDtTag: + case HTMLTag::kDd: + case HTMLTag::kDt: ProcessCloseWhenNestedTag<IsDdOrDt>(token); break; - case TagParsingGroup::kPlaintextTag: + case HTMLTag::kPlaintext: ProcessFakePEndTagIfPInButtonScope(); tree_.InsertHTMLElement(token); token_producer_->SetTokenizerState(HTMLTokenizer::kPLAINTEXTState); break; - case TagParsingGroup::kATag: { + case HTMLTag::kA: { Element* active_a_tag = tree_.ActiveFormattingElements()->ClosestElementInScopeWithName( - html_names::kATag.LocalName()); + token->GetName()); if (active_a_tag) { ParseError(token); - ProcessFakeEndTag(html_names::kATag); + ProcessFakeEndTag(HTMLTag::kA); tree_.ActiveFormattingElements()->Remove(active_a_tag); if (tree_.OpenElements()->Contains(active_a_tag)) tree_.OpenElements()->Remove(active_a_tag); @@ -701,45 +755,61 @@ tree_.InsertFormattingElement(token); break; } - case TagParsingGroup::kNonAnchorNonNobrFormattingTag: + case HTMLTag::kB: + case HTMLTag::kBig: + case HTMLTag::kCode: + case HTMLTag::kEm: + case HTMLTag::kFont: + case HTMLTag::kI: + case HTMLTag::kS: + case HTMLTag::kSmall: + case HTMLTag::kStrike: + case HTMLTag::kStrong: + case HTMLTag::kTt: + case HTMLTag::kU: tree_.ReconstructTheActiveFormattingElements(); tree_.InsertFormattingElement(token); break; - case TagParsingGroup::kNobrTag: + case HTMLTag::kNobr: tree_.ReconstructTheActiveFormattingElements(); - if (tree_.OpenElements()->InScope(html_names::kNobrTag)) { + if (tree_.OpenElements()->InScope(HTMLTag::kNobr)) { ParseError(token); - ProcessFakeEndTag(html_names::kNobrTag); + ProcessFakeEndTag(HTMLTag::kNobr); tree_.ReconstructTheActiveFormattingElements(); } tree_.InsertFormattingElement(token); break; - case TagParsingGroup::kAppletOrObjectTag: + case HTMLTag::kApplet: + case HTMLTag::kObject: if (!PluginContentIsAllowed(tree_.GetParserContentPolicy())) break; [[fallthrough]]; - case TagParsingGroup::kMarqueeTag: + case HTMLTag::kMarquee: tree_.ReconstructTheActiveFormattingElements(); tree_.InsertHTMLElement(token); tree_.ActiveFormattingElements()->AppendMarker(); frameset_ok_ = false; break; - case TagParsingGroup::kTableTag: + case HTMLTag::kTable: if (!tree_.InQuirksMode() && - tree_.OpenElements()->InButtonScope(html_names::kPTag)) - ProcessFakeEndTag(html_names::kPTag); + tree_.OpenElements()->InButtonScope(HTMLTag::kP)) + ProcessFakeEndTag(HTMLTag::kP); tree_.InsertHTMLElement(token); frameset_ok_ = false; SetInsertionMode(kInTableMode); break; - case TagParsingGroup::kImageTag: + case HTMLTag::kImage: ParseError(token); // Apparently we're not supposed to ask. - token->SetName(html_names::kImgTag.LocalName()); + token->SetTokenName(HTMLTokenName(HTMLTag::kImg)); [[fallthrough]]; - case TagParsingGroup::kReconstructFormattingTags: // Includes kImgTag, thus - // the fallthrough. - if (token->GetName() == html_names::kEmbedTag && + case HTMLTag::kArea: // Includes kImgTag, thus the + case HTMLTag::kBr: // fallthrough. + case HTMLTag::kEmbed: + case HTMLTag::kImg: + case HTMLTag::kKeygen: + case HTMLTag::kWbr: + if (token->GetHTMLTag() == HTMLTag::kEmbed && !PluginContentIsAllowed(tree_.GetParserContentPolicy())) { break; } @@ -747,15 +817,17 @@ tree_.InsertSelfClosingHTMLElementDestroyingToken(token); frameset_ok_ = false; break; - case TagParsingGroup::kParamOrSourceOrTrackTag: + case HTMLTag::kParam: + case HTMLTag::kSource: + case HTMLTag::kTrack: tree_.InsertSelfClosingHTMLElementDestroyingToken(token); break; - case TagParsingGroup::kHrTag: + case HTMLTag::kHr: ProcessFakePEndTagIfPInButtonScope(); tree_.InsertSelfClosingHTMLElementDestroyingToken(token); frameset_ok_ = false; break; - case TagParsingGroup::kTextareaTag: + case HTMLTag::kTextarea: tree_.InsertHTMLElement(token); should_skip_leading_newline_ = true; token_producer_->SetTokenizerState(HTMLTokenizer::kRCDATAState); @@ -763,20 +835,20 @@ frameset_ok_ = false; SetInsertionMode(kTextMode); break; - case TagParsingGroup::kXmpTag: + case HTMLTag::kXmp: ProcessFakePEndTagIfPInButtonScope(); tree_.ReconstructTheActiveFormattingElements(); frameset_ok_ = false; ProcessGenericRawTextStartTag(token); break; - case TagParsingGroup::kIFrameTag: + case HTMLTag::kIFrame: frameset_ok_ = false; ProcessGenericRawTextStartTag(token); break; - case TagParsingGroup::kNoembedTag: + case HTMLTag::kNoembed: ProcessGenericRawTextStartTag(token); break; - case TagParsingGroup::kNoscriptTag: + case HTMLTag::kNoscript: if (options_.scripting_flag) { ProcessGenericRawTextStartTag(token); } else { @@ -784,7 +856,7 @@ tree_.InsertHTMLElement(token); } break; - case TagParsingGroup::kSelectTag: + case HTMLTag::kSelect: tree_.ReconstructTheActiveFormattingElements(); tree_.InsertHTMLElement(token); frameset_ok_ = false; @@ -797,51 +869,62 @@ else SetInsertionMode(kInSelectMode); break; - case TagParsingGroup::kOptgroupOrOptionTag: - if (tree_.CurrentStackItem()->HasTagName(html_names::kOptionTag)) { - AtomicHTMLToken end_option(HTMLToken::kEndTag, - html_names::kOptionTag.LocalName()); + case HTMLTag::kOptgroup: + case HTMLTag::kOption: + if (tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kOption)) { + AtomicHTMLToken end_option(HTMLToken::kEndTag, HTMLTag::kOption); ProcessEndTag(&end_option); } tree_.ReconstructTheActiveFormattingElements(); tree_.InsertHTMLElement(token); break; - case TagParsingGroup::kRbOrRtcTag: - if (tree_.OpenElements()->InScope(html_names::kRubyTag.LocalName())) { + case HTMLTag::kRb: + case HTMLTag::kRTC: + if (tree_.OpenElements()->InScope(HTMLTag::kRuby)) { tree_.GenerateImpliedEndTags(); - if (!tree_.CurrentStackItem()->HasTagName(html_names::kRubyTag)) + if (!tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kRuby)) ParseError(token); } tree_.InsertHTMLElement(token); break; - case TagParsingGroup::kRtOrRpTag: - if (tree_.OpenElements()->InScope(html_names::kRubyTag.LocalName())) { - tree_.GenerateImpliedEndTagsWithExclusion( - HTMLTokenName(html_names::HTMLTag::kRTC)); - if (!tree_.CurrentStackItem()->HasTagName(html_names::kRubyTag) && - !tree_.CurrentStackItem()->HasTagName(html_names::kRTCTag)) + case HTMLTag::kRt: + case HTMLTag::kRp: + if (tree_.OpenElements()->InScope(HTMLTag::kRuby)) { + tree_.GenerateImpliedEndTagsWithExclusion(HTMLTokenName(HTMLTag::kRTC)); + if (!tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kRuby) && + !tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kRTC)) ParseError(token); } tree_.InsertHTMLElement(token); break; - case TagParsingGroup::kMathTag: - tree_.ReconstructTheActiveFormattingElements(); - AdjustMathMLAttributes(token); - AdjustForeignAttributes(token); - tree_.InsertForeignElement(token, mathml_names::kNamespaceURI); - break; - case TagParsingGroup::kSVGTag: - tree_.ReconstructTheActiveFormattingElements(); - AdjustSVGAttributes(token); - AdjustForeignAttributes(token); - tree_.InsertForeignElement(token, svg_names::kNamespaceURI); - break; - case TagParsingGroup::kParseErrorTag: + case HTMLTag::kCaption: + case HTMLTag::kCol: + case HTMLTag::kColgroup: + case HTMLTag::kFrame: + case HTMLTag::kHead: + case HTMLTag::kTbody: + case HTMLTag::kTfoot: + case HTMLTag::kThead: + case HTMLTag::kTh: + case HTMLTag::kTd: + case HTMLTag::kTr: ParseError(token); break; - case TagParsingGroup::kNoGroup: - tree_.ReconstructTheActiveFormattingElements(); - tree_.InsertHTMLElement(token); + default: + if (token->GetName() == mathml_names::kMathTag.LocalName()) { + tree_.ReconstructTheActiveFormattingElements(); + AdjustMathMLAttributes(token); + AdjustForeignAttributes(token); + tree_.InsertForeignElement(token, mathml_names::kNamespaceURI); + } else if (token->GetName() == svg_names::kSVGTag.LocalName()) { + tree_.ReconstructTheActiveFormattingElements(); + AdjustSVGAttributes(token); + AdjustForeignAttributes(token); + tree_.InsertForeignElement(token, svg_names::kNamespaceURI); + } else { + tree_.ReconstructTheActiveFormattingElements(); + tree_.InsertHTMLElement(token); + } break; } } @@ -901,9 +984,9 @@ return false; } tree_.GenerateImpliedEndTags(); - if (!tree_.CurrentStackItem()->HasTagName(html_names::kTemplateTag)) + if (!tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kTemplate)) ParseError(token); - tree_.OpenElements()->PopUntil(html_names::kTemplateTag.LocalName()); + tree_.OpenElements()->PopUntil(HTMLTag::kTemplate); HTMLStackItem* template_stack_item = tree_.OpenElements()->TopRecord()->StackItem(); tree_.OpenElements()->Pop(); @@ -953,8 +1036,7 @@ bool HTMLTreeBuilder::ProcessEndOfFileForInTemplateContents( AtomicHTMLToken* token) { - AtomicHTMLToken end_template(HTMLToken::kEndTag, - html_names::kTemplateTag.LocalName()); + AtomicHTMLToken end_template(HTMLToken::kEndTag, HTMLTag::kTemplate); if (!ProcessTemplateEndTag(&end_template)) return false; @@ -986,85 +1068,85 @@ // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#close-the-cell void HTMLTreeBuilder::CloseTheCell() { DCHECK_EQ(GetInsertionMode(), kInCellMode); - if (tree_.OpenElements()->InTableScope(html_names::kTdTag)) { - DCHECK(!tree_.OpenElements()->InTableScope(html_names::kThTag)); - ProcessFakeEndTag(html_names::kTdTag); + if (tree_.OpenElements()->InTableScope(HTMLTag::kTd)) { + DCHECK(!tree_.OpenElements()->InTableScope(HTMLTag::kTh)); + ProcessFakeEndTag(HTMLTag::kTd); return; } - DCHECK(tree_.OpenElements()->InTableScope(html_names::kThTag)); - ProcessFakeEndTag(html_names::kThTag); + DCHECK(tree_.OpenElements()->InTableScope(HTMLTag::kTh)); + ProcessFakeEndTag(HTMLTag::kTh); DCHECK_EQ(GetInsertionMode(), kInRowMode); } void HTMLTreeBuilder::ProcessStartTagForInTable(AtomicHTMLToken* token) { DCHECK_EQ(token->GetType(), HTMLToken::kStartTag); - if (token->GetName() == html_names::kCaptionTag) { - tree_.OpenElements()->PopUntilTableScopeMarker(); - tree_.ActiveFormattingElements()->AppendMarker(); - tree_.InsertHTMLElement(token); - SetInsertionMode(kInCaptionMode); - return; - } - if (token->GetName() == html_names::kColgroupTag) { - tree_.OpenElements()->PopUntilTableScopeMarker(); - tree_.InsertHTMLElement(token); - SetInsertionMode(kInColumnGroupMode); - return; - } - if (token->GetName() == html_names::kColTag) { - ProcessFakeStartTag(html_names::kColgroupTag); - DCHECK(kInColumnGroupMode); - ProcessStartTag(token); - return; - } - if (IsTableBodyContextTag(token->GetName())) { - tree_.OpenElements()->PopUntilTableScopeMarker(); - tree_.InsertHTMLElement(token); - SetInsertionMode(kInTableBodyMode); - return; - } - if (IsTableCellContextTag(token->GetName()) || - token->GetName() == html_names::kTrTag) { - ProcessFakeStartTag(html_names::kTbodyTag); - DCHECK_EQ(GetInsertionMode(), kInTableBodyMode); - ProcessStartTag(token); - return; - } - if (token->GetName() == html_names::kTableTag) { - ParseError(token); - if (!ProcessTableEndTagForInTable()) { - DCHECK(IsParsingFragmentOrTemplateContents()); + switch (token->GetHTMLTag()) { + case HTMLTag::kCaption: + tree_.OpenElements()->PopUntilTableScopeMarker(); + tree_.ActiveFormattingElements()->AppendMarker(); + tree_.InsertHTMLElement(token); + SetInsertionMode(kInCaptionMode); return; - } - ProcessStartTag(token); - return; - } - if (token->GetName() == html_names::kStyleTag || - token->GetName() == html_names::kScriptTag) { - ProcessStartTagForInHead(token); - return; - } - if (token->GetName() == html_names::kInputTag) { - Attribute* type_attribute = token->GetAttributeItem(html_names::kTypeAttr); - if (type_attribute && - EqualIgnoringASCIICase(type_attribute->Value(), "hidden")) { + case HTMLTag::kColgroup: + tree_.OpenElements()->PopUntilTableScopeMarker(); + tree_.InsertHTMLElement(token); + SetInsertionMode(kInColumnGroupMode); + return; + case HTMLTag::kCol: + ProcessFakeStartTag(HTMLTag::kColgroup); + DCHECK(kInColumnGroupMode); + ProcessStartTag(token); + return; + case HTMLTag::kTbody: + case HTMLTag::kTfoot: + case HTMLTag::kThead: + tree_.OpenElements()->PopUntilTableScopeMarker(); + tree_.InsertHTMLElement(token); + SetInsertionMode(kInTableBodyMode); + return; + case HTMLTag::kTd: + case HTMLTag::kTh: + case HTMLTag::kTr: + ProcessFakeStartTag(HTMLTag::kTbody); + DCHECK_EQ(GetInsertionMode(), kInTableBodyMode); + ProcessStartTag(token); + return; + case HTMLTag::kTable: ParseError(token); - tree_.InsertSelfClosingHTMLElementDestroyingToken(token); + if (!ProcessTableEndTagForInTable()) { + DCHECK(IsParsingFragmentOrTemplateContents()); + return; + } + ProcessStartTag(token); return; + case HTMLTag::kStyle: + case HTMLTag::kScript: + ProcessStartTagForInHead(token); + return; + case HTMLTag::kInput: { + Attribute* type_attribute = + token->GetAttributeItem(html_names::kTypeAttr); + if (type_attribute && + EqualIgnoringASCIICase(type_attribute->Value(), "hidden")) { + ParseError(token); + tree_.InsertSelfClosingHTMLElementDestroyingToken(token); + return; + } + // break to hit "anything else" case. + break; } - // Fall through to "anything else" case. - } - if (token->GetName() == html_names::kFormTag) { - ParseError(token); - if (tree_.IsFormElementPointerNonNull() && !IsParsingTemplateContents()) + case HTMLTag::kForm: + ParseError(token); + if (tree_.IsFormElementPointerNonNull() && !IsParsingTemplateContents()) + return; + tree_.InsertHTMLFormElement(token, true); + tree_.OpenElements()->Pop(); return; - tree_.InsertHTMLFormElement(token, true); - tree_.OpenElements()->Pop(); - return; - } - if (token->GetName() == html_names::kTemplateTag) { - ProcessTemplateStartTag(token); - return; + case HTMLTag::kTemplate: + ProcessTemplateStartTag(token); + return; + default: + break; } ParseError(token); HTMLConstructionSite::RedirectToFosterParentGuard redirecter(tree_); @@ -1073,6 +1155,7 @@ void HTMLTreeBuilder::ProcessStartTag(AtomicHTMLToken* token) { DCHECK_EQ(token->GetType(), HTMLToken::kStartTag); + const HTMLTag tag = token->GetHTMLTag(); switch (GetInsertionMode()) { case kInitialMode: DCHECK_EQ(GetInsertionMode(), kInitialMode); @@ -1080,7 +1163,7 @@ [[fallthrough]]; case kBeforeHTMLMode: DCHECK_EQ(GetInsertionMode(), kBeforeHTMLMode); - if (token->GetName() == html_names::kHTMLTag) { + if (tag == HTMLTag::kHTML) { tree_.InsertHTMLHtmlStartTagBeforeHTML(token); SetInsertionMode(kBeforeHeadMode); return; @@ -1089,11 +1172,11 @@ [[fallthrough]]; case kBeforeHeadMode: DCHECK_EQ(GetInsertionMode(), kBeforeHeadMode); - if (token->GetName() == html_names::kHTMLTag) { + if (tag == HTMLTag::kHTML) { ProcessHtmlStartTagForInBody(token); return; } - if (token->GetName() == html_names::kHeadTag) { + if (tag == HTMLTag::kHead) { tree_.InsertHTMLHeadElement(token); SetInsertionMode(kInHeadMode); return; @@ -1108,41 +1191,40 @@ [[fallthrough]]; case kAfterHeadMode: DCHECK_EQ(GetInsertionMode(), kAfterHeadMode); - if (token->GetName() == html_names::kHTMLTag) { - ProcessHtmlStartTagForInBody(token); - return; - } - if (token->GetName() == html_names::kBodyTag) { - frameset_ok_ = false; - tree_.InsertHTMLBodyElement(token); - SetInsertionMode(kInBodyMode); - return; - } - if (token->GetName() == html_names::kFramesetTag) { - tree_.InsertHTMLElement(token); - SetInsertionMode(kInFramesetMode); - return; - } - if (token->GetName() == html_names::kBaseTag || - token->GetName() == html_names::kBasefontTag || - token->GetName() == html_names::kBgsoundTag || - token->GetName() == html_names::kLinkTag || - token->GetName() == html_names::kMetaTag || - token->GetName() == html_names::kNoframesTag || - token->GetName() == html_names::kScriptTag || - token->GetName() == html_names::kStyleTag || - token->GetName() == html_names::kTemplateTag || - token->GetName() == html_names::kTitleTag) { - ParseError(token); - DCHECK(tree_.Head()); - tree_.OpenElements()->PushHTMLHeadElement(tree_.HeadStackItem()); - ProcessStartTagForInHead(token); - tree_.OpenElements()->RemoveHTMLHeadElement(tree_.Head()); - return; - } - if (token->GetName() == html_names::kHeadTag) { - ParseError(token); - return; + switch (tag) { + case HTMLTag::kHTML: + ProcessHtmlStartTagForInBody(token); + return; + case HTMLTag::kBody: + frameset_ok_ = false; + tree_.InsertHTMLBodyElement(token); + SetInsertionMode(kInBodyMode); + return; + case HTMLTag::kFrameset: + tree_.InsertHTMLElement(token); + SetInsertionMode(kInFramesetMode); + return; + case HTMLTag::kBase: + case HTMLTag::kBasefont: + case HTMLTag::kBgsound: + case HTMLTag::kLink: + case HTMLTag::kMeta: + case HTMLTag::kNoframes: + case HTMLTag::kScript: + case HTMLTag::kStyle: + case HTMLTag::kTemplate: + case HTMLTag::kTitle: + ParseError(token); + DCHECK(tree_.Head()); + tree_.OpenElements()->PushHTMLHeadElement(tree_.HeadStackItem()); + ProcessStartTagForInHead(token); + tree_.OpenElements()->RemoveHTMLHeadElement(tree_.Head()); + return; + case HTMLTag::kHead: + ParseError(token); + return; + default: + break; } DefaultForAfterHead(); [[fallthrough]]; @@ -1156,33 +1238,37 @@ break; case kInCaptionMode: DCHECK_EQ(GetInsertionMode(), kInCaptionMode); - if (IsCaptionColOrColgroupTag(token->GetName()) || - IsTableBodyContextTag(token->GetName()) || - IsTableCellContextTag(token->GetName()) || - token->GetName() == html_names::kTrTag) { - ParseError(token); - if (!ProcessCaptionEndTagForInCaption()) { - DCHECK(IsParsingFragment()); + switch (tag) { + case CAPTION_COL_OR_COLGROUP_CASES: + case TABLE_BODY_CONTEXT_CASES: + case TABLE_CELL_CONTEXT_CASES: + case HTMLTag::kTr: + ParseError(token); + if (!ProcessCaptionEndTagForInCaption()) { + DCHECK(IsParsingFragment()); + return; + } + ProcessStartTag(token); return; - } - ProcessStartTag(token); - return; + default: + break; } ProcessStartTagForInBody(token); break; case kInColumnGroupMode: DCHECK_EQ(GetInsertionMode(), kInColumnGroupMode); - if (token->GetName() == html_names::kHTMLTag) { - ProcessHtmlStartTagForInBody(token); - return; - } - if (token->GetName() == html_names::kColTag) { - tree_.InsertSelfClosingHTMLElementDestroyingToken(token); - return; - } - if (token->GetName() == html_names::kTemplateTag) { - ProcessTemplateStartTag(token); - return; + switch (tag) { + case HTMLTag::kHTML: + ProcessHtmlStartTagForInBody(token); + return; + case HTMLTag::kCol: + tree_.InsertSelfClosingHTMLElementDestroyingToken(token); + return; + case HTMLTag::kTemplate: + ProcessTemplateStartTag(token); + return; + default: + break; } if (!ProcessColgroupEndTagForInColumnGroup()) { DCHECK(IsParsingFragmentOrTemplateContents()); @@ -1192,76 +1278,82 @@ break; case kInTableBodyMode: DCHECK_EQ(GetInsertionMode(), kInTableBodyMode); - if (token->GetName() == html_names::kTrTag) { - // How is there ever anything to pop? - tree_.OpenElements()->PopUntilTableBodyScopeMarker(); - tree_.InsertHTMLElement(token); - SetInsertionMode(kInRowMode); - return; - } - if (IsTableCellContextTag(token->GetName())) { - ParseError(token); - ProcessFakeStartTag(html_names::kTrTag); - DCHECK_EQ(GetInsertionMode(), kInRowMode); - ProcessStartTag(token); - return; - } - if (IsCaptionColOrColgroupTag(token->GetName()) || - IsTableBodyContextTag(token->GetName())) { - // FIXME: This is slow. - if (!tree_.OpenElements()->InTableScope(html_names::kTbodyTag) && - !tree_.OpenElements()->InTableScope(html_names::kTheadTag) && - !tree_.OpenElements()->InTableScope(html_names::kTfootTag)) { - DCHECK(IsParsingFragmentOrTemplateContents()); - ParseError(token); + switch (tag) { + case HTMLTag::kTr: + // How is there ever anything to pop? + tree_.OpenElements()->PopUntilTableBodyScopeMarker(); + tree_.InsertHTMLElement(token); + SetInsertionMode(kInRowMode); return; - } - tree_.OpenElements()->PopUntilTableBodyScopeMarker(); - DCHECK(IsTableBodyContextTag(tree_.CurrentStackItem()->LocalName())); - ProcessFakeEndTag(tree_.CurrentStackItem()->LocalName()); - ProcessStartTag(token); - return; + case TABLE_CELL_CONTEXT_CASES: + ParseError(token); + ProcessFakeStartTag(HTMLTag::kTr); + DCHECK_EQ(GetInsertionMode(), kInRowMode); + ProcessStartTag(token); + return; + case CAPTION_COL_OR_COLGROUP_CASES: + case TABLE_BODY_CONTEXT_CASES: + // FIXME: This is slow. + if (!tree_.OpenElements()->InTableScope(HTMLTag::kTbody) && + !tree_.OpenElements()->InTableScope(HTMLTag::kThead) && + !tree_.OpenElements()->InTableScope(HTMLTag::kTfoot)) { + DCHECK(IsParsingFragmentOrTemplateContents()); + ParseError(token); + return; + } + tree_.OpenElements()->PopUntilTableBodyScopeMarker(); + DCHECK(IsTableBodyContextTag(tree_.CurrentStackItem()->GetHTMLTag())); + ProcessFakeEndTag(*tree_.CurrentStackItem()); + ProcessStartTag(token); + return; + default: + break; } ProcessStartTagForInTable(token); break; case kInRowMode: DCHECK_EQ(GetInsertionMode(), kInRowMode); - if (IsTableCellContextTag(token->GetName())) { - tree_.OpenElements()->PopUntilTableRowScopeMarker(); - tree_.InsertHTMLElement(token); - SetInsertionMode(kInCellMode); - tree_.ActiveFormattingElements()->AppendMarker(); - return; - } - if (token->GetName() == html_names::kTrTag || - IsCaptionColOrColgroupTag(token->GetName()) || - IsTableBodyContextTag(token->GetName())) { - if (!ProcessTrEndTagForInRow()) { - DCHECK(IsParsingFragmentOrTemplateContents()); + switch (tag) { + case TABLE_CELL_CONTEXT_CASES: + tree_.OpenElements()->PopUntilTableRowScopeMarker(); + tree_.InsertHTMLElement(token); + SetInsertionMode(kInCellMode); + tree_.ActiveFormattingElements()->AppendMarker(); return; - } - DCHECK_EQ(GetInsertionMode(), kInTableBodyMode); - ProcessStartTag(token); - return; + case HTMLTag::kTr: + case CAPTION_COL_OR_COLGROUP_CASES: + case TABLE_BODY_CONTEXT_CASES: + if (!ProcessTrEndTagForInRow()) { + DCHECK(IsParsingFragmentOrTemplateContents()); + return; + } + DCHECK_EQ(GetInsertionMode(), kInTableBodyMode); + ProcessStartTag(token); + return; + default: + break; } ProcessStartTagForInTable(token); break; case kInCellMode: DCHECK_EQ(GetInsertionMode(), kInCellMode); - if (IsCaptionColOrColgroupTag(token->GetName()) || - IsTableCellContextTag(token->GetName()) || - token->GetName() == html_names::kTrTag || - IsTableBodyContextTag(token->GetName())) { - // FIXME: This could be more efficient. - if (!tree_.OpenElements()->InTableScope(html_names::kTdTag) && - !tree_.OpenElements()->InTableScope(html_names::kThTag)) { - DCHECK(IsParsingFragment()); - ParseError(token); + switch (tag) { + case CAPTION_COL_OR_COLGROUP_CASES: + case TABLE_CELL_CONTEXT_CASES: + case HTMLTag::kTr: + case TABLE_BODY_CONTEXT_CASES: + // FIXME: This could be more efficient. + if (!tree_.OpenElements()->InTableScope(HTMLTag::kTd) && + !tree_.OpenElements()->InTableScope(HTMLTag::kTh)) { + DCHECK(IsParsingFragment()); + ParseError(token); + return; + } + CloseTheCell(); + ProcessStartTag(token); return; - } - CloseTheCell(); - ProcessStartTag(token); - return; + default: + break; } ProcessStartTagForInBody(token); break; @@ -1269,7 +1361,7 @@ case kAfterAfterBodyMode: DCHECK(GetInsertionMode() == kAfterBodyMode || GetInsertionMode() == kAfterAfterBodyMode); - if (token->GetName() == html_names::kHTMLTag) { + if (tag == HTMLTag::kHTML) { ProcessHtmlStartTagForInBody(token); return; } @@ -1278,45 +1370,46 @@ break; case kInHeadNoscriptMode: DCHECK_EQ(GetInsertionMode(), kInHeadNoscriptMode); - if (token->GetName() == html_names::kHTMLTag) { - ProcessHtmlStartTagForInBody(token); - return; - } - if (token->GetName() == html_names::kBasefontTag || - token->GetName() == html_names::kBgsoundTag || - token->GetName() == html_names::kLinkTag || - token->GetName() == html_names::kMetaTag || - token->GetName() == html_names::kNoframesTag || - token->GetName() == html_names::kStyleTag) { - bool did_process = ProcessStartTagForInHead(token); - DCHECK(did_process); - return; - } - if (token->GetName() == html_names::kHTMLTag || - token->GetName() == html_names::kNoscriptTag) { - ParseError(token); - return; + switch (tag) { + case HTMLTag::kHTML: + ProcessHtmlStartTagForInBody(token); + return; + case HTMLTag::kBasefont: + case HTMLTag::kBgsound: + case HTMLTag::kLink: + case HTMLTag::kMeta: + case HTMLTag::kNoframes: + case HTMLTag::kStyle: { + bool did_process = ProcessStartTagForInHead(token); + DCHECK(did_process); + return; + } + case HTMLTag::kNoscript: + ParseError(token); + return; + default: + break; } DefaultForInHeadNoscript(); ProcessToken(token); break; case kInFramesetMode: DCHECK_EQ(GetInsertionMode(), kInFramesetMode); - if (token->GetName() == html_names::kHTMLTag) { - ProcessHtmlStartTagForInBody(token); - return; - } - if (token->GetName() == html_names::kFramesetTag) { - tree_.InsertHTMLElement(token); - return; - } - if (token->GetName() == html_names::kFrameTag) { - tree_.InsertSelfClosingHTMLElementDestroyingToken(token); - return; - } - if (token->GetName() == html_names::kNoframesTag) { - ProcessStartTagForInHead(token); - return; + switch (tag) { + case HTMLTag::kHTML: + ProcessHtmlStartTagForInBody(token); + return; + case HTMLTag::kFrameset: + tree_.InsertHTMLElement(token); + return; + case HTMLTag::kFrame: + tree_.InsertSelfClosingHTMLElementDestroyingToken(token); + return; + case HTMLTag::kNoframes: + ProcessStartTagForInHead(token); + return; + default: + break; } ParseError(token); break; @@ -1324,11 +1417,11 @@ case kAfterAfterFramesetMode: DCHECK(GetInsertionMode() == kAfterFramesetMode || GetInsertionMode() == kAfterAfterFramesetMode); - if (token->GetName() == html_names::kHTMLTag) { + if (tag == HTMLTag::kHTML) { ProcessHtmlStartTagForInBody(token); return; } - if (token->GetName() == html_names::kNoframesTag) { + if (tag == HTMLTag::kNoframes) { ProcessStartTagForInHead(token); return; } @@ -1336,78 +1429,77 @@ break; case kInSelectInTableMode: DCHECK_EQ(GetInsertionMode(), kInSelectInTableMode); - if (token->GetName() == html_names::kCaptionTag || - token->GetName() == html_names::kTableTag || - IsTableBodyContextTag(token->GetName()) || - token->GetName() == html_names::kTrTag || - IsTableCellContextTag(token->GetName())) { - ParseError(token); - AtomicHTMLToken end_select(HTMLToken::kEndTag, - html_names::kSelectTag.LocalName()); - ProcessEndTag(&end_select); - ProcessStartTag(token); - return; + switch (tag) { + case HTMLTag::kCaption: + case HTMLTag::kTable: + case TABLE_BODY_CONTEXT_CASES: + case HTMLTag::kTr: + case TABLE_CELL_CONTEXT_CASES: { + ParseError(token); + AtomicHTMLToken end_select(HTMLToken::kEndTag, HTMLTag::kSelect); + ProcessEndTag(&end_select); + ProcessStartTag(token); + return; + } + default: + break; } [[fallthrough]]; case kInSelectMode: DCHECK(GetInsertionMode() == kInSelectMode || GetInsertionMode() == kInSelectInTableMode); - if (token->GetName() == html_names::kHTMLTag) { - ProcessHtmlStartTagForInBody(token); - return; - } - if (token->GetName() == html_names::kOptionTag) { - if (tree_.CurrentStackItem()->HasTagName(html_names::kOptionTag)) { - AtomicHTMLToken end_option(HTMLToken::kEndTag, - html_names::kOptionTag.LocalName()); - ProcessEndTag(&end_option); - } - tree_.InsertHTMLElement(token); - return; - } - if (token->GetName() == html_names::kOptgroupTag) { - if (tree_.CurrentStackItem()->HasTagName(html_names::kOptionTag)) { - AtomicHTMLToken end_option(HTMLToken::kEndTag, - html_names::kOptionTag.LocalName()); - ProcessEndTag(&end_option); - } - if (tree_.CurrentStackItem()->HasTagName(html_names::kOptgroupTag)) { - AtomicHTMLToken end_optgroup(HTMLToken::kEndTag, - html_names::kOptgroupTag.LocalName()); - ProcessEndTag(&end_optgroup); - } - tree_.InsertHTMLElement(token); - return; - } - if (token->GetName() == html_names::kSelectTag) { - ParseError(token); - AtomicHTMLToken end_select(HTMLToken::kEndTag, - html_names::kSelectTag.LocalName()); - ProcessEndTag(&end_select); - return; - } - if (token->GetName() == html_names::kInputTag || - token->GetName() == html_names::kKeygenTag || - token->GetName() == html_names::kTextareaTag) { - ParseError(token); - if (!tree_.OpenElements()->InSelectScope(html_names::kSelectTag)) { - DCHECK(IsParsingFragment()); + switch (tag) { + case HTMLTag::kHTML: + ProcessHtmlStartTagForInBody(token); + return; + case HTMLTag::kOption: + if (tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kOption)) { + AtomicHTMLToken end_option(HTMLToken::kEndTag, HTMLTag::kOption); + ProcessEndTag(&end_option); + } + tree_.InsertHTMLElement(token); + return; + case HTMLTag::kOptgroup: + if (tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kOption)) { + AtomicHTMLToken end_option(HTMLToken::kEndTag, HTMLTag::kOption); + ProcessEndTag(&end_option); + } + if (tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kOptgroup)) { + AtomicHTMLToken end_optgroup(HTMLToken::kEndTag, + HTMLTag::kOptgroup); + ProcessEndTag(&end_optgroup); + } + tree_.InsertHTMLElement(token); + return; + case HTMLTag::kSelect: { + ParseError(token); + AtomicHTMLToken end_select(HTMLToken::kEndTag, HTMLTag::kSelect); + ProcessEndTag(&end_select); return; } - AtomicHTMLToken end_select(HTMLToken::kEndTag, - html_names::kSelectTag.LocalName()); - ProcessEndTag(&end_select); - ProcessStartTag(token); - return; - } - if (token->GetName() == html_names::kScriptTag) { - bool did_process = ProcessStartTagForInHead(token); - DCHECK(did_process); - return; - } - if (token->GetName() == html_names::kTemplateTag) { - ProcessTemplateStartTag(token); - return; + case HTMLTag::kInput: + case HTMLTag::kKeygen: + case HTMLTag::kTextarea: { + ParseError(token); + if (!tree_.OpenElements()->InSelectScope(HTMLTag::kSelect)) { + DCHECK(IsParsingFragment()); + return; + } + AtomicHTMLToken end_select(HTMLToken::kEndTag, HTMLTag::kSelect); + ProcessEndTag(&end_select); + ProcessStartTag(token); + return; + } + case HTMLTag::kScript: { + bool did_process = ProcessStartTagForInHead(token); + DCHECK(did_process); + return; + } + case HTMLTag::kTemplate: + ProcessTemplateStartTag(token); + return; + default: + break; } break; case kInTableTextMode: @@ -1418,31 +1510,40 @@ NOTREACHED(); break; case kTemplateContentsMode: - if (token->GetName() == html_names::kTemplateTag) { - ProcessTemplateStartTag(token); - return; - } - - if (token->GetName() == html_names::kLinkTag || - token->GetName() == html_names::kScriptTag || - token->GetName() == html_names::kStyleTag || - token->GetName() == html_names::kMetaTag) { - ProcessStartTagForInHead(token); - return; + switch (tag) { + case HTMLTag::kTemplate: + ProcessTemplateStartTag(token); + return; + case HTMLTag::kLink: + case HTMLTag::kScript: + case HTMLTag::kStyle: + case HTMLTag::kMeta: + ProcessStartTagForInHead(token); + return; + default: + break; } InsertionMode insertion_mode = kTemplateContentsMode; - if (token->GetName() == html_names::kColTag) - insertion_mode = kInColumnGroupMode; - else if (IsCaptionColOrColgroupTag(token->GetName()) || - IsTableBodyContextTag(token->GetName())) - insertion_mode = kInTableMode; - else if (token->GetName() == html_names::kTrTag) - insertion_mode = kInTableBodyMode; - else if (IsTableCellContextTag(token->GetName())) - insertion_mode = kInRowMode; - else - insertion_mode = kInBodyMode; + switch (tag) { + case HTMLTag::kCol: + insertion_mode = kInColumnGroupMode; + break; + case HTMLTag::kCaption: + case HTMLTag::kColgroup: + case TABLE_BODY_CONTEXT_CASES: + insertion_mode = kInTableMode; + break; + case HTMLTag::kTr: + insertion_mode = kInTableBodyMode; + break; + case TABLE_CELL_CONTEXT_CASES: + insertion_mode = kInRowMode; + break; + default: + insertion_mode = kInBodyMode; + break; + } DCHECK_NE(insertion_mode, kTemplateContentsMode); DCHECK_EQ(template_insertion_modes_.back(), kTemplateContentsMode); @@ -1465,8 +1566,8 @@ bool HTMLTreeBuilder::ProcessBodyEndTagForInBody(AtomicHTMLToken* token) { DCHECK_EQ(token->GetType(), HTMLToken::kEndTag); - DCHECK(token->GetName() == html_names::kBodyTag); - if (!tree_.OpenElements()->InScope(html_names::kBodyTag.LocalName())) { + DCHECK_EQ(token->GetHTMLTag(), HTMLTag::kBody); + if (!tree_.OpenElements()->InScope(HTMLTag::kBody)) { ParseError(token); return false; } @@ -1481,9 +1582,9 @@ HTMLElementStack::ElementRecord* record = tree_.OpenElements()->TopRecord(); while (true) { HTMLStackItem* item = record->StackItem(); - if (item->MatchesHTMLTag(token->GetName())) { + if (item->MatchesHTMLTag(token->GetTokenName())) { tree_.GenerateImpliedEndTagsWithExclusion(token->GetTokenName()); - if (!tree_.CurrentStackItem()->MatchesHTMLTag(token->GetName())) + if (!tree_.CurrentStackItem()->MatchesHTMLTag(token->GetTokenName())) ParseError(token); tree_.OpenElements()->PopUntilPopped(item->GetElement()); return; @@ -1518,6 +1619,9 @@ // 1, 2, 3 and 16 are covered by the for() loop. for (int i = 0; i < kOuterIterationLimit; ++i) { // 4. + // ClosestElementInScopeWithName() returns null for non-html tags. + if (!token->IsValidHTMLTag()) + return ProcessAnyOtherEndTagForInBody(token); Element* formatting_element = tree_.ActiveFormattingElements()->ClosestElementInScopeWithName( token->GetName()); @@ -1628,53 +1732,55 @@ if (IsParsingFragment()) item = fragment_context_.ContextElementStackItem(); } - if (item->HasTagName(html_names::kTemplateTag)) - return SetInsertionMode(template_insertion_modes_.back()); - if (item->HasTagName(html_names::kSelectTag)) { - if (!last) { - while (item->GetNode() != tree_.OpenElements()->RootNode() && - !item->HasTagName(html_names::kTemplateTag)) { - node_record = node_record->Next(); - item = node_record->StackItem(); - if (item->HasTagName(html_names::kTableTag)) - return SetInsertionMode(kInSelectInTableMode); - } - } - return SetInsertionMode(kInSelectMode); - } - if (item->HasTagName(html_names::kTdTag) || - item->HasTagName(html_names::kThTag)) - return SetInsertionMode(kInCellMode); - if (item->HasTagName(html_names::kTrTag)) - return SetInsertionMode(kInRowMode); - if (item->HasTagName(html_names::kTbodyTag) || - item->HasTagName(html_names::kTheadTag) || - item->HasTagName(html_names::kTfootTag)) - return SetInsertionMode(kInTableBodyMode); - if (item->HasTagName(html_names::kCaptionTag)) - return SetInsertionMode(kInCaptionMode); - if (item->HasTagName(html_names::kColgroupTag)) { - return SetInsertionMode(kInColumnGroupMode); - } - if (item->HasTagName(html_names::kTableTag)) - return SetInsertionMode(kInTableMode); - if (item->HasTagName(html_names::kHeadTag)) { - if (!fragment_context_.Fragment() || - fragment_context_.ContextElement() != item->GetNode()) - return SetInsertionMode(kInHeadMode); - return SetInsertionMode(kInBodyMode); - } - if (item->HasTagName(html_names::kBodyTag)) - return SetInsertionMode(kInBodyMode); - if (item->HasTagName(html_names::kFramesetTag)) { - return SetInsertionMode(kInFramesetMode); - } - if (item->HasTagName(html_names::kHTMLTag)) { - if (tree_.HeadStackItem()) - return SetInsertionMode(kAfterHeadMode); + const HTMLTag tag = item->GetHTMLTag(); + if (item->IsHTMLNamespace()) { + switch (tag) { + case HTMLTag::kTemplate: + return SetInsertionMode(template_insertion_modes_.back()); + case HTMLTag::kSelect: + if (!last) { + while (item->GetNode() != tree_.OpenElements()->RootNode() && + !item->MatchesHTMLTag(HTMLTag::kTemplate)) { + node_record = node_record->Next(); + item = node_record->StackItem(); + if (item->MatchesHTMLTag(HTMLTag::kTable)) + return SetInsertionMode(kInSelectInTableMode); + } + } + return SetInsertionMode(kInSelectMode); + case HTMLTag::kTd: + case HTMLTag::kTh: + return SetInsertionMode(kInCellMode); + case HTMLTag::kTr: + return SetInsertionMode(kInRowMode); + case HTMLTag::kTbody: + case HTMLTag::kThead: + case HTMLTag::kTfoot: + return SetInsertionMode(kInTableBodyMode); + case HTMLTag::kCaption: + return SetInsertionMode(kInCaptionMode); + case HTMLTag::kColgroup: + return SetInsertionMode(kInColumnGroupMode); + case HTMLTag::kTable: + return SetInsertionMode(kInTableMode); + case HTMLTag::kHead: + if (!fragment_context_.Fragment() || + fragment_context_.ContextElement() != item->GetNode()) + return SetInsertionMode(kInHeadMode); + return SetInsertionMode(kInBodyMode); + case HTMLTag::kBody: + return SetInsertionMode(kInBodyMode); + case HTMLTag::kFrameset: + return SetInsertionMode(kInFramesetMode); + case HTMLTag::kHTML: + if (tree_.HeadStackItem()) + return SetInsertionMode(kAfterHeadMode); - DCHECK(IsParsingFragment()); - return SetInsertionMode(kBeforeHeadMode); + DCHECK(IsParsingFragment()); + return SetInsertionMode(kBeforeHeadMode); + default: + break; + } } if (last) { DCHECK(IsParsingFragment()); @@ -1686,310 +1792,328 @@ void HTMLTreeBuilder::ProcessEndTagForInTableBody(AtomicHTMLToken* token) { DCHECK_EQ(token->GetType(), HTMLToken::kEndTag); - if (IsTableBodyContextTag(token->GetName())) { - if (!tree_.OpenElements()->InTableScope(token->GetName())) { + const HTMLTag tag = token->GetHTMLTag(); + switch (tag) { + case TABLE_BODY_CONTEXT_CASES: + if (!tree_.OpenElements()->InTableScope(tag)) { + ParseError(token); + return; + } + tree_.OpenElements()->PopUntilTableBodyScopeMarker(); + tree_.OpenElements()->Pop(); + SetInsertionMode(kInTableMode); + return; + case HTMLTag::kTable: + // FIXME: This is slow. + if (!tree_.OpenElements()->InTableScope(HTMLTag::kTbody) && + !tree_.OpenElements()->InTableScope(HTMLTag::kThead) && + !tree_.OpenElements()->InTableScope(HTMLTag::kTfoot)) { + DCHECK(IsParsingFragmentOrTemplateContents()); + ParseError(token); + return; + } + tree_.OpenElements()->PopUntilTableBodyScopeMarker(); + DCHECK(IsTableBodyContextTag(tree_.CurrentStackItem()->GetHTMLTag())); + ProcessFakeEndTag(*tree_.CurrentStackItem()); + ProcessEndTag(token); + return; + case HTMLTag::kBody: + case CAPTION_COL_OR_COLGROUP_CASES: + case HTMLTag::kHTML: + case TABLE_CELL_CONTEXT_CASES: + case HTMLTag::kTr: ParseError(token); return; - } - tree_.OpenElements()->PopUntilTableBodyScopeMarker(); - tree_.OpenElements()->Pop(); - SetInsertionMode(kInTableMode); - return; - } - if (token->GetName() == html_names::kTableTag) { - // FIXME: This is slow. - if (!tree_.OpenElements()->InTableScope(html_names::kTbodyTag) && - !tree_.OpenElements()->InTableScope(html_names::kTheadTag) && - !tree_.OpenElements()->InTableScope(html_names::kTfootTag)) { - DCHECK(IsParsingFragmentOrTemplateContents()); - ParseError(token); - return; - } - tree_.OpenElements()->PopUntilTableBodyScopeMarker(); - DCHECK(IsTableBodyContextTag(tree_.CurrentStackItem()->LocalName())); - ProcessFakeEndTag(tree_.CurrentStackItem()->LocalName()); - ProcessEndTag(token); - return; - } - if (token->GetName() == html_names::kBodyTag || - IsCaptionColOrColgroupTag(token->GetName()) || - token->GetName() == html_names::kHTMLTag || - IsTableCellContextTag(token->GetName()) || - token->GetName() == html_names::kTrTag) { - ParseError(token); - return; + default: + break; } ProcessEndTagForInTable(token); } void HTMLTreeBuilder::ProcessEndTagForInRow(AtomicHTMLToken* token) { DCHECK_EQ(token->GetType(), HTMLToken::kEndTag); - if (token->GetName() == html_names::kTrTag) { - ProcessTrEndTagForInRow(); - return; - } - if (token->GetName() == html_names::kTableTag) { - if (!ProcessTrEndTagForInRow()) { - DCHECK(IsParsingFragmentOrTemplateContents()); + const HTMLTag tag = token->GetHTMLTag(); + switch (tag) { + case HTMLTag::kTr: + ProcessTrEndTagForInRow(); return; - } - DCHECK_EQ(GetInsertionMode(), kInTableBodyMode); - ProcessEndTag(token); - return; - } - if (IsTableBodyContextTag(token->GetName())) { - if (!tree_.OpenElements()->InTableScope(token->GetName())) { + case HTMLTag::kTable: + if (!ProcessTrEndTagForInRow()) { + DCHECK(IsParsingFragmentOrTemplateContents()); + return; + } + DCHECK_EQ(GetInsertionMode(), kInTableBodyMode); + ProcessEndTag(token); + return; + case TABLE_BODY_CONTEXT_CASES: + if (!tree_.OpenElements()->InTableScope(tag)) { + ParseError(token); + return; + } + ProcessFakeEndTag(HTMLTag::kTr); + DCHECK_EQ(GetInsertionMode(), kInTableBodyMode); + ProcessEndTag(token); + return; + case HTMLTag::kBody: + case CAPTION_COL_OR_COLGROUP_CASES: + case HTMLTag::kHTML: + case TABLE_CELL_CONTEXT_CASES: ParseError(token); return; - } - ProcessFakeEndTag(html_names::kTrTag); - DCHECK_EQ(GetInsertionMode(), kInTableBodyMode); - ProcessEndTag(token); - return; - } - if (token->GetName() == html_names::kBodyTag || - IsCaptionColOrColgroupTag(token->GetName()) || - token->GetName() == html_names::kHTMLTag || - IsTableCellContextTag(token->GetName())) { - ParseError(token); - return; + default: + break; } ProcessEndTagForInTable(token); } void HTMLTreeBuilder::ProcessEndTagForInCell(AtomicHTMLToken* token) { DCHECK_EQ(token->GetType(), HTMLToken::kEndTag); - if (IsTableCellContextTag(token->GetName())) { - if (!tree_.OpenElements()->InTableScope(token->GetName())) { + const HTMLTag tag = token->GetHTMLTag(); + switch (tag) { + case TABLE_CELL_CONTEXT_CASES: + if (!tree_.OpenElements()->InTableScope(tag)) { + ParseError(token); + return; + } + tree_.GenerateImpliedEndTags(); + if (!tree_.CurrentStackItem()->MatchesHTMLTag(tag)) + ParseError(token); + tree_.OpenElements()->PopUntilPopped(tag); + tree_.ActiveFormattingElements()->ClearToLastMarker(); + SetInsertionMode(kInRowMode); + return; + case HTMLTag::kBody: + case CAPTION_COL_OR_COLGROUP_CASES: + case HTMLTag::kHTML: ParseError(token); return; - } - tree_.GenerateImpliedEndTags(); - if (!tree_.CurrentStackItem()->MatchesHTMLTag(token->GetName())) - ParseError(token); - tree_.OpenElements()->PopUntilPopped(token->GetName()); - tree_.ActiveFormattingElements()->ClearToLastMarker(); - SetInsertionMode(kInRowMode); - return; - } - if (token->GetName() == html_names::kBodyTag || - IsCaptionColOrColgroupTag(token->GetName()) || - token->GetName() == html_names::kHTMLTag) { - ParseError(token); - return; - } - if (token->GetName() == html_names::kTableTag || - token->GetName() == html_names::kTrTag || - IsTableBodyContextTag(token->GetName())) { - if (!tree_.OpenElements()->InTableScope(token->GetName())) { - DCHECK(IsTableBodyContextTag(token->GetName()) || - tree_.OpenElements()->InTableScope(html_names::kTemplateTag) || - IsParsingFragment()); - ParseError(token); + case HTMLTag::kTable: + case HTMLTag::kTr: + case TABLE_BODY_CONTEXT_CASES: + if (!tree_.OpenElements()->InTableScope(tag)) { + DCHECK(IsTableBodyContextTag(tag) || + tree_.OpenElements()->InTableScope(HTMLTag::kTemplate) || + IsParsingFragment()); + ParseError(token); + return; + } + CloseTheCell(); + ProcessEndTag(token); return; - } - CloseTheCell(); - ProcessEndTag(token); - return; + default: + break; } ProcessEndTagForInBody(token); } void HTMLTreeBuilder::ProcessEndTagForInBody(AtomicHTMLToken* token) { DCHECK_EQ(token->GetType(), HTMLToken::kEndTag); - if (token->GetName() == html_names::kBodyTag) { - ProcessBodyEndTagForInBody(token); - return; - } - if (token->GetName() == html_names::kHTMLTag) { - AtomicHTMLToken end_body(HTMLToken::kEndTag, - html_names::kBodyTag.LocalName()); - if (ProcessBodyEndTagForInBody(&end_body)) - ProcessEndTag(token); - return; - } - // Spec: - // https://html.spec.whatwg.org/multipage/parsing.html#:~:text=An%20end%20tag%20whose%20tag%20name%20is%20one%20of%3A%20%22address%22%2C - if (token->GetName() == html_names::kAddressTag || - token->GetName() == html_names::kArticleTag || - token->GetName() == html_names::kAsideTag || - token->GetName() == html_names::kBlockquoteTag || - token->GetName() == html_names::kButtonTag || - token->GetName() == html_names::kCenterTag || - token->GetName() == html_names::kDetailsTag || - token->GetName() == html_names::kDialogTag || - token->GetName() == html_names::kDirTag || - token->GetName() == html_names::kDivTag || - token->GetName() == html_names::kDlTag || - token->GetName() == html_names::kFieldsetTag || - token->GetName() == html_names::kFigcaptionTag || - token->GetName() == html_names::kFigureTag || - token->GetName() == html_names::kFooterTag || - token->GetName() == html_names::kHeaderTag || - token->GetName() == html_names::kHgroupTag || - token->GetName() == html_names::kListingTag || - token->GetName() == html_names::kMainTag || - token->GetName() == html_names::kMenuTag || - token->GetName() == html_names::kNavTag || - token->GetName() == html_names::kOlTag || - token->GetName() == html_names::kPreTag || - token->GetName() == html_names::kSectionTag || - token->GetName() == html_names::kSummaryTag || - token->GetName() == html_names::kUlTag) { - if (!tree_.OpenElements()->InScope(token->GetName())) { - ParseError(token); + const HTMLTag tag = token->GetHTMLTag(); + switch (tag) { + case HTMLTag::kBody: + ProcessBodyEndTagForInBody(token); + return; + case HTMLTag::kHTML: { + AtomicHTMLToken end_body(HTMLToken::kEndTag, HTMLTag::kBody); + if (ProcessBodyEndTagForInBody(&end_body)) + ProcessEndTag(token); return; } - tree_.GenerateImpliedEndTags(); - if (!tree_.CurrentStackItem()->MatchesHTMLTag(token->GetName())) - ParseError(token); - tree_.OpenElements()->PopUntilPopped(token->GetName()); - return; - } - if (token->GetName() == html_names::kFormTag && - !IsParsingTemplateContents()) { - Element* node = tree_.TakeForm(); - if (!node || !tree_.OpenElements()->InScope(node)) { - ParseError(token); + // https://html.spec.whatwg.org/multipage/parsing.html#:~:text=An%20end%20tag%20whose%20tag%20name%20is%20one%20of%3A%20%22address%22%2C + case HTMLTag::kAddress: + case HTMLTag::kArticle: + case HTMLTag::kAside: + case HTMLTag::kBlockquote: + case HTMLTag::kButton: + case HTMLTag::kCenter: + case HTMLTag::kDetails: + case HTMLTag::kDialog: + case HTMLTag::kDir: + case HTMLTag::kDiv: + case HTMLTag::kDl: + case HTMLTag::kFieldset: + case HTMLTag::kFigcaption: + case HTMLTag::kFigure: + case HTMLTag::kFooter: + case HTMLTag::kHeader: + case HTMLTag::kHgroup: + case HTMLTag::kListing: + case HTMLTag::kMain: + case HTMLTag::kMenu: + case HTMLTag::kNav: + case HTMLTag::kOl: + case HTMLTag::kPre: + case HTMLTag::kSection: + case HTMLTag::kSummary: + case HTMLTag::kUl: + if (!tree_.OpenElements()->InScope(tag)) { + ParseError(token); + return; + } + tree_.GenerateImpliedEndTags(); + if (!tree_.CurrentStackItem()->MatchesHTMLTag(tag)) + ParseError(token); + tree_.OpenElements()->PopUntilPopped(tag); return; - } - tree_.GenerateImpliedEndTags(); - if (tree_.CurrentElement() != node) - ParseError(token); - tree_.OpenElements()->Remove(node); - } - if (token->GetName() == html_names::kPTag) { - if (!tree_.OpenElements()->InButtonScope(token->GetName())) { - ParseError(token); - ProcessFakeStartTag(html_names::kPTag); - DCHECK(tree_.OpenElements()->InScope(token->GetName())); - ProcessEndTag(token); + case HTMLTag::kForm: + if (!IsParsingTemplateContents()) { + Element* node = tree_.TakeForm(); + if (!node || !tree_.OpenElements()->InScope(node)) { + ParseError(token); + return; + } + tree_.GenerateImpliedEndTags(); + if (tree_.CurrentElement() != node) + ParseError(token); + tree_.OpenElements()->Remove(node); + } + break; + case HTMLTag::kP: + if (!tree_.OpenElements()->InButtonScope(tag)) { + ParseError(token); + ProcessFakeStartTag(HTMLTag::kP); + DCHECK(tree_.OpenElements()->InScope(tag)); + ProcessEndTag(token); + return; + } + tree_.GenerateImpliedEndTagsWithExclusion(token->GetTokenName()); + if (!tree_.CurrentStackItem()->MatchesHTMLTag(tag)) + ParseError(token); + tree_.OpenElements()->PopUntilPopped(tag); return; - } - tree_.GenerateImpliedEndTagsWithExclusion(token->GetTokenName()); - if (!tree_.CurrentStackItem()->MatchesHTMLTag(token->GetName())) - ParseError(token); - tree_.OpenElements()->PopUntilPopped(token->GetName()); - return; - } - if (token->GetName() == html_names::kLiTag) { - if (!tree_.OpenElements()->InListItemScope(token->GetName())) { - ParseError(token); + case HTMLTag::kLi: + if (!tree_.OpenElements()->InListItemScope(tag)) { + ParseError(token); + return; + } + tree_.GenerateImpliedEndTagsWithExclusion(token->GetTokenName()); + if (!tree_.CurrentStackItem()->MatchesHTMLTag(tag)) + ParseError(token); + tree_.OpenElements()->PopUntilPopped(tag); return; - } - tree_.GenerateImpliedEndTagsWithExclusion(token->GetTokenName()); - if (!tree_.CurrentStackItem()->MatchesHTMLTag(token->GetName())) - ParseError(token); - tree_.OpenElements()->PopUntilPopped(token->GetName()); - return; - } - if (token->GetName() == html_names::kDdTag || - token->GetName() == html_names::kDtTag) { - if (!tree_.OpenElements()->InScope(token->GetName())) { - ParseError(token); + case HTMLTag::kDd: + case HTMLTag::kDt: + if (!tree_.OpenElements()->InScope(tag)) { + ParseError(token); + return; + } + tree_.GenerateImpliedEndTagsWithExclusion(token->GetTokenName()); + if (!tree_.CurrentStackItem()->MatchesHTMLTag(tag)) + ParseError(token); + tree_.OpenElements()->PopUntilPopped(tag); return; - } - tree_.GenerateImpliedEndTagsWithExclusion(token->GetTokenName()); - if (!tree_.CurrentStackItem()->MatchesHTMLTag(token->GetName())) - ParseError(token); - tree_.OpenElements()->PopUntilPopped(token->GetName()); - return; - } - if (IsNumberedHeaderTag(token->GetName())) { - if (!tree_.OpenElements()->HasNumberedHeaderElementInScope()) { - ParseError(token); + case HTMLTag::kH1: + case HTMLTag::kH2: + case HTMLTag::kH3: + case HTMLTag::kH4: + case HTMLTag::kH5: + case HTMLTag::kH6: + if (!tree_.OpenElements()->HasNumberedHeaderElementInScope()) { + ParseError(token); + return; + } + tree_.GenerateImpliedEndTags(); + if (!tree_.CurrentStackItem()->MatchesHTMLTag(tag)) + ParseError(token); + tree_.OpenElements()->PopUntilNumberedHeaderElementPopped(); return; - } - tree_.GenerateImpliedEndTags(); - if (!tree_.CurrentStackItem()->MatchesHTMLTag(token->GetName())) - ParseError(token); - tree_.OpenElements()->PopUntilNumberedHeaderElementPopped(); - return; - } - if (IsFormattingTag(token->GetName())) { - CallTheAdoptionAgency(token); - return; - } - if (token->GetName() == html_names::kAppletTag || - token->GetName() == html_names::kMarqueeTag || - token->GetName() == html_names::kObjectTag) { - if (!tree_.OpenElements()->InScope(token->GetName())) { - ParseError(token); + case HTMLTag::kA: + case HTMLTag::kNobr: + case HTMLTag::kB: + case HTMLTag::kBig: + case HTMLTag::kCode: + case HTMLTag::kEm: + case HTMLTag::kFont: + case HTMLTag::kI: + case HTMLTag::kS: + case HTMLTag::kSmall: + case HTMLTag::kStrike: + case HTMLTag::kStrong: + case HTMLTag::kTt: + case HTMLTag::kU: + CallTheAdoptionAgency(token); return; - } - tree_.GenerateImpliedEndTags(); - if (!tree_.CurrentStackItem()->MatchesHTMLTag(token->GetName())) + case HTMLTag::kApplet: + case HTMLTag::kMarquee: + case HTMLTag::kObject: + if (!tree_.OpenElements()->InScope(tag)) { + ParseError(token); + return; + } + tree_.GenerateImpliedEndTags(); + if (!tree_.CurrentStackItem()->MatchesHTMLTag(tag)) + ParseError(token); + tree_.OpenElements()->PopUntilPopped(tag); + tree_.ActiveFormattingElements()->ClearToLastMarker(); + return; + case HTMLTag::kBr: ParseError(token); - tree_.OpenElements()->PopUntilPopped(token->GetName()); - tree_.ActiveFormattingElements()->ClearToLastMarker(); - return; - } - if (token->GetName() == html_names::kBrTag) { - ParseError(token); - ProcessFakeStartTag(html_names::kBrTag); - return; - } - if (token->GetName() == html_names::kTemplateTag) { - ProcessTemplateEndTag(token); - return; + ProcessFakeStartTag(HTMLTag::kBr); + return; + case HTMLTag::kTemplate: + ProcessTemplateEndTag(token); + return; + default: + break; } ProcessAnyOtherEndTagForInBody(token); } bool HTMLTreeBuilder::ProcessCaptionEndTagForInCaption() { - if (!tree_.OpenElements()->InTableScope( - html_names::kCaptionTag.LocalName())) { + if (!tree_.OpenElements()->InTableScope(HTMLTag::kCaption)) { DCHECK(IsParsingFragment()); // FIXME: parse error return false; } tree_.GenerateImpliedEndTags(); // FIXME: parse error if - // (!tree_.CurrentStackItem()->HasTagName(html_names::kCaptionTag)) - tree_.OpenElements()->PopUntilPopped(html_names::kCaptionTag.LocalName()); + // (!tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kCaption)) + tree_.OpenElements()->PopUntilPopped(HTMLTag::kCaption); tree_.ActiveFormattingElements()->ClearToLastMarker(); SetInsertionMode(kInTableMode); return true; } bool HTMLTreeBuilder::ProcessTrEndTagForInRow() { - if (!tree_.OpenElements()->InTableScope(html_names::kTrTag)) { + if (!tree_.OpenElements()->InTableScope(HTMLTag::kTr)) { DCHECK(IsParsingFragmentOrTemplateContents()); // FIXME: parse error return false; } tree_.OpenElements()->PopUntilTableRowScopeMarker(); - DCHECK(tree_.CurrentStackItem()->HasTagName(html_names::kTrTag)); + DCHECK(tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kTr)); tree_.OpenElements()->Pop(); SetInsertionMode(kInTableBodyMode); return true; } bool HTMLTreeBuilder::ProcessTableEndTagForInTable() { - if (!tree_.OpenElements()->InTableScope(html_names::kTableTag)) { + if (!tree_.OpenElements()->InTableScope(HTMLTag::kTable)) { DCHECK(IsParsingFragmentOrTemplateContents()); // FIXME: parse error. return false; } - tree_.OpenElements()->PopUntilPopped(html_names::kTableTag.LocalName()); + tree_.OpenElements()->PopUntilPopped(HTMLTag::kTable); ResetInsertionModeAppropriately(); return true; } void HTMLTreeBuilder::ProcessEndTagForInTable(AtomicHTMLToken* token) { DCHECK_EQ(token->GetType(), HTMLToken::kEndTag); - if (token->GetName() == html_names::kTableTag) { - ProcessTableEndTagForInTable(); - return; - } - if (token->GetName() == html_names::kBodyTag || - IsCaptionColOrColgroupTag(token->GetName()) || - token->GetName() == html_names::kHTMLTag || - IsTableBodyContextTag(token->GetName()) || - IsTableCellContextTag(token->GetName()) || - token->GetName() == html_names::kTrTag) { - ParseError(token); - return; + switch (token->GetHTMLTag()) { + case HTMLTag::kTable: + ProcessTableEndTagForInTable(); + return; + case HTMLTag::kBody: + case CAPTION_COL_OR_COLGROUP_CASES: + case HTMLTag::kHTML: + case TABLE_BODY_CONTEXT_CASES: + case TABLE_CELL_CONTEXT_CASES: + case HTMLTag::kTr: + ParseError(token); + return; + default: + break; } ParseError(token); // Is this redirection necessary here? @@ -1999,6 +2123,7 @@ void HTMLTreeBuilder::ProcessEndTag(AtomicHTMLToken* token) { DCHECK_EQ(token->GetType(), HTMLToken::kEndTag); + const HTMLTag tag = token->GetHTMLTag(); switch (GetInsertionMode()) { case kInitialMode: DCHECK_EQ(GetInsertionMode(), kInitialMode); @@ -2006,23 +2131,29 @@ [[fallthrough]]; case kBeforeHTMLMode: DCHECK_EQ(GetInsertionMode(), kBeforeHTMLMode); - if (token->GetName() != html_names::kHeadTag && - token->GetName() != html_names::kBodyTag && - token->GetName() != html_names::kHTMLTag && - token->GetName() != html_names::kBrTag) { - ParseError(token); - return; + switch (tag) { + case HTMLTag::kHead: + case HTMLTag::kBody: + case HTMLTag::kHTML: + case HTMLTag::kBr: + break; + default: + ParseError(token); + return; } DefaultForBeforeHTML(); [[fallthrough]]; case kBeforeHeadMode: DCHECK_EQ(GetInsertionMode(), kBeforeHeadMode); - if (token->GetName() != html_names::kHeadTag && - token->GetName() != html_names::kBodyTag && - token->GetName() != html_names::kHTMLTag && - token->GetName() != html_names::kBrTag) { - ParseError(token); - return; + switch (tag) { + case HTMLTag::kHead: + case HTMLTag::kBody: + case HTMLTag::kHTML: + case HTMLTag::kBr: + break; + default: + ParseError(token); + return; } DefaultForBeforeHead(); [[fallthrough]]; @@ -2032,30 +2163,34 @@ // because other end tag cases now refer to it ("process the token for // using the rules of the "in head" insertion mode"). but because the // logic falls through to AfterHeadMode, that gets a little messy. - if (token->GetName() == html_names::kTemplateTag) { - ProcessTemplateEndTag(token); - return; - } - if (token->GetName() == html_names::kHeadTag) { - tree_.OpenElements()->PopHTMLHeadElement(); - SetInsertionMode(kAfterHeadMode); - return; - } - if (token->GetName() != html_names::kBodyTag && - token->GetName() != html_names::kHTMLTag && - token->GetName() != html_names::kBrTag) { - ParseError(token); - return; + switch (tag) { + case HTMLTag::kTemplate: + ProcessTemplateEndTag(token); + return; + case HTMLTag::kHead: + tree_.OpenElements()->PopHTMLHeadElement(); + SetInsertionMode(kAfterHeadMode); + return; + case HTMLTag::kBody: + case HTMLTag::kHTML: + case HTMLTag::kBr: + break; + default: + ParseError(token); + return; } DefaultForInHead(); [[fallthrough]]; case kAfterHeadMode: DCHECK_EQ(GetInsertionMode(), kAfterHeadMode); - if (token->GetName() != html_names::kBodyTag && - token->GetName() != html_names::kHTMLTag && - token->GetName() != html_names::kBrTag) { - ParseError(token); - return; + switch (tag) { + case HTMLTag::kBody: + case HTMLTag::kHTML: + case HTMLTag::kBr: + break; + default: + ParseError(token); + return; } DefaultForAfterHead(); [[fallthrough]]; @@ -2069,44 +2204,46 @@ break; case kInCaptionMode: DCHECK_EQ(GetInsertionMode(), kInCaptionMode); - if (token->GetName() == html_names::kCaptionTag) { - ProcessCaptionEndTagForInCaption(); - return; - } - if (token->GetName() == html_names::kTableTag) { - ParseError(token); - if (!ProcessCaptionEndTagForInCaption()) { - DCHECK(IsParsingFragment()); + switch (tag) { + case HTMLTag::kCaption: + ProcessCaptionEndTagForInCaption(); return; - } - ProcessEndTag(token); - return; - } - if (token->GetName() == html_names::kBodyTag || - token->GetName() == html_names::kColTag || - token->GetName() == html_names::kColgroupTag || - token->GetName() == html_names::kHTMLTag || - IsTableBodyContextTag(token->GetName()) || - IsTableCellContextTag(token->GetName()) || - token->GetName() == html_names::kTrTag) { - ParseError(token); - return; + case HTMLTag::kTable: + ParseError(token); + if (!ProcessCaptionEndTagForInCaption()) { + DCHECK(IsParsingFragment()); + return; + } + ProcessEndTag(token); + return; + case HTMLTag::kBody: + case HTMLTag::kCol: + case HTMLTag::kColgroup: + case HTMLTag::kHTML: + case TABLE_BODY_CONTEXT_CASES: + case TABLE_CELL_CONTEXT_CASES: + case HTMLTag::kTr: + ParseError(token); + return; + default: + break; } ProcessEndTagForInBody(token); break; case kInColumnGroupMode: DCHECK_EQ(GetInsertionMode(), kInColumnGroupMode); - if (token->GetName() == html_names::kColgroupTag) { - ProcessColgroupEndTagForInColumnGroup(); - return; - } - if (token->GetName() == html_names::kColTag) { - ParseError(token); - return; - } - if (token->GetName() == html_names::kTemplateTag) { - ProcessTemplateEndTag(token); - return; + switch (tag) { + case HTMLTag::kColgroup: + ProcessColgroupEndTagForInColumnGroup(); + return; + case HTMLTag::kCol: + ParseError(token); + return; + case HTMLTag::kTemplate: + ProcessTemplateEndTag(token); + return; + default: + break; } if (!ProcessColgroupEndTagForInColumnGroup()) { DCHECK(IsParsingFragmentOrTemplateContents()); @@ -2128,7 +2265,7 @@ break; case kAfterBodyMode: DCHECK_EQ(GetInsertionMode(), kAfterBodyMode); - if (token->GetName() == html_names::kHTMLTag) { + if (tag == HTMLTag::kHTML) { if (IsParsingFragment()) { ParseError(token); return; @@ -2146,14 +2283,14 @@ break; case kInHeadNoscriptMode: DCHECK_EQ(GetInsertionMode(), kInHeadNoscriptMode); - if (token->GetName() == html_names::kNoscriptTag) { - DCHECK(tree_.CurrentStackItem()->HasTagName(html_names::kNoscriptTag)); + if (tag == HTMLTag::kNoscript) { + DCHECK(tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kNoscript)); tree_.OpenElements()->Pop(); - DCHECK(tree_.CurrentStackItem()->HasTagName(html_names::kHeadTag)); + DCHECK(tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kHead)); SetInsertionMode(kInHeadMode); return; } - if (token->GetName() != html_names::kBrTag) { + if (tag != HTMLTag::kBr) { ParseError(token); return; } @@ -2161,8 +2298,8 @@ ProcessToken(token); break; case kTextMode: - if (token->GetName() == html_names::kScriptTag && - tree_.CurrentStackItem()->HasTagName(html_names::kScriptTag)) { + if (tag == HTMLTag::kScript && + tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kScript)) { // Pause ourselves so that parsing stops until the script can be // processed by the caller. if (ScriptingContentIsAllowed(tree_.GetParserContentPolicy())) @@ -2180,7 +2317,7 @@ break; case kInFramesetMode: DCHECK_EQ(GetInsertionMode(), kInFramesetMode); - if (token->GetName() == html_names::kFramesetTag) { + if (tag == HTMLTag::kFrameset) { bool ignore_frameset_for_fragment_parsing = tree_.CurrentIsRootNode(); ignore_frameset_for_fragment_parsing = ignore_frameset_for_fragment_parsing || @@ -2192,14 +2329,15 @@ } tree_.OpenElements()->Pop(); if (!IsParsingFragment() && - !tree_.CurrentStackItem()->HasTagName(html_names::kFramesetTag)) + !tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kFrameset)) { SetInsertionMode(kAfterFramesetMode); + } return; } break; case kAfterFramesetMode: DCHECK_EQ(GetInsertionMode(), kAfterFramesetMode); - if (token->GetName() == html_names::kHTMLTag) { + if (tag == HTMLTag::kHTML) { SetInsertionMode(kAfterAfterFramesetMode); return; } @@ -2211,58 +2349,59 @@ break; case kInSelectInTableMode: DCHECK(GetInsertionMode() == kInSelectInTableMode); - if (token->GetName() == html_names::kCaptionTag || - token->GetName() == html_names::kTableTag || - IsTableBodyContextTag(token->GetName()) || - token->GetName() == html_names::kTrTag || - IsTableCellContextTag(token->GetName())) { - ParseError(token); - if (tree_.OpenElements()->InTableScope(token->GetName())) { - AtomicHTMLToken end_select(HTMLToken::kEndTag, - html_names::kSelectTag.LocalName()); - ProcessEndTag(&end_select); - ProcessEndTag(token); - } - return; + switch (tag) { + case HTMLTag::kCaption: + case HTMLTag::kTable: + case TABLE_BODY_CONTEXT_CASES: + case HTMLTag::kTr: + case TABLE_CELL_CONTEXT_CASES: + ParseError(token); + if (tree_.OpenElements()->InTableScope(tag)) { + AtomicHTMLToken end_select(HTMLToken::kEndTag, HTMLTag::kSelect); + ProcessEndTag(&end_select); + ProcessEndTag(token); + } + return; + default: + break; } [[fallthrough]]; case kInSelectMode: DCHECK(GetInsertionMode() == kInSelectMode || GetInsertionMode() == kInSelectInTableMode); - if (token->GetName() == html_names::kOptgroupTag) { - if (tree_.CurrentStackItem()->HasTagName(html_names::kOptionTag) && - tree_.OneBelowTop() && - tree_.OneBelowTop()->HasTagName(html_names::kOptgroupTag)) - ProcessFakeEndTag(html_names::kOptionTag); - if (tree_.CurrentStackItem()->HasTagName(html_names::kOptgroupTag)) { - tree_.OpenElements()->Pop(); - return; - } - ParseError(token); - return; - } - if (token->GetName() == html_names::kOptionTag) { - if (tree_.CurrentStackItem()->HasTagName(html_names::kOptionTag)) { - tree_.OpenElements()->Pop(); - return; - } - ParseError(token); - return; - } - if (token->GetName() == html_names::kSelectTag) { - if (!tree_.OpenElements()->InSelectScope(token->GetName())) { - DCHECK(IsParsingFragment()); + switch (tag) { + case HTMLTag::kOptgroup: + if (tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kOption) && + tree_.OneBelowTop() && + tree_.OneBelowTop()->MatchesHTMLTag(HTMLTag::kOptgroup)) + ProcessFakeEndTag(HTMLTag::kOption); + if (tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kOptgroup)) { + tree_.OpenElements()->Pop(); + return; + } ParseError(token); return; - } - tree_.OpenElements()->PopUntilPopped( - html_names::kSelectTag.LocalName()); - ResetInsertionModeAppropriately(); - return; - } - if (token->GetName() == html_names::kTemplateTag) { - ProcessTemplateEndTag(token); - return; + case HTMLTag::kOption: + if (tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kOption)) { + tree_.OpenElements()->Pop(); + return; + } + ParseError(token); + return; + case HTMLTag::kSelect: + if (!tree_.OpenElements()->InSelectScope(tag)) { + DCHECK(IsParsingFragment()); + ParseError(token); + return; + } + tree_.OpenElements()->PopUntilPopped(HTMLTag::kSelect); + ResetInsertionModeAppropriately(); + return; + case HTMLTag::kTemplate: + ProcessTemplateEndTag(token); + return; + default: + break; } break; case kInTableTextMode: @@ -2270,7 +2409,7 @@ ProcessEndTag(token); break; case kTemplateContentsMode: - if (token->GetName() == html_names::kTemplateTag) { + if (tag == HTMLTag::kTemplate) { ProcessTemplateEndTag(token); return; } @@ -2392,11 +2531,11 @@ GetInsertionMode() == kInRowMode); DCHECK(pending_table_characters_.IsEmpty()); if (tree_.CurrentStackItem()->IsElementNode() && - (tree_.CurrentStackItem()->HasTagName(html_names::kTableTag) || - tree_.CurrentStackItem()->HasTagName(html_names::kTbodyTag) || - tree_.CurrentStackItem()->HasTagName(html_names::kTfootTag) || - tree_.CurrentStackItem()->HasTagName(html_names::kTheadTag) || - tree_.CurrentStackItem()->HasTagName(html_names::kTrTag))) { + (tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kTable) || + tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kTbody) || + tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kTfoot) || + tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kThead) || + tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kTr))) { original_insertion_mode_ = insertion_mode_; SetInsertionMode(kInTableTextMode); // Note that we fall through to the InTableTextMode case below. @@ -2576,7 +2715,7 @@ return; case kTextMode: { ParseError(token); - if (tree_.CurrentStackItem()->HasTagName(html_names::kScriptTag)) { + if (tree_.CurrentStackItem()->MatchesHTMLTag(HTMLTag::kScript)) { // Mark the script element as "already started". DVLOG(1) << "Not implemented."; } @@ -2605,33 +2744,28 @@ } void HTMLTreeBuilder::DefaultForBeforeHTML() { - AtomicHTMLToken start_html(HTMLToken::kStartTag, - html_names::kHTMLTag.LocalName()); + AtomicHTMLToken start_html(HTMLToken::kStartTag, HTMLTag::kHTML); tree_.InsertHTMLHtmlStartTagBeforeHTML(&start_html); SetInsertionMode(kBeforeHeadMode); } void HTMLTreeBuilder::DefaultForBeforeHead() { - AtomicHTMLToken start_head(HTMLToken::kStartTag, - html_names::kHeadTag.LocalName()); + AtomicHTMLToken start_head(HTMLToken::kStartTag, HTMLTag::kHead); ProcessStartTag(&start_head); } void HTMLTreeBuilder::DefaultForInHead() { - AtomicHTMLToken end_head(HTMLToken::kEndTag, - html_names::kHeadTag.LocalName()); + AtomicHTMLToken end_head(HTMLToken::kEndTag, HTMLTag::kHead); ProcessEndTag(&end_head); } void HTMLTreeBuilder::DefaultForInHeadNoscript() { - AtomicHTMLToken end_noscript(HTMLToken::kEndTag, - html_names::kNoscriptTag.LocalName()); + AtomicHTMLToken end_noscript(HTMLToken::kEndTag, HTMLTag::kNoscript); ProcessEndTag(&end_noscript); } void HTMLTreeBuilder::DefaultForAfterHead() { - AtomicHTMLToken start_body(HTMLToken::kStartTag, - html_names::kBodyTag.LocalName()); + AtomicHTMLToken start_body(HTMLToken::kStartTag, HTMLTag::kBody); ProcessStartTag(&start_body); frameset_ok_ = true; } @@ -2654,52 +2788,47 @@ bool HTMLTreeBuilder::ProcessStartTagForInHead(AtomicHTMLToken* token) { DCHECK_EQ(token->GetType(), HTMLToken::kStartTag); - if (token->GetName() == html_names::kHTMLTag) { - ProcessHtmlStartTagForInBody(token); - return true; - } - if (token->GetName() == html_names::kBaseTag || - token->GetName() == html_names::kBasefontTag || - token->GetName() == html_names::kBgsoundTag || - token->GetName() == html_names::kCommandTag || - token->GetName() == html_names::kLinkTag || - token->GetName() == html_names::kMetaTag) { - tree_.InsertSelfClosingHTMLElementDestroyingToken(token); - // Note: The custom processing for the <meta> tag is done in - // HTMLMetaElement::process(). - return true; - } - if (token->GetName() == html_names::kTitleTag) { - ProcessGenericRCDATAStartTag(token); - return true; - } - if (token->GetName() == html_names::kNoscriptTag) { - if (options_.scripting_flag) { + switch (token->GetHTMLTag()) { + case HTMLTag::kHTML: + ProcessHtmlStartTagForInBody(token); + return true; + case HTMLTag::kBase: + case HTMLTag::kBasefont: + case HTMLTag::kBgsound: + case HTMLTag::kCommand: + case HTMLTag::kLink: + case HTMLTag::kMeta: + tree_.InsertSelfClosingHTMLElementDestroyingToken(token); + // Note: The custom processing for the <meta> tag is done in + // HTMLMetaElement::process(). + return true; + case HTMLTag::kTitle: + ProcessGenericRCDATAStartTag(token); + return true; + case HTMLTag::kNoscript: + if (options_.scripting_flag) { + ProcessGenericRawTextStartTag(token); + return true; + } + tree_.InsertHTMLElement(token); + SetInsertionMode(kInHeadNoscriptMode); + return true; + case HTMLTag::kNoframes: + case HTMLTag::kStyle: ProcessGenericRawTextStartTag(token); return true; - } - tree_.InsertHTMLElement(token); - SetInsertionMode(kInHeadNoscriptMode); - return true; + case HTMLTag::kScript: + ProcessScriptStartTag(token); + return true; + case HTMLTag::kTemplate: + ProcessTemplateStartTag(token); + return true; + case HTMLTag::kHead: + ParseError(token); + return true; + default: + return false; } - if (token->GetName() == html_names::kNoframesTag || - token->GetName() == html_names::kStyleTag) { - ProcessGenericRawTextStartTag(token); - return true; - } - if (token->GetName() == html_names::kScriptTag) { - ProcessScriptStartTag(token); - return true; - } - if (token->GetName() == html_names::kTemplateTag) { - ProcessTemplateStartTag(token); - return true; - } - if (token->GetName() == html_names::kHeadTag) { - ParseError(token); - return true; - } - return false; } void HTMLTreeBuilder::ProcessGenericRCDATAStartTag(AtomicHTMLToken* token) { @@ -2783,56 +2912,64 @@ ParseError(token); break; case HTMLToken::kStartTag: { - if (token->GetName() == html_names::kBTag || - token->GetName() == html_names::kBigTag || - token->GetName() == html_names::kBlockquoteTag || - token->GetName() == html_names::kBodyTag || - token->GetName() == html_names::kBrTag || - token->GetName() == html_names::kCenterTag || - token->GetName() == html_names::kCodeTag || - token->GetName() == html_names::kDdTag || - token->GetName() == html_names::kDivTag || - token->GetName() == html_names::kDlTag || - token->GetName() == html_names::kDtTag || - token->GetName() == html_names::kEmTag || - token->GetName() == html_names::kEmbedTag || - IsNumberedHeaderTag(token->GetName()) || - token->GetName() == html_names::kHeadTag || - token->GetName() == html_names::kHrTag || - token->GetName() == html_names::kITag || - token->GetName() == html_names::kImgTag || - token->GetName() == html_names::kLiTag || - token->GetName() == html_names::kListingTag || - token->GetName() == html_names::kMenuTag || - token->GetName() == html_names::kMetaTag || - token->GetName() == html_names::kNobrTag || - token->GetName() == html_names::kOlTag || - token->GetName() == html_names::kPTag || - token->GetName() == html_names::kPreTag || - token->GetName() == html_names::kRubyTag || - token->GetName() == html_names::kSTag || - token->GetName() == html_names::kSmallTag || - token->GetName() == html_names::kSpanTag || - token->GetName() == html_names::kStrongTag || - token->GetName() == html_names::kStrikeTag || - token->GetName() == html_names::kSubTag || - token->GetName() == html_names::kSupTag || - token->GetName() == html_names::kTableTag || - token->GetName() == html_names::kTtTag || - token->GetName() == html_names::kUTag || - token->GetName() == html_names::kUlTag || - token->GetName() == html_names::kVarTag || - (token->GetName() == html_names::kFontTag && - (token->GetAttributeItem(html_names::kColorAttr) || - token->GetAttributeItem(html_names::kFaceAttr) || - token->GetAttributeItem(html_names::kSizeAttr)))) { - ParseError(token); - tree_.OpenElements()->PopUntilForeignContentScopeMarker(); - ProcessStartTag(token); - return; + const HTMLTag tag = token->GetHTMLTag(); + switch (tag) { + case HTMLTag::kFont: + if (!token->GetAttributeItem(html_names::kColorAttr) && + !token->GetAttributeItem(html_names::kFaceAttr) && + !token->GetAttributeItem(html_names::kSizeAttr)) { + break; + } + [[fallthrough]]; + case HTMLTag::kB: + case HTMLTag::kBig: + case HTMLTag::kBlockquote: + case HTMLTag::kBody: + case HTMLTag::kBr: + case HTMLTag::kCenter: + case HTMLTag::kCode: + case HTMLTag::kDd: + case HTMLTag::kDiv: + case HTMLTag::kDl: + case HTMLTag::kDt: + case HTMLTag::kEm: + case HTMLTag::kEmbed: + case NUMBERED_HEADER_CASES: + case HTMLTag::kHead: + case HTMLTag::kHr: + case HTMLTag::kI: + case HTMLTag::kImg: + case HTMLTag::kLi: + case HTMLTag::kListing: + case HTMLTag::kMenu: + case HTMLTag::kMeta: + case HTMLTag::kNobr: + case HTMLTag::kOl: + case HTMLTag::kP: + case HTMLTag::kPre: + case HTMLTag::kRuby: + case HTMLTag::kS: + case HTMLTag::kSmall: + case HTMLTag::kSpan: + case HTMLTag::kStrong: + case HTMLTag::kStrike: + case HTMLTag::kSub: + case HTMLTag::kSup: + case HTMLTag::kTable: + case HTMLTag::kTt: + case HTMLTag::kU: + case HTMLTag::kUl: + case HTMLTag::kVar: + ParseError(token); + tree_.OpenElements()->PopUntilForeignContentScopeMarker(); + ProcessStartTag(token); + return; + case HTMLTag::kScript: + script_to_process_start_position_ = parser_->GetTextPosition(); + break; + default: + break; } - if (token->GetName() == html_names::kScriptTag) - script_to_process_start_position_ = parser_->GetTextPosition(); const AtomicString& current_namespace = adjusted_current_node->NamespaceURI(); if (current_namespace == mathml_names::kNamespaceURI) @@ -2856,8 +2993,8 @@ tree_.OpenElements()->Pop(); return; } - if (token->GetName() == html_names::kBrTag || - token->GetName() == html_names::kPTag) { + const HTMLTag tag = token->GetHTMLTag(); + if (tag == HTMLTag::kBr || tag == HTMLTag::kP) { ParseError(token); tree_.OpenElements()->PopUntilForeignContentScopeMarker(); ProcessEndTag(token);
diff --git a/third_party/blink/renderer/core/html/parser/html_tree_builder.h b/third_party/blink/renderer/core/html/parser/html_tree_builder.h index 09b052a..6a293ade 100644 --- a/third_party/blink/renderer/core/html/parser/html_tree_builder.h +++ b/third_party/blink/renderer/core/html/parser/html_tree_builder.h
@@ -165,10 +165,10 @@ inline void ProcessCharacterBufferForInBody(CharacterTokenBuffer&); void ProcessFakeStartTag( - const QualifiedName&, + html_names::HTMLTag tag, const Vector<Attribute>& attributes = Vector<Attribute>()); - void ProcessFakeEndTag(const QualifiedName&); - void ProcessFakeEndTag(const AtomicString&); + void ProcessFakeEndTag(html_names::HTMLTag tag); + void ProcessFakeEndTag(const HTMLStackItem& stack_item); void ProcessFakePEndTagIfPInButtonScope(); void ProcessGenericRCDATAStartTag(AtomicHTMLToken*);
diff --git a/third_party/blink/renderer/core/html/parser/html_tree_builder_test.cc b/third_party/blink/renderer/core/html/parser/html_tree_builder_test.cc deleted file mode 100644 index e4b6498..0000000 --- a/third_party/blink/renderer/core/html/parser/html_tree_builder_test.cc +++ /dev/null
@@ -1,178 +0,0 @@ -// Copyright 2022 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 "third_party/blink/renderer/core/html/parser/tag_parsing_group.h" - -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/core/html_names.h" -#include "third_party/blink/renderer/platform/wtf/hash_set.h" -#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" -#include "third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h" - -namespace blink { - -TEST(HTMLTreeBuilderTest, GetTagParsingGroup) { - HashSet<AtomicString> checked_tags; - auto get = [&checked_tags](const char* tag) -> TagParsingGroup { - checked_tags.insert(tag); - return GetTagParsingGroup(tag); - }; - - // These are all the tags that exist in html_tag_names.h. - EXPECT_EQ(TagParsingGroup::kATag, get("a")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("abbr")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("acronym")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("address")); - EXPECT_EQ(TagParsingGroup::kReconstructFormattingTags, get("area")); - EXPECT_EQ(TagParsingGroup::kAppletOrObjectTag, get("applet")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("article")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("aside")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("audio")); - EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("b")); - EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("base")); - EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("basefont")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("bdi")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("bdo")); - EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("bgsound")); - EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("big")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("blockquote")); - EXPECT_EQ(TagParsingGroup::kBodyTag, get("body")); - EXPECT_EQ(TagParsingGroup::kReconstructFormattingTags, get("br")); - EXPECT_EQ(TagParsingGroup::kButtonTag, get("button")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("canvas")); - EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("caption")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("center")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("cite")); - EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("code")); - EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("col")); - EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("colgroup")); - EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("command")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("data")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("datalist")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("del")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("details")); - EXPECT_EQ(TagParsingGroup::kDdOrDtTag, get("dd")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("dfn")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("dialog")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("dir")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("div")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("dl")); - EXPECT_EQ(TagParsingGroup::kDdOrDtTag, get("dt")); - EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("em")); - EXPECT_EQ(TagParsingGroup::kReconstructFormattingTags, get("embed")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("fencedframe")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("fieldset")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("figcaption")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("figure")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("footer")); - EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("font")); - EXPECT_EQ(TagParsingGroup::kFormTag, get("form")); - EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("frame")); - EXPECT_EQ(TagParsingGroup::kFramesetTag, get("frameset")); - EXPECT_EQ(TagParsingGroup::kNumberedHeaderTag, get("h1")); - EXPECT_EQ(TagParsingGroup::kNumberedHeaderTag, get("h2")); - EXPECT_EQ(TagParsingGroup::kNumberedHeaderTag, get("h3")); - EXPECT_EQ(TagParsingGroup::kNumberedHeaderTag, get("h4")); - EXPECT_EQ(TagParsingGroup::kNumberedHeaderTag, get("h5")); - EXPECT_EQ(TagParsingGroup::kNumberedHeaderTag, get("h6")); - EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("head")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("header")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("hgroup")); - EXPECT_EQ(TagParsingGroup::kHrTag, get("hr")); - EXPECT_EQ(TagParsingGroup::kHTMLTag, get("html")); - EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("i")); - EXPECT_EQ(TagParsingGroup::kIFrameTag, get("iframe")); - EXPECT_EQ(TagParsingGroup::kImageTag, get("image")); - EXPECT_EQ(TagParsingGroup::kReconstructFormattingTags, get("img")); - EXPECT_EQ(TagParsingGroup::kInputTag, get("input")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("ins")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("kbd")); - EXPECT_EQ(TagParsingGroup::kReconstructFormattingTags, get("keygen")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("label")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("layer")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("legend")); - EXPECT_EQ(TagParsingGroup::kLiTag, get("li")); - EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("link")); - EXPECT_EQ(TagParsingGroup::kListingOrPreTag, get("listing")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("main")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("map")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("mark")); - EXPECT_EQ(TagParsingGroup::kMarqueeTag, get("marquee")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("menu")); - EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("meta")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("meter")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("nav")); - EXPECT_EQ(TagParsingGroup::kNobrTag, get("nobr")); - EXPECT_EQ(TagParsingGroup::kNoembedTag, get("noembed")); - EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("noframes")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("nolayer")); - EXPECT_EQ(TagParsingGroup::kNoscriptTag, get("noscript")); - EXPECT_EQ(TagParsingGroup::kAppletOrObjectTag, get("object")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("ol")); - EXPECT_EQ(TagParsingGroup::kOptgroupOrOptionTag, get("optgroup")); - EXPECT_EQ(TagParsingGroup::kOptgroupOrOptionTag, get("option")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("output")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("p")); - EXPECT_EQ(TagParsingGroup::kParamOrSourceOrTrackTag, get("param")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("picture")); - EXPECT_EQ(TagParsingGroup::kPlaintextTag, get("plaintext")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("portal")); - EXPECT_EQ(TagParsingGroup::kListingOrPreTag, get("pre")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("progress")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("q")); - EXPECT_EQ(TagParsingGroup::kRbOrRtcTag, get("rb")); - EXPECT_EQ(TagParsingGroup::kRtOrRpTag, get("rp")); - EXPECT_EQ(TagParsingGroup::kRtOrRpTag, get("rt")); - EXPECT_EQ(TagParsingGroup::kRbOrRtcTag, get("rtc")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("ruby")); - EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("s")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("samp")); - EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("script")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("section")); - EXPECT_EQ(TagParsingGroup::kSelectTag, get("select")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("selectmenu")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("slot")); - EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("small")); - EXPECT_EQ(TagParsingGroup::kParamOrSourceOrTrackTag, get("source")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("span")); - EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("strike")); - EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("strong")); - EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("style")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("sub")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("summary")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("sup")); - EXPECT_EQ(TagParsingGroup::kTableTag, get("table")); - EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("tbody")); - EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("td")); - EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("template")); - EXPECT_EQ(TagParsingGroup::kTextareaTag, get("textarea")); - EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("tfoot")); - EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("th")); - EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("thead")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("time")); - EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("title")); - EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("tr")); - EXPECT_EQ(TagParsingGroup::kParamOrSourceOrTrackTag, get("track")); - EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("tt")); - EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("u")); - EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("ul")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("var")); - EXPECT_EQ(TagParsingGroup::kNoGroup, get("video")); - EXPECT_EQ(TagParsingGroup::kReconstructFormattingTags, get("wbr")); - EXPECT_EQ(TagParsingGroup::kXmpTag, get("xmp")); - - EXPECT_EQ(TagParsingGroup::kNoGroup, - GetTagParsingGroup("thistagdoesnotexist")); - - // Verify that we've checked all the tags. - std::unique_ptr<const HTMLQualifiedName*[]> qualified_names = - html_names::GetTags(); - EXPECT_EQ(checked_tags.size(), html_names::kTagsCount); - for (wtf_size_t i = 0; i < html_names::kTagsCount; ++i) { - SCOPED_TRACE(qualified_names[i]->LocalName()); - EXPECT_TRUE(checked_tags.Contains(qualified_names[i]->LocalName())); - } -} - -} // namespace blink
diff --git a/third_party/blink/renderer/core/html/parser/tag_parsing_group.h b/third_party/blink/renderer/core/html/parser/tag_parsing_group.h deleted file mode 100644 index 4d36886..0000000 --- a/third_party/blink/renderer/core/html/parser/tag_parsing_group.h +++ /dev/null
@@ -1,395 +0,0 @@ -// Copyright 2022 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. - -#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_PARSER_TAG_PARSING_GROUP_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_PARSER_TAG_PARSING_GROUP_H_ - -// This file has been split out from html_tree_builder.cc for unit testing -// purposes. - -#include "third_party/blink/renderer/core/html_names.h" -#include "third_party/blink/renderer/core/mathml_names.h" -#include "third_party/blink/renderer/core/svg_names.h" - -namespace blink { - -static bool IsCaptionColOrColgroupTag(const AtomicString& tag_name) { - return tag_name == html_names::kCaptionTag || - tag_name == html_names::kColTag || - tag_name == html_names::kColgroupTag; -} - -static bool IsTableBodyContextTag(const AtomicString& tag_name) { - return tag_name == html_names::kTbodyTag || - tag_name == html_names::kTfootTag || tag_name == html_names::kTheadTag; -} - -static bool IsTableCellContextTag(const AtomicString& tag_name) { - return tag_name == html_names::kThTag || tag_name == html_names::kTdTag; -} - -static bool IsNumberedHeaderTag(const AtomicString& tag_name) { - return tag_name == html_names::kH1Tag || tag_name == html_names::kH2Tag || - tag_name == html_names::kH3Tag || tag_name == html_names::kH4Tag || - tag_name == html_names::kH5Tag || tag_name == html_names::kH6Tag; -} - -// A grouping that exists solely as a helper for ProcessStartTagForInBody() -// (although it may also be useful for related functions at some future point). -// Certain tags trigger exactly the same behavior when we see their opening; -// e.g., <base>, <link>, <meta>, <bgsound>, etc. within the document body are -// all sent on to parsing as if they occurred in the header instead. -// GetTagParsingGroup() will take a tag name in AtomicString form and map it -// into a numerical value we can switch on. -// -// Note that these tags are grouped by their role relating to start tags -// within <body>, which is the phase we optimize the most for. -enum class TagParsingGroup { - kNoGroup = 0, - - // Groups consisting of a single tag or a group of tags. - kATag, - kAppletOrObjectTag, - kBodyTag, - kButtonTag, - kDdOrDtTag, - kFormTag, - kFramesetTag, - kHTMLTag, - kHrTag, - kIFrameTag, - kImageTag, - kInputTag, - kLiTag, - kListingOrPreTag, - kMarqueeTag, - kMathTag, - kNobrTag, - kNoembedTag, - kNoscriptTag, - kOptgroupOrOptionTag, - kParamOrSourceOrTrackTag, - kPlaintextTag, - kRbOrRtcTag, - kRtOrRpTag, - kSelectTag, - kSVGTag, - kTableTag, - kTextareaTag, - kXmpTag, - - // Specifically named groups. - kTagsThatCloseP, - kReconstructFormattingTags, - kTagsThatBelongInHead, - kNumberedHeaderTag, // IsNumberedHeaderTag(). - kNonAnchorNonNobrFormattingTag, // IsNonAnchorNonNobrFormattingTag(). - kParseErrorTag, -}; - -// Convert a tag name in AtomicString form and map it into a numerical value we -// can switch on, based on the desired behavior (see TagParsingGroup). Since we -// have so many different tags to test for, it is more efficient to group by the -// first letter before we do testing (otherwise, a tag not in the list would -// need to go through 70–80 tests in turn). -// -// This is not the only possible design for this; we could e.g. use a hash table -// instead. Also, it would be possible to put the code directly in this switch, -// instead of returning a value and then switching on that value. However, -// that would lead to duplication, and hopefully, the compiler can figure out -// the jumps directly. In any case, the strategy seems to be successful enough -// in making ProcessStartTagForInBody() not a bottleneck during parsing. -static inline TagParsingGroup GetTagParsingGroup(const AtomicString& tag) { - DCHECK(!tag.IsEmpty()); - switch (tag[0]) { - case 'a': - if (tag == html_names::kAddressTag || tag == html_names::kArticleTag || - tag == html_names::kAsideTag) { - return TagParsingGroup::kTagsThatCloseP; - } - if (tag == html_names::kATag) { - return TagParsingGroup::kATag; - } - if (tag == html_names::kAppletTag) { - return TagParsingGroup::kAppletOrObjectTag; - } - if (tag == html_names::kAreaTag) { - return TagParsingGroup::kReconstructFormattingTags; - } - break; - - case 'b': - if (tag == html_names::kBlockquoteTag) { - return TagParsingGroup::kTagsThatCloseP; - } - if (tag == html_names::kButtonTag) { - return TagParsingGroup::kButtonTag; - } - if (tag == html_names::kBrTag) { - return TagParsingGroup::kReconstructFormattingTags; - } - if (tag == html_names::kBaseTag || tag == html_names::kBasefontTag || - tag == html_names::kBgsoundTag) { - return TagParsingGroup::kTagsThatBelongInHead; - } - if (tag == html_names::kBodyTag) { - return TagParsingGroup::kBodyTag; - } - if (tag == html_names::kBTag || tag == html_names::kBigTag) { - return TagParsingGroup::kNonAnchorNonNobrFormattingTag; - } - if (tag == html_names::kBrTag) { - return TagParsingGroup::kReconstructFormattingTags; - } - break; - - case 'c': - if (tag == html_names::kCommandTag) { - return TagParsingGroup::kTagsThatBelongInHead; - } - if (tag == html_names::kCenterTag) { - return TagParsingGroup::kTagsThatCloseP; - } - if (tag == html_names::kCodeTag) { - return TagParsingGroup::kNonAnchorNonNobrFormattingTag; - } - if (IsCaptionColOrColgroupTag(tag)) { - return TagParsingGroup::kParseErrorTag; - } - break; - - case 'd': - if (tag == html_names::kDetailsTag || tag == html_names::kDialogTag || - tag == html_names::kDirTag || tag == html_names::kDivTag || - tag == html_names::kDlTag) { - return TagParsingGroup::kTagsThatCloseP; - } - if (tag == html_names::kDdTag || tag == html_names::kDtTag) { - return TagParsingGroup::kDdOrDtTag; - } - break; - - case 'e': - if (tag == html_names::kEmTag) { - return TagParsingGroup::kNonAnchorNonNobrFormattingTag; - } - if (tag == html_names::kEmbedTag) { - return TagParsingGroup::kReconstructFormattingTags; - } - break; - - case 'f': - if (tag == html_names::kFieldsetTag || - tag == html_names::kFigcaptionTag || tag == html_names::kFigureTag || - tag == html_names::kFooterTag) { - return TagParsingGroup::kTagsThatCloseP; - } - if (tag == html_names::kFramesetTag) { - return TagParsingGroup::kFramesetTag; - } - if (tag == html_names::kFormTag) { - return TagParsingGroup::kFormTag; - } - if (tag == html_names::kFontTag) { - return TagParsingGroup::kNonAnchorNonNobrFormattingTag; - } - if (tag == html_names::kFrameTag) { - return TagParsingGroup::kParseErrorTag; - } - break; - - case 'h': - if (tag == html_names::kHTMLTag) { - return TagParsingGroup::kHTMLTag; - } - if (tag == html_names::kHeaderTag || tag == html_names::kHgroupTag) { - return TagParsingGroup::kTagsThatCloseP; - } - if (IsNumberedHeaderTag(tag)) { - return TagParsingGroup::kNumberedHeaderTag; - } - if (tag == html_names::kHrTag) { - return TagParsingGroup::kHrTag; - } - if (tag == html_names::kHeadTag) { - return TagParsingGroup::kParseErrorTag; - } - break; - - case 'i': - if (tag == html_names::kInputTag) { - return TagParsingGroup::kInputTag; - } - if (tag == html_names::kITag) { - return TagParsingGroup::kNonAnchorNonNobrFormattingTag; - } - if (tag == html_names::kImgTag) { - return TagParsingGroup::kReconstructFormattingTags; - } - if (tag == html_names::kImageTag) { - return TagParsingGroup::kImageTag; - } - if (tag == html_names::kIFrameTag) { - return TagParsingGroup::kIFrameTag; - } - break; - - case 'k': - if (tag == html_names::kKeygenTag) { - return TagParsingGroup::kReconstructFormattingTags; - } - break; - - case 'l': - if (tag == html_names::kLiTag) { - return TagParsingGroup::kLiTag; - } - if (tag == html_names::kLinkTag) { - return TagParsingGroup::kTagsThatBelongInHead; - } - if (tag == html_names::kListingTag) { - return TagParsingGroup::kListingOrPreTag; - } - break; - - case 'm': - if (tag == html_names::kMetaTag) { - return TagParsingGroup::kTagsThatBelongInHead; - } - if (tag == html_names::kMainTag || tag == html_names::kMenuTag) { - return TagParsingGroup::kTagsThatCloseP; - } - if (tag == html_names::kMarqueeTag) { - return TagParsingGroup::kMarqueeTag; - } - if (tag == mathml_names::kMathTag.LocalName()) { - return TagParsingGroup::kMathTag; - } - break; - - case 'n': - if (tag == html_names::kNoframesTag) { - return TagParsingGroup::kTagsThatBelongInHead; - } - if (tag == html_names::kNavTag) { - return TagParsingGroup::kTagsThatCloseP; - } - if (tag == html_names::kNobrTag) { - return TagParsingGroup::kNobrTag; - } - if (tag == html_names::kNoembedTag) { - return TagParsingGroup::kNoembedTag; - } - if (tag == html_names::kNoscriptTag) { - return TagParsingGroup::kNoscriptTag; - } - break; - - case 'o': - if (tag == html_names::kOlTag) { - return TagParsingGroup::kTagsThatCloseP; - } - if (tag == html_names::kObjectTag) { - return TagParsingGroup::kAppletOrObjectTag; - } - if (tag == html_names::kOptgroupTag || tag == html_names::kOptionTag) { - return TagParsingGroup::kOptgroupOrOptionTag; - } - break; - - case 'p': - if (tag == html_names::kParamTag) { - return TagParsingGroup::kParamOrSourceOrTrackTag; - } - if (tag == html_names::kPTag) { - return TagParsingGroup::kTagsThatCloseP; - } - if (tag == html_names::kPreTag) { - return TagParsingGroup::kListingOrPreTag; - } - if (tag == html_names::kPlaintextTag) { - return TagParsingGroup::kPlaintextTag; - } - break; - - case 'r': - if (tag == html_names::kRbTag || tag == html_names::kRTCTag) { - return TagParsingGroup::kRbOrRtcTag; - } - if (tag == html_names::kRtTag || tag == html_names::kRpTag) { - return TagParsingGroup::kRtOrRpTag; - } - break; - - case 's': - if (tag == html_names::kScriptTag || tag == html_names::kStyleTag) { - return TagParsingGroup::kTagsThatBelongInHead; - } - if (tag == html_names::kSectionTag || tag == html_names::kSummaryTag) { - return TagParsingGroup::kTagsThatCloseP; - } - if (tag == html_names::kSTag || tag == html_names::kSmallTag || - tag == html_names::kStrikeTag || tag == html_names::kStrongTag) { - return TagParsingGroup::kNonAnchorNonNobrFormattingTag; - } - if (tag == html_names::kSelectTag) { - return TagParsingGroup::kSelectTag; - } - if (tag == svg_names::kSVGTag.LocalName()) { - return TagParsingGroup::kSVGTag; - } - if (tag == html_names::kSourceTag) { - return TagParsingGroup::kParamOrSourceOrTrackTag; - } - break; - - case 't': - if (tag == html_names::kTitleTag || tag == html_names::kTemplateTag) { - return TagParsingGroup::kTagsThatBelongInHead; - } - if (tag == html_names::kTtTag) { - return TagParsingGroup::kNonAnchorNonNobrFormattingTag; - } - if (tag == html_names::kTableTag) { - return TagParsingGroup::kTableTag; - } - if (tag == html_names::kTextareaTag) { - return TagParsingGroup::kTextareaTag; - } - if (IsTableBodyContextTag(tag) || IsTableCellContextTag(tag) || - tag == html_names::kTrTag) { - return TagParsingGroup::kParseErrorTag; - } - if (tag == html_names::kTrackTag) { - return TagParsingGroup::kParamOrSourceOrTrackTag; - } - break; - - case 'u': - if (tag == html_names::kUlTag) { - return TagParsingGroup::kTagsThatCloseP; - } - if (tag == html_names::kUTag) { - return TagParsingGroup::kNonAnchorNonNobrFormattingTag; - } - break; - - case 'w': - if (tag == html_names::kWbrTag) { - return TagParsingGroup::kReconstructFormattingTags; - } - break; - - case 'x': - if (tag == html_names::kXmpTag) { - return TagParsingGroup::kXmpTag; - } - break; - } - return TagParsingGroup::kNoGroup; -} - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_HTML_PARSER_TAG_PARSING_GROUP_H_
diff --git a/third_party/blink/renderer/core/html/parser/text_document_parser.cc b/third_party/blink/renderer/core/html/parser/text_document_parser.cc index 4547c7c6..251f648 100644 --- a/third_party/blink/renderer/core/html/parser/text_document_parser.cc +++ b/third_party/blink/renderer/core/html/parser/text_document_parser.cc
@@ -61,16 +61,16 @@ // the preferred color scheme. attributes.push_back(Attribute(html_names::kNameAttr, "color-scheme")); attributes.push_back(Attribute(html_names::kContentAttr, "light dark")); - AtomicHTMLToken fake_meta(HTMLToken::kStartTag, - html_names::kMetaTag.LocalName(), attributes); + AtomicHTMLToken fake_meta(HTMLToken::kStartTag, html_names::HTMLTag::kMeta, + attributes); TreeBuilder()->ConstructTree(&fake_meta); attributes.clear(); // Wrap the actual contents of the text file in <pre>. attributes.push_back(Attribute( html_names::kStyleAttr, "word-wrap: break-word; white-space: pre-wrap;")); - AtomicHTMLToken fake_pre(HTMLToken::kStartTag, - html_names::kPreTag.LocalName(), attributes); + AtomicHTMLToken fake_pre(HTMLToken::kStartTag, html_names::HTMLTag::kPre, + attributes); TreeBuilder()->ConstructTree(&fake_pre); // The document could have been detached by an extension while the
diff --git a/third_party/blink/renderer/core/inspector/inspector_dom_agent.cc b/third_party/blink/renderer/core/inspector/inspector_dom_agent.cc index b288bac..2042554 100644 --- a/third_party/blink/renderer/core/inspector/inspector_dom_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_dom_agent.cc
@@ -838,8 +838,7 @@ return 0; // Return id in case the node is known. - auto it = node_map->find(node_to_push); - if (it != node_map->end()) + if (auto it = node_map->find(node_to_push); it != node_map->end()) return it->value; Node* node = node_to_push; @@ -856,14 +855,13 @@ } for (int i = path.size() - 1; i >= 0; --i) { - auto it = node_map->find(path.at(i).Get()); - if (it != node_map->end()) { + if (auto it = node_map->find(path.at(i).Get()); it != node_map->end()) { int node_id = it->value; DCHECK(node_id); PushChildNodesToFrontend(node_id); } } - it = node_map->find(node_to_push); + auto it = node_map->find(node_to_push); return it != node_map->end() ? it->value : 0; }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc index 35a28ea..acc2685 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc
@@ -1928,7 +1928,7 @@ new_child_space = CreateConstraintSpaceForChild( child, *child_data, ChildAvailableSize(), /* is_new_fc */ false, child_bfc_block_offset); - auto minimum_top = CreateMinimumTopScopeForChild(child, *child_data); + auto minimum_top2 = CreateMinimumTopScopeForChild(child, *child_data); layout_result = LayoutInflow(new_child_space, child_break_token, early_break_, column_spanner_path_, &child, inline_child_layout_context);
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc index ecbec6c..95b6edf2 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc
@@ -737,11 +737,12 @@ DCHECK_GE(fragment_count, 1u); box_->ClearNeedsLayout(); for (wtf_size_t i = 1; i < fragment_count; i++) { - const NGPhysicalBoxFragment& fragment = *box_->GetPhysicalFragment(i); - bool is_first = i == 1; + const NGPhysicalBoxFragment& physical_fragment = + *box_->GetPhysicalFragment(i); + is_first = i == 1; bool is_last = i + 1 == fragment_count; NGFragmentRepeater repeater(is_first, is_last); - repeater.CloneChildFragments(fragment); + repeater.CloneChildFragments(physical_fragment); } }
diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h index a2d7e979..ab49ca50 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.h +++ b/third_party/blink/renderer/core/loader/empty_clients.h
@@ -104,7 +104,7 @@ void Show(LocalFrame& frame, LocalFrame& opener_frame, NavigationPolicy navigation_policy, - const gfx::Rect& initial_rect, + const mojom::blink::WindowFeatures& window_features, bool consumed_user_gesture) override {} void DidOverscroll(const gfx::Vector2dF&, const gfx::Vector2dF&,
diff --git a/third_party/blink/renderer/core/navigation_api/navigation_api.cc b/third_party/blink/renderer/core/navigation_api/navigation_api.cc index 307e413..6643acbd 100644 --- a/third_party/blink/renderer/core/navigation_api/navigation_api.cc +++ b/third_party/blink/renderer/core/navigation_api/navigation_api.cc
@@ -114,7 +114,7 @@ } if (navigate_event_->ShouldSendAxEvents()) { - auto* window = LocalDOMWindow::From(script_state); + window = LocalDOMWindow::From(script_state); DCHECK(window); if (AXObjectCache* cache = window->document()->ExistingAXObjectCache()) cache->HandleLoadComplete(window->document());
diff --git a/third_party/blink/renderer/core/page/chrome_client.h b/third_party/blink/renderer/core/page/chrome_client.h index a7fe72c2..844c8a29 100644 --- a/third_party/blink/renderer/core/page/chrome_client.h +++ b/third_party/blink/renderer/core/page/chrome_client.h
@@ -116,6 +116,7 @@ namespace mojom { namespace blink { class TextAutosizerPageInfo; +class WindowFeatures; } } // namespace mojom @@ -248,7 +249,7 @@ virtual void Show(LocalFrame& frame, LocalFrame& opener_frame, NavigationPolicy navigation_policy, - const gfx::Rect& initial_rect, + const mojom::blink::WindowFeatures& window_features, bool consumed_user_gesture) = 0; // All the parameters should be in viewport space. That is, if an event
diff --git a/third_party/blink/renderer/core/page/chrome_client_impl.cc b/third_party/blink/renderer/core/page/chrome_client_impl.cc index 00ce475f..5de0562d 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl.cc +++ b/third_party/blink/renderer/core/page/chrome_client_impl.cc
@@ -44,6 +44,7 @@ #include "third_party/blink/public/common/page/page_zoom.h" #include "third_party/blink/public/common/widget/constants.h" #include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/public/web/blink.h" @@ -354,11 +355,11 @@ void ChromeClientImpl::Show(LocalFrame& frame, LocalFrame& opener_frame, NavigationPolicy navigation_policy, - const gfx::Rect& initial_rect, + const mojom::blink::WindowFeatures& window_features, bool user_gesture) { DCHECK(web_view_); const gfx::Rect rect_adjusted_for_minimum = - AdjustWindowRectForMinimum(initial_rect); + AdjustWindowRectForMinimum(window_features.bounds); const gfx::Rect adjusted_rect = AdjustWindowRectForDisplay(rect_adjusted_for_minimum, frame); // Request the unadjusted rect if the browser may honor cross-screen bounds.
diff --git a/third_party/blink/renderer/core/page/chrome_client_impl.h b/third_party/blink/renderer/core/page/chrome_client_impl.h index 5c6d89f..7c1efa0 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl.h +++ b/third_party/blink/renderer/core/page/chrome_client_impl.h
@@ -103,7 +103,7 @@ void Show(LocalFrame& frame, LocalFrame& opener_frame, NavigationPolicy navigation_policy, - const gfx::Rect& initial_rect, + const mojom::blink::WindowFeatures& window_features, bool user_gesture) override; void DidOverscroll(const gfx::Vector2dF& overscroll_delta, const gfx::Vector2dF& accumulated_overscroll,
diff --git a/third_party/blink/renderer/core/page/create_window.cc b/third_party/blink/renderer/core/page/create_window.cc index 7e73ad64..12a55ad 100644 --- a/third_party/blink/renderer/core/page/create_window.cc +++ b/third_party/blink/renderer/core/page/create_window.cc
@@ -32,6 +32,7 @@ #include "third_party/blink/public/common/dom_storage/session_storage_namespace_id.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/mojom/loader/request_context_frame_type.mojom-blink.h" +#include "third_party/blink/public/mojom/window_features/window_features.mojom-blink.h" #include "third_party/blink/public/web/web_view_client.h" #include "third_party/blink/public/web/web_window_features.h" #include "third_party/blink/renderer/core/core_initializer.h" @@ -378,7 +379,10 @@ frame.View()->SetCanHaveScrollbars(features.scrollbars_visible); - gfx::Rect window_rect = page->GetChromeClient().RootWindowRect(frame); + mojom::blink::WindowFeaturesPtr window_features = + mojom::blink::WindowFeatures::New(); + window_features->bounds = page->GetChromeClient().RootWindowRect(frame); + gfx::Rect& window_rect = window_features->bounds; if (features.x_set) window_rect.set_x(features.x); if (features.y_set) @@ -389,7 +393,7 @@ window_rect.set_height(features.height); page->GetChromeClient().Show(frame, opener_frame, - request.GetNavigationPolicy(), window_rect, + request.GetNavigationPolicy(), *window_features, consumed_user_gesture); MaybeLogWindowOpen(opener_frame); return &frame;
diff --git a/third_party/blink/renderer/core/paint/cull_rect_updater.cc b/third_party/blink/renderer/core/paint/cull_rect_updater.cc index f701114b..44c23730 100644 --- a/third_party/blink/renderer/core/paint/cull_rect_updater.cc +++ b/third_party/blink/renderer/core/paint/cull_rect_updater.cc
@@ -5,6 +5,8 @@ #include "third_party/blink/renderer/core/paint/cull_rect_updater.h" #include "base/auto_reset.h" +#include "base/feature_list.h" +#include "third_party/blink/public/common/features.h" #include "third_party/blink/renderer/core/document_transition/document_transition_supplement.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h" @@ -155,6 +157,12 @@ } // anonymous namespace +CullRectUpdater::CullRectUpdater(PaintLayer& starting_layer) + : starting_layer_(starting_layer) { + if (base::FeatureList::IsEnabled(features::kOldCullRectUpdater)) + simulate_old_behavior_ = true; +} + void CullRectUpdater::Update() { TRACE_EVENT0("blink,benchmark", "CullRectUpdate"); SCOPED_BLINK_UMA_HISTOGRAM_TIMER_HIGHRES("Blink.CullRect.UpdateTime"); @@ -242,6 +250,8 @@ (context.fixed.force_update_children && !object.CanContainFixedPositionObjects() && layer.HasFixedPositionDescendant()); + if (simulate_old_behavior_) + should_traverse_children |= !object.IsStackingContext(); if (should_traverse_children) { context.current.container = &layer; if (object.CanContainAbsolutePositionObjects()) @@ -265,8 +275,14 @@ if (object.ChildPaintBlockedByDisplayLock()) return; - for (auto* child = layer.FirstChild(); child; child = child->NextSibling()) + for (auto* child = layer.FirstChild(); child; child = child->NextSibling()) { + if (simulate_old_behavior_ && !child->IsReplacedNormalFlowStacking() && + child->GetLayoutObject().IsStacked()) { + child->SetNeedsCullRectUpdate(); + } + UpdateRecursively(context, *child); + } if (auto* embedded_content = DynamicTo<LayoutEmbeddedContent>(object)) { if (auto* embedded_view = embedded_content->GetEmbeddedContentView()) {
diff --git a/third_party/blink/renderer/core/paint/cull_rect_updater.h b/third_party/blink/renderer/core/paint/cull_rect_updater.h index 7a9bce4..cb61cc8 100644 --- a/third_party/blink/renderer/core/paint/cull_rect_updater.h +++ b/third_party/blink/renderer/core/paint/cull_rect_updater.h
@@ -29,8 +29,7 @@ STACK_ALLOCATED(); public: - explicit CullRectUpdater(PaintLayer& starting_layer) - : starting_layer_(starting_layer) {} + explicit CullRectUpdater(PaintLayer& starting_layer); void Update(); @@ -76,6 +75,7 @@ PaintLayer& starting_layer_; PropertyTreeState root_state_ = PropertyTreeState::Uninitialized(); + bool simulate_old_behavior_ = false; }; // Used when painting with a custom top-level cull rect, e.g. when printing a
diff --git a/third_party/blink/renderer/core/paint/object_paint_invalidator_test.cc b/third_party/blink/renderer/core/paint/object_paint_invalidator_test.cc index e4e0a2c..e6da083 100644 --- a/third_party/blink/renderer/core/paint/object_paint_invalidator_test.cc +++ b/third_party/blink/renderer/core/paint/object_paint_invalidator_test.cc
@@ -45,9 +45,8 @@ UpdateAllLifecyclePhasesForTest(); const auto* invalidations = &GetRasterInvalidationTracking(*GetDocument().View())->Invalidations(); - ASSERT_EQ(2u, invalidations->size()); + ASSERT_EQ(1u, invalidations->size()); EXPECT_EQ(gfx::Rect(8, 8, 100, 100), (*invalidations)[0].rect); - EXPECT_EQ(gfx::Rect(8, 8, 100, 100), (*invalidations)[1].rect); EXPECT_EQ(PaintInvalidationReason::kSelection, (*invalidations)[0].reason); GetDocument().View()->SetTracksRasterInvalidations(false); @@ -66,9 +65,8 @@ UpdateAllLifecyclePhasesForTest(); invalidations = &GetRasterInvalidationTracking(*GetDocument().View())->Invalidations(); - ASSERT_EQ(2u, invalidations->size()); + ASSERT_EQ(1u, invalidations->size()); EXPECT_EQ(gfx::Rect(8, 8, 100, 100), (*invalidations)[0].rect); - EXPECT_EQ(gfx::Rect(8, 8, 100, 100), (*invalidations)[1].rect); EXPECT_EQ(PaintInvalidationReason::kSelection, (*invalidations)[0].reason); GetDocument().View()->SetTracksRasterInvalidations(false); }
diff --git a/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.cc b/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.cc index 7eeb07c..ce397df 100644 --- a/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.cc +++ b/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.cc
@@ -439,14 +439,9 @@ const auto* client = content->GetLayoutObject()->View(); EXPECT_THAT( GetRasterInvalidationTracking()->Invalidations(), - UnorderedElementsAre( - RasterInvalidationInfo{client->Id(), client->DebugName(), - gfx::Rect(0, 100, 100, 100), - PaintInvalidationReason::kIncremental}, - RasterInvalidationInfo{client->PaintingLayer()->Id(), - client->PaintingLayer()->DebugName(), - gfx::Rect(0, 100, 100, 100), - PaintInvalidationReason::kIncremental})); + UnorderedElementsAre(RasterInvalidationInfo{ + client->Id(), client->DebugName(), gfx::Rect(0, 100, 100, 100), + PaintInvalidationReason::kIncremental})); GetDocument().View()->SetTracksRasterInvalidations(false); } @@ -518,16 +513,10 @@ UpdateAllLifecyclePhasesForTest(); // The iframe doesn't have anything visible by itself, so we only issue // raster invalidation for the frame contents. - EXPECT_THAT( - GetRasterInvalidationTracking()->Invalidations(), - UnorderedElementsAre( - RasterInvalidationInfo{client->Id(), client->DebugName(), - gfx::Rect(0, 0, 100, 200), - PaintInvalidationReason::kBackground}, - RasterInvalidationInfo{client->PaintingLayer()->Id(), - client->PaintingLayer()->DebugName(), - gfx::Rect(0, 100, 100, 100), - PaintInvalidationReason::kIncremental})); + EXPECT_THAT(GetRasterInvalidationTracking()->Invalidations(), + UnorderedElementsAre(RasterInvalidationInfo{ + client->Id(), client->DebugName(), gfx::Rect(0, 0, 100, 200), + PaintInvalidationReason::kBackground})); GetDocument().View()->SetTracksRasterInvalidations(false); }
diff --git a/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc b/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc index 3ff0be9..a545255 100644 --- a/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc +++ b/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc
@@ -1917,7 +1917,8 @@ static bool NeedsOverflowClip(const LayoutObject& object) { if (const auto* replaced = DynamicTo<LayoutReplaced>(object)) { - if (ReplacedElementAlwaysClipsToContentBox(*replaced)) + if (ReplacedElementAlwaysClipsToContentBox(*replaced) || + replaced->ClipsToContentBox()) return NeedsOverflowClipForReplacedContents(*replaced); }
diff --git a/third_party/blink/renderer/core/paint/paint_property_tree_update_tests.cc b/third_party/blink/renderer/core/paint/paint_property_tree_update_tests.cc index e5d7f1e..f3f4c65 100644 --- a/third_party/blink/renderer/core/paint/paint_property_tree_update_tests.cc +++ b/third_party/blink/renderer/core/paint/paint_property_tree_update_tests.cc
@@ -1428,19 +1428,28 @@ auto* target = GetDocument().getElementById("target"); const auto* properties = PaintPropertiesForElement("target"); - // Image elements need a clip node to clip the image to its content box. - EXPECT_NE(nullptr, properties); + // Image elements don't need a clip node if the image is clipped to its + // content box. + EXPECT_EQ(nullptr, properties); target->setAttribute(html_names::kStyleAttr, "object-fit: cover"); UpdateAllLifecyclePhasesForTest(); properties = PaintPropertiesForElement("target"); - // Image elements need a clip node to clip the image to its content box. - EXPECT_NE(nullptr, properties); + // Image elements don't need a clip node if the image is clipped to its + // content box. + EXPECT_EQ(nullptr, properties); target->setAttribute(html_names::kStyleAttr, "object-fit: none"); UpdateAllLifecyclePhasesForTest(); properties = PaintPropertiesForElement("target"); // Ditto. + EXPECT_EQ(nullptr, properties); + + target->setAttribute(html_names::kStyleAttr, + "overflow-clip-margin: padding-box;"); + UpdateAllLifecyclePhasesForTest(); + properties = PaintPropertiesForElement("target"); + // Changing overflow-clip-margin induces a clip node. EXPECT_NE(nullptr, properties); target->setAttribute(html_names::kStyleAttr,
diff --git a/third_party/blink/renderer/core/paint/replaced_painter.cc b/third_party/blink/renderer/core/paint/replaced_painter.cc index 155e12d..9774783e 100644 --- a/third_party/blink/renderer/core/paint/replaced_painter.cc +++ b/third_party/blink/renderer/core/paint/replaced_painter.cc
@@ -50,6 +50,21 @@ if (!fragment_to_paint_) return; + if (input_paint_info_.phase == PaintPhase::kForeground) { + if (auto* mf_checker = + MobileFriendlinessChecker::From(replaced.GetDocument())) { + PhysicalRect content_rect = replaced.ReplacedContentRect(); + content_rect.Move(paint_offset_); + content_rect.Intersect(PhysicalRect(GetPaintInfo().GetCullRect().Rect())); + mf_checker->NotifyPaintReplaced(content_rect, + GetPaintInfo() + .context.GetPaintController() + .CurrentPaintChunkProperties() + .Transform()); + mf_ignore_scope_.emplace(*mf_checker); + } + } + const auto* paint_properties = fragment_to_paint_->PaintProperties(); if (!paint_properties) return; @@ -76,21 +91,6 @@ new_properties, replaced, input_paint_info_.DisplayItemTypeForClipping()); } - - if (input_paint_info_.phase == PaintPhase::kForeground) { - if (auto* mf_checker = - MobileFriendlinessChecker::From(replaced.GetDocument())) { - PhysicalRect content_rect = replaced.ReplacedContentRect(); - content_rect.Move(paint_offset_); - content_rect.Intersect(PhysicalRect(GetPaintInfo().GetCullRect().Rect())); - mf_checker->NotifyPaintReplaced(content_rect, - GetPaintInfo() - .context.GetPaintController() - .CurrentPaintChunkProperties() - .Transform()); - mf_ignore_scope_.emplace(*mf_checker); - } - } } } // anonymous namespace
diff --git a/third_party/blink/renderer/core/scheduler_integration_tests/frame_throttling_test.cc b/third_party/blink/renderer/core/scheduler_integration_tests/frame_throttling_test.cc index b04ff17d..8d20f3d0 100644 --- a/third_party/blink/renderer/core/scheduler_integration_tests/frame_throttling_test.cc +++ b/third_party/blink/renderer/core/scheduler_integration_tests/frame_throttling_test.cc
@@ -1916,7 +1916,7 @@ EXPECT_FALSE(frame_document->View()->ShouldThrottleRenderingForTest()); EXPECT_EQ(gfx::Rect(0, 0, 630, 100), frame_object->FirstFragment().GetCullRect().Rect()); - EXPECT_EQ(gfx::Rect(0, 0, 400, 100), + EXPECT_EQ(gfx::Rect(0, 0, 630, 100), child_layout_view->FirstFragment().GetCullRect().Rect()); EXPECT_FALSE(child_layout_view->Layer()->NeedsCullRectUpdate()); }
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.cc b/third_party/blink/renderer/modules/accessibility/ax_object.cc index 46d77af8..c79898c 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object.cc
@@ -3381,7 +3381,7 @@ // The best available source of information is now the AX tree, so use that to // figure out whether we have focusable style. - return element->IsBaseElementFocusableStyle(GetLayoutObject()); + return element->IsBaseElementFocusableStyle(); } bool AXObject::CanSetFocusAttribute() const {
diff --git a/third_party/blink/renderer/modules/credentialmanagement/credentials_container.cc b/third_party/blink/renderer/modules/credentialmanagement/credentials_container.cc index 63a3ade..e836e77 100644 --- a/third_party/blink/renderer/modules/credentialmanagement/credentials_container.cc +++ b/third_party/blink/renderer/modules/credentialmanagement/credentials_container.cc
@@ -1230,10 +1230,13 @@ } bool prefer_auto_sign_in = options->identity()->preferAutoSignIn(); + bool show_iframe_requester = + (options->identity()->showRequester() == "both"); auto* auth_request = CredentialManagerProxy::From(script_state)->FederatedAuthRequest(); auth_request->RequestToken( std::move(identity_provider_ptrs), prefer_auto_sign_in, + show_iframe_requester, WTF::Bind(&OnRequestToken, WrapPersistent(resolver), WrapPersistent(options)));
diff --git a/third_party/blink/renderer/modules/credentialmanagement/identity_credential_request_options.idl b/third_party/blink/renderer/modules/credentialmanagement/identity_credential_request_options.idl index 55c40a4..20bfc65 100644 --- a/third_party/blink/renderer/modules/credentialmanagement/identity_credential_request_options.idl +++ b/third_party/blink/renderer/modules/credentialmanagement/identity_credential_request_options.idl
@@ -2,8 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +enum IdentityCredentialShowRequesterMode { + // Only show the domain of top level frame in the FedCM prompt. This is different + // than the frame which calls FedCM API in the case of an iframe caller. + "toplevel", + + // Show both the domain of the top level frame and the domain of the frame which + // calls FedCM API in the FedCM prompt. + "both", +}; + // https://fedidcg.github.io/FedCM/#dictdef-identitycredentialrequestoptions dictionary IdentityCredentialRequestOptions { - sequence<IdentityProvider> providers; - boolean preferAutoSignIn = false; + IdentityCredentialShowRequesterMode showRequester = "toplevel"; + sequence<IdentityProvider> providers; + boolean preferAutoSignIn = false; };
diff --git a/third_party/blink/renderer/modules/mediastream/browser_capture_media_stream_track.cc b/third_party/blink/renderer/modules/mediastream/browser_capture_media_stream_track.cc index 42faea7..4919aea 100644 --- a/third_party/blink/renderer/modules/mediastream/browser_capture_media_stream_track.cc +++ b/third_party/blink/renderer/modules/mediastream/browser_capture_media_stream_track.cc
@@ -80,7 +80,7 @@ switch (result) { case media::mojom::CropRequestResult::kSuccess: RecordUma(CropToResult::kResolved); - // TODO(crbug.com/1247761): Delay reporting success to the Web-application + // TODO(crbug.com/1264849): Delay reporting success to the Web-application // until "seeing" the last frame cropped to the previous crop-target. resolver->Resolve(); return;
diff --git a/third_party/blink/renderer/platform/animation/animation_translation_util.cc b/third_party/blink/renderer/platform/animation/animation_translation_util.cc index 65e09c1..6c101c1 100644 --- a/third_party/blink/renderer/platform/animation/animation_translation_util.cc +++ b/third_party/blink/renderer/platform/animation/animation_translation_util.cc
@@ -67,8 +67,6 @@ case TransformOperation::kTranslate: { auto* transform = static_cast<const TranslateTransformOperation*>(operation.get()); - if (!RuntimeEnabledFeatures::CompositeRelativeKeyframesEnabled()) - DCHECK(transform->X().IsFixed() && transform->Y().IsFixed()); out_transform_operations->AppendTranslate( SkDoubleToScalar(transform->X(box_size)), SkDoubleToScalar(transform->Y(box_size)),
diff --git a/third_party/blink/renderer/platform/animation/animation_translation_util_test.cc b/third_party/blink/renderer/platform/animation/animation_translation_util_test.cc index a10cd04..a78e7e5 100644 --- a/third_party/blink/renderer/platform/animation/animation_translation_util_test.cc +++ b/third_party/blink/renderer/platform/animation/animation_translation_util_test.cc
@@ -73,8 +73,6 @@ } TEST(AnimationTranslationUtilTest, RelativeTranslate) { - ScopedCompositeRelativeKeyframesForTest relative_keyframes(true); - TransformOperations ops; ops.Operations().push_back(TranslateTransformOperation::Create( Length::Percent(50), Length::Percent(50), @@ -92,8 +90,6 @@ } TEST(AnimationTranslationUtilTest, RelativeInterpolated) { - ScopedCompositeRelativeKeyframesForTest relative_keyframes(true); - TransformOperations ops_a, ops_b; ops_a.Operations().push_back(TranslateTransformOperation::Create( Length::Percent(50), Length::Fixed(0), TransformOperation::kTranslate));
diff --git a/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.cc b/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.cc index 4286591..49211dd 100644 --- a/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.cc +++ b/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.cc
@@ -180,14 +180,6 @@ "kRGBA_8888_SkColorType and kBGRA_8888_SkColorType."); SkImageInfo info = SkImageInfo::MakeN32( image_size.width(), image_size.height(), kUnpremul_SkAlphaType); - GLuint row_bytes; - if (!base::CheckedNumeric<size_t>(info.minRowBytes()) - .AssignIfValid(&row_bytes)) { - DLOG(ERROR) << "Row stride must fit in GLuint (32 bits), given stride: " - << info.minRowBytes(); - return; - } - GrSurfaceOrigin image_origin = image->IsOriginTopLeft() ? kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin; @@ -198,7 +190,8 @@ mailbox_holder.sync_token.GetConstData()); context_provider->RasterInterface()->ReadbackARGBPixelsAsync( mailbox_holder.mailbox, mailbox_holder.texture_target, image_origin, info, - row_bytes, temp_argb_frame->visible_data(media::VideoFrame::kARGBPlane), + temp_argb_frame->stride(media::VideoFrame::kARGBPlane), + temp_argb_frame->visible_data(media::VideoFrame::kARGBPlane), WTF::Bind(&StaticBitmapImageToVideoFrameCopier::OnARGBPixelsReadAsync, weak_ptr_factory_.GetWeakPtr(), image, temp_argb_frame, std::move(callback))); @@ -241,9 +234,8 @@ void StaticBitmapImageToVideoFrameCopier::OnARGBPixelsReadAsync( scoped_refptr<StaticBitmapImage> image, - scoped_refptr<media::VideoFrame> temp_argb_frame, + scoped_refptr<media::VideoFrame> argb_frame, FrameReadyCallback callback, - GrSurfaceOrigin result_origin, bool success) { DCHECK_CALLED_ON_VALID_THREAD(main_render_thread_checker_); if (!success) { @@ -253,36 +245,7 @@ ReadARGBPixelsSync(image, std::move(callback)); return; } - - // If a frame comes with BottomLeft origin it's effectively upside down. - // Frame consumers are not ready to deal with it. We can swap rows to fix it, - // but it would add an extra copy. Instead we set up a wrapper frame that - // references the same data but has color planes with negative strides, - // it forces all the code that handles frames to process rows bottom-up. - auto& coded_size = temp_argb_frame->coded_size(); - if (result_origin == kBottomLeft_GrSurfaceOrigin && coded_size.height() > 1) { - auto pixel_format = temp_argb_frame->format(); - auto argb_plane = temp_argb_frame->layout().planes()[0]; - size_t last_row_offset = - argb_plane.offset + argb_plane.stride * (coded_size.height() - 1); - media::ColorPlaneLayout reverse_argb_plane( - -argb_plane.stride, last_row_offset, argb_plane.size); - - auto layout = media::VideoFrameLayout::CreateWithPlanes( - pixel_format, coded_size, {reverse_argb_plane}) - .value(); - - size_t data_size = reverse_argb_plane.offset + reverse_argb_plane.size; - auto reverse_stride_frame = media::VideoFrame::WrapExternalDataWithLayout( - layout, gfx::Rect(coded_size), coded_size, - temp_argb_frame->data(media::VideoFrame::kARGBPlane), data_size, - temp_argb_frame->timestamp()); - - reverse_stride_frame->AddDestructionObserver(base::BindOnce( - [](scoped_refptr<media::VideoFrame>) {}, std::move(temp_argb_frame))); - temp_argb_frame = reverse_stride_frame; - } - std::move(callback).Run(std::move(temp_argb_frame)); + std::move(callback).Run(std::move(argb_frame)); } void StaticBitmapImageToVideoFrameCopier::OnYUVPixelsReadAsync(
diff --git a/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.h b/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.h index a1a11cbc..99855b2b 100644 --- a/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.h +++ b/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.h
@@ -58,7 +58,6 @@ void OnARGBPixelsReadAsync(scoped_refptr<StaticBitmapImage> image, scoped_refptr<media::VideoFrame> temp_argb_frame, FrameReadyCallback callback, - GrSurfaceOrigin result_origin, bool success); void OnYUVPixelsReadAsync(scoped_refptr<media::VideoFrame> yuv_frame, FrameReadyCallback callback,
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 0af5e60a..ec58a98b 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -410,10 +410,6 @@ status: {"Android": "stable"}, }, { - name: "CompositeRelativeKeyframes", - status: "stable" - }, - { name: "ComputedAccessibilityInfo", status: "experimental", },
diff --git a/third_party/blink/web_tests/FlagExpectations/highdpi b/third_party/blink/web_tests/FlagExpectations/highdpi index 5a6ed789..59461e3d 100644 --- a/third_party/blink/web_tests/FlagExpectations/highdpi +++ b/third_party/blink/web_tests/FlagExpectations/highdpi
@@ -1176,7 +1176,7 @@ paint/invalidation/position/absolute-position-changed.html [ Pass ] # TODO(michaelludwig): Suppressed for Skia roll, see crbug.com/1354678 -paint/invalidation/reflection/reflection-with-rotation.html [ Pass Failure ] +paint/invalidation/reflection/reflection-with-rotation.html [ Failure Pass ] paint/invalidation/scroll/destroy-composited-scrollbar.html [ Pass ] paint/invalidation/selection/selection-within-composited-scroller.html [ Pass ]
diff --git a/third_party/blink/web_tests/SmokeTests/Mac.txt b/third_party/blink/web_tests/SmokeTests/Mac.txt index 2dd2779..8b2895b 100644 --- a/third_party/blink/web_tests/SmokeTests/Mac.txt +++ b/third_party/blink/web_tests/SmokeTests/Mac.txt
@@ -285,6 +285,7 @@ external/wpt/css/css-text/white-space/pre-wrap-018.html external/wpt/css/css-text/word-break/word-break-break-all-004.html external/wpt/css/css-transforms/animation/perspective-origin-interpolation.html +external/wpt/css/css-transforms/animation/transform-interpolation-005.html external/wpt/css/css-transforms/transform-inline-001.html external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-meter-background-clip-001.html external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-meter-border-right-width-001.html @@ -1443,7 +1444,6 @@ virtual/backface-visibility-interop/paint/invalidation/window-resize/window-resize-background-image-fixed-scrolling-contents.html virtual/background-svg-in-lcp/external/wpt/largest-contentful-paint/multiple-redirects-TAO.html virtual/background-svg-in-lcp/external/wpt/largest-contentful-paint/toJSON.html -virtual/composite-relative-keyframes/external/wpt/css/css-transforms/animation/transform-interpolation-005.html virtual/compositor-threaded-percent-based-scrolling/fast/scrolling/resize-corner-tracking-touch.html virtual/compositor-threaded-percent-based-scrolling/fast/scrolling/subpixel-overflow-mouse-drag.html virtual/compositor_threaded_scrollbar_scrolling/paint/invalidation/scroll/sticky/invalidate-after-composited-scroll-with-sticky.html
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index bc6f33d..baf61d17 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -4389,6 +4389,9 @@ crbug.com/851363 http/tests/devtools/sxg/sxg-prefetch-fail.js [ Failure Pass ] crbug.com/851363 http/tests/devtools/sxg/sxg-prefetch.js [ Failure Pass ] +# Prefetching inspector protocol test is flaky +crbug.com/1347616 virtual/prefetch/http/tests/inspector-protocol/prefetch/request-will-be-sent.https.js [ Failure Pass ] + # Sheriff 2018-03-22 crbug.com/824848 external/wpt/html/semantics/links/following-hyperlinks/activation-behavior.window.html [ Failure Pass ]
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites index e788832..9f32c71 100644 --- a/third_party/blink/web_tests/VirtualTestSuites +++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -73,13 +73,6 @@ "args": ["--attribution-reporting-debug-mode"] }, { - "prefix": "composite-relative-keyframes", - "platforms": ["Linux", "Mac", "Win"], - "bases": ["external/wpt/css/css-transforms/animation"], - "args": ["--enable-threaded-compositing", - "--enable-blink-features=CompositeRelativeKeyframes"] - }, - { "prefix": "off-main-thread-css-paint", "platforms": ["Linux", "Mac", "Win"], "bases": ["external/wpt/css/css-paint-api",
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json index cfe1ce3..bf19301 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json
@@ -240293,7 +240293,7 @@ }, "popups": { "popup-animated-hide-display.tentative.html": [ - "0d9ff4a511b39d46171b025ba95b33a25557e7be", + "0bbc6b23893f34d4ea45e4fdae5be1cbe3f7f6e9", [ null, [ @@ -240306,7 +240306,7 @@ ] ], "popup-animated-hide-finishes.tentative.html": [ - "1213f4fefe4ac98b0ef7e4bc06488cb45c272a41", + "a594ecad3f273f69815604b4028b7de2152b4923", [ null, [ @@ -240319,7 +240319,7 @@ ] ], "popup-animated-show-display.tentative.html": [ - "9bcc130d8de3a319643d957a5bcb0664cf8bd83f", + "f11529c4b75bba48c3f81839ea576c24d49560dc", [ null, [ @@ -240371,7 +240371,7 @@ ] ], "popup-hidden-display.tentative.html": [ - "b3845f8270785e8ed9de588a8fc4e823b66b62e9", + "d66611a08f59b74f553d2653033b7758aa5504e9", [ null, [ @@ -240384,7 +240384,7 @@ ] ], "popup-inside-display-none.tentative.html": [ - "d60b0df9068494825a3ffd0a1dc222c3bc57edb0", + "189ffdd5ffd16dd106df58bb1536af8a2b30aa29", [ null, [ @@ -332944,10 +332944,18 @@ "456f15ff699eb36b230b5079f918cbd57ea2705a", [] ], + "background-fetch.https.html": [ + "3f1c072d108ca5b271d81118698a5e0ebc0e3649", + [] + ], "battery-status.https.html": [ "eb611175381240b483bb8776a1610286bd3b7219", [] ], + "bluetooth-access.https.html": [ + "b14b46c09cada95f9c673908cc89f10d10ecb97e", + [] + ], "broadcast-channel.html": [ "14980720a1640de6bc4141ae08d7238366f54ffa", [] @@ -333036,6 +333044,14 @@ "62829556bb438c1396a0f17c7e3b45456f2bdad9", [] ], + "screen-capture.https.html": [ + "55f1995643dfb0505e79bad4ed3eb9c2d1bad28e", + [] + ], + "screen-orientation-lock.https.html": [ + "a152e344900826058c61acbc6bce8268557702bb", + [] + ], "service-worker-unregister.html": [ "a78775a5a2c7a5724f7d97a4c3d8c6638c76f6d6", [] @@ -333076,6 +333092,10 @@ "61207ab346db4393d2045bcad3cc50da1a47e38a", [] ], + "web-share.https.html": [ + "f4e2f304718ef248ad85da0fe5e649e57987f3e9", + [] + ], "web-usb.https.html": [ "555825a81c530fe3f3e948c432412d22a7718ffc", [] @@ -385025,7 +385045,7 @@ ] ], "grid-shorthand-serialization.html": [ - "7f8ebdb986de1e90bfd059ff79229b0c42a056a8", + "5114a3e7f4635bce367b5e8d180a37c8dacf0dd3", [ null, {} @@ -405284,6 +405304,13 @@ } }, "custom-elements": { + "CustomElementRegistry-constructor-and-callbacks-are-held-strongly.html": [ + "5e741eba67e92b41105685ea14248df9b1b4b127", + [ + null, + {} + ] + ], "CustomElementRegistry.html": [ "5b75fc651fcf74685e7f6cd6e753c9cbfd44de48", [ @@ -468266,7 +468293,7 @@ ] ], "popup-redirect-cache.https.html": [ - "e56e1d551345bcecab3d89a34fd98424583898e0", + "6568ac3fdbfcfb193e65c6f6e78ad472517c52be", [ "html/cross-origin-opener-policy/popup-redirect-cache.https.html?0-1", { @@ -480284,7 +480311,7 @@ ] ], "selectmenu-parts-structure.tentative.html": [ - "2f907c4fb5307d0f17fb49dd2ba68ab859adcb6f", + "e7b0bf77055bfbee13d82187ed2a7a07166fe3e0", [ null, { @@ -481271,7 +481298,7 @@ ] ], "popup-anchor-nesting.tentative.html": [ - "aa43dd9aea0a6d6620378c36e7946586f0b4d450", + "d4982949006be510d2d57bc1c7deb09da0179f4f", [ null, { @@ -481280,7 +481307,7 @@ ] ], "popup-animated-hide-cleanup.tentative.html": [ - "00ff0db6f57fbf3f46f49b0f70ae1e21d835a16d", + "778b384f420c40f564a8e867bccb4b06d29acb74", [ null, { @@ -481289,14 +481316,14 @@ ] ], "popup-animation-corner-cases.tentative.html": [ - "e85d1f72f2f4920c1b09110c320882f1f3e287bc", + "e2298fc1752b546c705267c49083031d12bfd990", [ null, {} ] ], "popup-attribute-basic.tentative.html": [ - "1ff7f13c61d8427e85fc7c9ae4a4d82072469b99", + "4554162c3ccc9ecec7c3dabd6cbace6956cf2356", [ null, {} @@ -481310,35 +481337,35 @@ ] ], "popup-defaultopen-2.tentative.html": [ - "36b621f2cf0381272ab44d5e5f9a6c2cfd41de1f", + "83cc160c6c3befe607142f898956ab5b6033cb19", [ null, {} ] ], "popup-defaultopen-hints.tentative.html": [ - "9bc841eb772610ac846c23bee7f7a1ebfa7c2cc4", + "a7535fab2034224362a1d9039244073f50b36adc", [ null, {} ] ], "popup-defaultopen.tentative.html": [ - "f673d1d832081b9e5cea382ceeca155bc763102d", + "beb8c7468c6efb059f71e0fe2a388337b966b45a", [ null, {} ] ], "popup-events.tentative.html": [ - "4e2051f275dcc8108da2a091ad6cbd1e2de2c37e", + "441980177c38b38c5f1589e071a15ec33237bed1", [ null, {} ] ], "popup-focus.tentative.html": [ - "4290b7dda50c2e3d7b170d90f8e1e2da84eff7e0", + "f88f4c2ad83b84bbd0992b27d1107ebc5255c379", [ null, { @@ -481348,7 +481375,7 @@ ] ], "popup-invoking-attribute.tentative.html": [ - "bdfa0fe1a12a35ca9e20939bf69c076f43f7f141", + "b676eed54056c2c6b293fadc638e539827a19909", [ null, { @@ -481358,14 +481385,14 @@ ] ], "popup-light-dismiss-on-scroll.tentative.html": [ - "3c32a6dc6a992a7c4a35a3a2bef13e36e7576048", + "d48f1b4b63fe21e0c7d01e295c7a77dcc118358f", [ null, {} ] ], "popup-light-dismiss.tentative.html": [ - "7f8f32b645e8b4acf94c7b05f724d51b6d7c6365", + "7cd95d8dc23ff63f539b9ab7389d8e5f92e714fe", [ null, { @@ -481375,7 +481402,7 @@ ] ], "popup-not-keyboard-focusable.tentative.html": [ - "3cc545f9ae7e3c19626bee521ce5825f9ebf000a", + "393873fddce197407f060ee33080c2945d0b7219", [ null, { @@ -481384,21 +481411,21 @@ ] ], "popup-removal-2.tentative.html": [ - "7cf0951e5b14bcca0a6af7d8846cb4f85e8b8995", + "807e625563ef3b09f0c7dbadc35027b913def181", [ null, {} ] ], "popup-removal.tentative.html": [ - "f4df86232768080eede0e039f2a2c19c6ca29f2a", + "f43da58e4e2cb0f124af0312b90967907df369c0", [ null, {} ] ], "popup-shadow-dom.tentative.html": [ - "f2cb31a389cef0de615915830a09e055c2afa866", + "cbec8a20233cf09df8627a51ad06a698c2c24a7c", [ null, {} @@ -481412,14 +481439,14 @@ ] ], "popup-stacking.tentative.html": [ - "abe3f61996ba9ffe32bf04c0414d37f843756701", + "1bf3a108976a18e70109d763fa545280d78e0092", [ null, {} ] ], "popup-top-layer-interactions.tentative.html": [ - "e12645afc2789382b6625c96f7e6d2046addc151", + "b973a57f09731848bb2bdc11065e0969b36f8a7d", [ null, { @@ -481428,7 +481455,7 @@ ] ], "popup-types.tentative.html": [ - "b34df5f7960566006c25f02a0fffbf8a34ba5cc1", + "f9479cbc8491ca314fad2f1e4cc9b574921e4dde", [ null, {} @@ -526814,7 +526841,7 @@ }, "secure-payment-confirmation": { "authentication-accepted.https.html": [ - "1677de3f3c0b9c2f26b9b29adfd36169f9ed76de", + "03f0be2cea37d460c0874547834cea5eb57e7be1", [ null, { @@ -526832,7 +526859,7 @@ ] ], "authentication-cross-origin.sub.https.html": [ - "5ef366606cb0cba0801fe0432a4b47329d5acd9b", + "779a5f40213a1bb513e8608f6da994f989d2e440", [ null, { @@ -526850,7 +526877,7 @@ ] ], "authentication-in-iframe.sub.https.html": [ - "7c77a1750628dd4aa5a6d9e7943430e8e84f9a4d", + "79b6b5baff05b05e158213bc7942b440cef82676", [ null, { @@ -533027,6 +533054,16 @@ {} ] ], + "restriction-background-fetch.https.html": [ + "cd1550b8193a00342a874cc0700198c0d6e4584f", + [ + null, + { + "testdriver": true, + "timeout": "long" + } + ] + ], "restriction-battery-status.https.html": [ "80e25b08e723a73a75235608c9d902065b96eadd", [ @@ -533036,6 +533073,15 @@ } ] ], + "restriction-bluetooth.tentative.https.html": [ + "243a5d5a74f12b3eacebcd1a348a01b0d05bc3e8", + [ + null, + { + "timeout": "long" + } + ] + ], "restriction-broadcast-channel.html": [ "7225e64cf9848921de4e33982e733104265daa43", [ @@ -533073,6 +533119,24 @@ } ] ], + "restriction-screen-capture.https.html": [ + "e4b958d338a9a88eddf26a369993142cec1e2508", + [ + null, + { + "timeout": "long" + } + ] + ], + "restriction-screen-orientation-lock.https.html": [ + "7c2be6acecefe214e010ee9e32cc6126f3e6ba16", + [ + null, + { + "timeout": "long" + } + ] + ], "restriction-service-worker-postmessage.https.html": [ "1f8afb5aa24399ea085dca8471ecce4fcf6e55c0", [ @@ -533118,6 +533182,15 @@ } ] ], + "restriction-web-share.https.html": [ + "3bc071d5b497ef4e690f68222793b818811445cd", + [ + null, + { + "timeout": "long" + } + ] + ], "restriction-web-usb.https.html": [ "9d96a39c9c5528e3c0d41ba013343b6a4cbf0528", [
diff --git a/third_party/blink/web_tests/external/wpt/custom-elements/CustomElementRegistry-constructor-and-callbacks-are-held-strongly.html b/third_party/blink/web_tests/external/wpt/custom-elements/CustomElementRegistry-constructor-and-callbacks-are-held-strongly.html new file mode 100644 index 0000000..5e741eb --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/custom-elements/CustomElementRegistry-constructor-and-callbacks-are-held-strongly.html
@@ -0,0 +1,84 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CustomElementInterface holds constructors and callbacks strongly, preventing them from being GCed if there are no other references</title> +<link rel="help" href="https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-lifecycle-callbacks"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/garbage-collect.js"></script> + +<body> +<div id="customElementsRoot"></div> +<iframe id="emptyIframe" srcdoc></iframe> +<script> +"use strict"; + +const tagNames = [...new Array(100)].map((_, i) => `x-foo${i}`); +const delay = (t, ms) => new Promise(resolve => { t.step_timeout(resolve, ms); }); + +const connectedCallbackCalls = new Set; +const disconnectedCallbackCalls = new Set; +const attributeChangedCallbackCalls = new Set; +const adoptedCallbackCalls = new Set; + +for (const tagName of tagNames) { + const constructor = class extends HTMLElement { + connectedCallback() { connectedCallbackCalls.add(tagName); } + disconnectedCallback() { disconnectedCallbackCalls.add(tagName); } + attributeChangedCallback() { attributeChangedCallbackCalls.add(tagName); } + adoptedCallback() { adoptedCallbackCalls.add(tagName); } + }; + + constructor.observedAttributes = ["foo"]; + + customElements.define(tagName, constructor); + + delete constructor.prototype.connectedCallback; + delete constructor.prototype.disconnectedCallback; + delete constructor.prototype.attributeChangedCallback; + delete constructor.prototype.adoptedCallback; +} + +promise_test(async t => { + await maybeGarbageCollectAsync(); + + assert_true(tagNames.every(tagName => typeof customElements.get(tagName) === "function")); +}, "constructor"); + +promise_test(async t => { + await maybeGarbageCollectAsync(); + for (const tagName of tagNames) { + customElementsRoot.append(document.createElement(tagName)); + } + + await delay(t, 10); + assert_equals(connectedCallbackCalls.size, tagNames.length); +}, "connectedCallback"); + +promise_test(async t => { + await maybeGarbageCollectAsync(); + for (const xFoo of customElementsRoot.children) { + xFoo.setAttribute("foo", "bar"); + } + + await delay(t, 10); + assert_equals(attributeChangedCallbackCalls.size, tagNames.length); +}, "attributeChangedCallback"); + +promise_test(async t => { + await maybeGarbageCollectAsync(); + customElementsRoot.innerHTML = ""; + + await delay(t, 10); + assert_equals(disconnectedCallbackCalls.size, tagNames.length); +}, "disconnectedCallback"); + +promise_test(async t => { + await maybeGarbageCollectAsync(); + for (const tagName of tagNames) { + emptyIframe.contentDocument.adoptNode(document.createElement(tagName)); + } + + await delay(t, 10); + assert_equals(adoptedCallbackCalls.size, tagNames.length); +}, "adoptedCallback"); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/secure-payment-confirmation/authentication-accepted.https.html b/third_party/blink/web_tests/external/wpt/secure-payment-confirmation/authentication-accepted.https.html index 1677de3..03f0be2 100644 --- a/third_party/blink/web_tests/external/wpt/secure-payment-confirmation/authentication-accepted.https.html +++ b/third_party/blink/web_tests/external/wpt/secure-payment-confirmation/authentication-accepted.https.html
@@ -58,7 +58,7 @@ assert_false(clientDataJSON.crossOrigin); // Payment-specific information. - assert_equals(clientDataJSON.payment.rp, window.location.hostname); + assert_equals(clientDataJSON.payment.rpId, window.location.hostname); assert_equals(clientDataJSON.payment.topOrigin, window.location.origin); assert_equals(clientDataJSON.payment.payeeOrigin, payeeOrigin); assert_equals(clientDataJSON.payment.total.value, PAYMENT_DETAILS.total.amount.value); @@ -66,6 +66,13 @@ assert_equals(clientDataJSON.payment.instrument.icon, ICON_URL); assert_equals(clientDataJSON.payment.instrument.displayName, displayName); + // If the User Agent still supports the legacy 'rp' output parameter, it + // should be identical to the 'rpId' output parameter. See + // https://github.com/w3c/secure-payment-confirmation/pull/198 + if ('rp' in clientDataJSON.payment) { + assert_equals(clientDataJSON.payment.rp, clientDataJSON.payment.rpId); + } + // TODO: Verify cred.response.signature, to validate that it covers all fields // from clientDataJSON. }, 'Successful SPC authentication');
diff --git a/third_party/blink/web_tests/external/wpt/secure-payment-confirmation/authentication-cross-origin.sub.https.html b/third_party/blink/web_tests/external/wpt/secure-payment-confirmation/authentication-cross-origin.sub.https.html index 5ef3666..779a5f4 100644 --- a/third_party/blink/web_tests/external/wpt/secure-payment-confirmation/authentication-cross-origin.sub.https.html +++ b/third_party/blink/web_tests/external/wpt/secure-payment-confirmation/authentication-cross-origin.sub.https.html
@@ -66,6 +66,6 @@ // The origin should be ourselves, whilst the RP should be the alt hostname // (as the owner of the credential). assert_equals(clientDataJSON.origin, window.location.origin); - assert_equals(clientDataJSON.payment.rp, '{{hosts[alt][]}}'); + assert_equals(clientDataJSON.payment.rpId, '{{hosts[alt][]}}'); }, 'Cross-origin SPC authentication ceremony'); </script>
diff --git a/third_party/blink/web_tests/external/wpt/secure-payment-confirmation/authentication-in-iframe.sub.https.html b/third_party/blink/web_tests/external/wpt/secure-payment-confirmation/authentication-in-iframe.sub.https.html index 7c77a17..79b6b5b 100644 --- a/third_party/blink/web_tests/external/wpt/secure-payment-confirmation/authentication-in-iframe.sub.https.html +++ b/third_party/blink/web_tests/external/wpt/secure-payment-confirmation/authentication-in-iframe.sub.https.html
@@ -75,7 +75,7 @@ assert_equals(result.clientDataJSON.origin, 'https://{{hosts[alt][]}}:{{ports[https][0]}}'); assert_equals(result.clientDataJSON.payment.topOrigin, window.location.origin); // The credential was created in this frame, and so we are the rp. - assert_equals(result.clientDataJSON.payment.rp, window.location.hostname); + assert_equals(result.clientDataJSON.payment.rpId, window.location.hostname); // The payeeOrigin should be unrelated to what the origin and topOrigin are. assert_equals(result.clientDataJSON.payment.payeeOrigin, 'https://merchant.com'); }, 'SPC authentication ceremony in cross-origin iframe');
diff --git a/third_party/blink/web_tests/fast/frames/frame-inherit-noresize-from-frameset.html b/third_party/blink/web_tests/fast/frames/frame-inherit-noresize-from-frameset.html index 63e744a..6b7cb03 100644 --- a/third_party/blink/web_tests/fast/frames/frame-inherit-noresize-from-frameset.html +++ b/third_party/blink/web_tests/fast/frames/frame-inherit-noresize-from-frameset.html
@@ -18,6 +18,8 @@ description("This tests that a frame inherits the noresize attribute of its parent frameset by default. Note, this behavior doesn't seem to conform to any W3C spec or MSDN documentation. See WebKit Bug 57604."); setTestFrameById("testFrame"); shouldDisallowFrameResize(); + document.body.removeAttribute("noresize"); + shouldAllowFrameResize(); } </script> </head>
diff --git a/third_party/blink/web_tests/flag-specific/disable-layout-ng/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png b/third_party/blink/web_tests/flag-specific/disable-layout-ng/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png new file mode 100644 index 0000000..64f2ff1 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/disable-layout-ng/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/non-text-link-invalidation-optimization-expected.txt b/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/non-text-link-invalidation-optimization-expected.txt index 3518d8a2..23259046 100644 --- a/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/non-text-link-invalidation-optimization-expected.txt +++ b/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/non-text-link-invalidation-optimization-expected.txt
@@ -6,9 +6,11 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [75, 8, 234, 19], + [164, 8, 145, 19], + [75, 8, 61, 19], [8, 8, 57, 19], [353, 8, 52, 19], + [136, 8, 28, 19], [319, 8, 24, 19], [343, 13, 10, 10], [309, 13, 10, 10],
diff --git a/third_party/blink/web_tests/platform/linux/virtual/plz-dedicated-worker/http/tests/devtools/layers/layer-canvas-log-expected.txt b/third_party/blink/web_tests/flag-specific/disable-layout-ng/virtual/plz-dedicated-worker/http/tests/devtools/layers/layer-canvas-log-expected.txt similarity index 88% rename from third_party/blink/web_tests/platform/linux/virtual/plz-dedicated-worker/http/tests/devtools/layers/layer-canvas-log-expected.txt rename to third_party/blink/web_tests/flag-specific/disable-layout-ng/virtual/plz-dedicated-worker/http/tests/devtools/layers/layer-canvas-log-expected.txt index 70db387c..c458c28 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/plz-dedicated-worker/http/tests/devtools/layers/layer-canvas-log-expected.txt +++ b/third_party/blink/web_tests/flag-specific/disable-layout-ng/virtual/plz-dedicated-worker/http/tests/devtools/layers/layer-canvas-log-expected.txt
@@ -41,33 +41,6 @@ } 10 : { commandIndex : 10 - method : "save" - params : undefined - } - 11 : { - commandIndex : 11 - method : "translate" - params : { - dx : 0 - dy : 71 - } - } - 12 : { - commandIndex : 12 - method : "clipRect" - params : { - SkRegion::Op : "kIntersect_Op" - rect : { - bottom : 150 - left : 0 - right : 300 - top : 0 - } - softClipEdgeStyle : true - } - } - 13 : { - commandIndex : 13 method : "drawRect" params : { paint : { @@ -87,8 +60,8 @@ } } } - 14 : { - commandIndex : 14 + 11 : { + commandIndex : 11 method : "restore" params : undefined } @@ -120,25 +93,6 @@ } 4 : { commandIndex : 4 - method : "clipRect" - params : { - SkRegion::Op : "kIntersect_Op" - rect : { - bottom : 71 - left : 0 - right : 19 - top : 50 - } - softClipEdgeStyle : true - } - } - 5 : { - commandIndex : 5 - method : "save" - params : undefined - } - 6 : { - commandIndex : 6 method : "concat44" params : { matrix44 : [ @@ -161,8 +115,8 @@ ] } } - 7 : { - commandIndex : 7 + 5 : { + commandIndex : 5 method : "drawImage" params : { image : { @@ -187,15 +141,37 @@ top : 0 } } - 8 : { - commandIndex : 8 + 6 : { + commandIndex : 6 method : "restore" params : undefined } + 7 : { + commandIndex : 7 + method : "save" + params : undefined + } + 8 : { + commandIndex : 8 + method : "translate" + params : { + dx : 0 + dy : 71 + } + } 9 : { commandIndex : 9 - method : "restore" - params : undefined + method : "clipRect" + params : { + SkRegion::Op : "kIntersect_Op" + rect : { + bottom : 150 + left : 0 + right : 300 + top : 0 + } + softClipEdgeStyle : true + } } }
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/compositing/backface-visibility/backface-visibility-image-expected.png b/third_party/blink/web_tests/flag-specific/highdpi/compositing/backface-visibility/backface-visibility-image-expected.png index d252643..ecf48a8 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/compositing/backface-visibility/backface-visibility-image-expected.png +++ b/third_party/blink/web_tests/flag-specific/highdpi/compositing/backface-visibility/backface-visibility-image-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/paint/invalidation/image/image-resize-expected.txt b/third_party/blink/web_tests/flag-specific/highdpi/paint/invalidation/image/image-resize-expected.txt index 8354ad6d..42a2b153 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/paint/invalidation/image/image-resize-expected.txt +++ b/third_party/blink/web_tests/flag-specific/highdpi/paint/invalidation/image/image-resize-expected.txt
@@ -6,8 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [0, 75, 150, 300], - [150, 75, 75, 225] + [0, 75, 225, 225], + [0, 75, 150, 300] ] } ]
diff --git a/third_party/blink/web_tests/platform/fuchsia/compositing/images/clip-on-directly-composited-image-expected.txt b/third_party/blink/web_tests/platform/fuchsia/compositing/images/clip-on-directly-composited-image-expected.txt new file mode 100644 index 0000000..1c9bba9 --- /dev/null +++ b/third_party/blink/web_tests/platform/fuchsia/compositing/images/clip-on-directly-composited-image-expected.txt
@@ -0,0 +1,29 @@ +{ + "layers": [ + { + "name": "Scrolling background of LayoutView #document", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutImage (positioned) IMG class='composited'", + "position": [10, 10], + "bounds": [140, 140], + "contentsOpaqueForText": true, + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [200, 13, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/fuchsia/fast/replaced/selection-rect-transform-expected.png b/third_party/blink/web_tests/platform/fuchsia/fast/replaced/selection-rect-transform-expected.png index 1c81b67..16a6ab87 100644 --- a/third_party/blink/web_tests/platform/fuchsia/fast/replaced/selection-rect-transform-expected.png +++ b/third_party/blink/web_tests/platform/fuchsia/fast/replaced/selection-rect-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/fuchsia/paint/invalidation/selection/selected-replaced-expected.txt b/third_party/blink/web_tests/platform/fuchsia/paint/invalidation/selection/selected-replaced-expected.txt new file mode 100644 index 0000000..9613d4d --- /dev/null +++ b/third_party/blink/web_tests/platform/fuchsia/paint/invalidation/selection/selected-replaced-expected.txt
@@ -0,0 +1,15 @@ +{ + "layers": [ + { + "name": "Scrolling background of LayoutView #document", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [8, 132, 214, 232], + [8, 52, 214, 232] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/generic/compositing/images/clip-on-directly-composited-image-expected.txt b/third_party/blink/web_tests/platform/generic/compositing/images/clip-on-directly-composited-image-expected.txt index d8c247b..1c9bba9 100644 --- a/third_party/blink/web_tests/platform/generic/compositing/images/clip-on-directly-composited-image-expected.txt +++ b/third_party/blink/web_tests/platform/generic/compositing/images/clip-on-directly-composited-image-expected.txt
@@ -8,7 +8,8 @@ }, { "name": "LayoutImage (positioned) IMG class='composited'", - "bounds": [200, 200], + "position": [10, 10], + "bounds": [140, 140], "contentsOpaqueForText": true, "transform": 1 }
diff --git a/third_party/blink/web_tests/platform/generic/compositing/lots-of-img-layers-expected.png b/third_party/blink/web_tests/platform/generic/compositing/lots-of-img-layers-expected.png index 19553e16..b52a953 100644 --- a/third_party/blink/web_tests/platform/generic/compositing/lots-of-img-layers-expected.png +++ b/third_party/blink/web_tests/platform/generic/compositing/lots-of-img-layers-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/generic/compositing/lots-of-img-layers-with-opacity-expected.png b/third_party/blink/web_tests/platform/generic/compositing/lots-of-img-layers-with-opacity-expected.png index 9bc8619..c081fa9 100644 --- a/third_party/blink/web_tests/platform/generic/compositing/lots-of-img-layers-with-opacity-expected.png +++ b/third_party/blink/web_tests/platform/generic/compositing/lots-of-img-layers-with-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/generic/fast/frames/frame-inherit-noresize-from-frameset-expected.txt b/third_party/blink/web_tests/platform/generic/fast/frames/frame-inherit-noresize-from-frameset-expected.txt index cc4318ce..bafbbf49 100644 --- a/third_party/blink/web_tests/platform/generic/fast/frames/frame-inherit-noresize-from-frameset-expected.txt +++ b/third_party/blink/web_tests/platform/generic/fast/frames/frame-inherit-noresize-from-frameset-expected.txt
@@ -11,4 +11,5 @@ This tests that a frame inherits the noresize attribute of its parent frameset by default. Note, this behavior doesn't seem to conform to any W3C spec or MSDN documentation. See WebKit Bug 57604. PASS document.getElementById("testFrame").getBoundingClientRect().width is 200 +PASS document.getElementById("testFrame").getBoundingClientRect().width is 210
diff --git a/third_party/blink/web_tests/platform/generic/http/tests/devtools/layers/layer-canvas-log-expected.txt b/third_party/blink/web_tests/platform/generic/http/tests/devtools/layers/layer-canvas-log-expected.txt index 70db387c..c458c28 100644 --- a/third_party/blink/web_tests/platform/generic/http/tests/devtools/layers/layer-canvas-log-expected.txt +++ b/third_party/blink/web_tests/platform/generic/http/tests/devtools/layers/layer-canvas-log-expected.txt
@@ -41,33 +41,6 @@ } 10 : { commandIndex : 10 - method : "save" - params : undefined - } - 11 : { - commandIndex : 11 - method : "translate" - params : { - dx : 0 - dy : 71 - } - } - 12 : { - commandIndex : 12 - method : "clipRect" - params : { - SkRegion::Op : "kIntersect_Op" - rect : { - bottom : 150 - left : 0 - right : 300 - top : 0 - } - softClipEdgeStyle : true - } - } - 13 : { - commandIndex : 13 method : "drawRect" params : { paint : { @@ -87,8 +60,8 @@ } } } - 14 : { - commandIndex : 14 + 11 : { + commandIndex : 11 method : "restore" params : undefined } @@ -120,25 +93,6 @@ } 4 : { commandIndex : 4 - method : "clipRect" - params : { - SkRegion::Op : "kIntersect_Op" - rect : { - bottom : 71 - left : 0 - right : 19 - top : 50 - } - softClipEdgeStyle : true - } - } - 5 : { - commandIndex : 5 - method : "save" - params : undefined - } - 6 : { - commandIndex : 6 method : "concat44" params : { matrix44 : [ @@ -161,8 +115,8 @@ ] } } - 7 : { - commandIndex : 7 + 5 : { + commandIndex : 5 method : "drawImage" params : { image : { @@ -187,15 +141,37 @@ top : 0 } } - 8 : { - commandIndex : 8 + 6 : { + commandIndex : 6 method : "restore" params : undefined } + 7 : { + commandIndex : 7 + method : "save" + params : undefined + } + 8 : { + commandIndex : 8 + method : "translate" + params : { + dx : 0 + dy : 71 + } + } 9 : { commandIndex : 9 - method : "restore" - params : undefined + method : "clipRect" + params : { + SkRegion::Op : "kIntersect_Op" + rect : { + bottom : 150 + left : 0 + right : 300 + top : 0 + } + softClipEdgeStyle : true + } } }
diff --git a/third_party/blink/web_tests/platform/generic/paint/invalidation/image/image-resize-expected.txt b/third_party/blink/web_tests/platform/generic/paint/invalidation/image/image-resize-expected.txt index 575e960..ff9ad0a 100644 --- a/third_party/blink/web_tests/platform/generic/paint/invalidation/image/image-resize-expected.txt +++ b/third_party/blink/web_tests/platform/generic/paint/invalidation/image/image-resize-expected.txt
@@ -6,8 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [0, 50, 100, 200], - [100, 50, 50, 150] + [0, 50, 150, 150], + [0, 50, 100, 200] ] } ]
diff --git a/third_party/blink/web_tests/platform/generic/paint/invalidation/image/percent-size-image-resize-container-expected.txt b/third_party/blink/web_tests/platform/generic/paint/invalidation/image/percent-size-image-resize-container-expected.txt index 575e960..ff9ad0a 100644 --- a/third_party/blink/web_tests/platform/generic/paint/invalidation/image/percent-size-image-resize-container-expected.txt +++ b/third_party/blink/web_tests/platform/generic/paint/invalidation/image/percent-size-image-resize-container-expected.txt
@@ -6,8 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [0, 50, 100, 200], - [100, 50, 50, 150] + [0, 50, 150, 150], + [0, 50, 100, 200] ] } ]
diff --git a/third_party/blink/web_tests/platform/generic/virtual/scalefactor200/css3/filters/composited-reflected-expected.png b/third_party/blink/web_tests/platform/generic/virtual/scalefactor200/css3/filters/composited-reflected-expected.png index a926cc9..1c4a4ee 100644 --- a/third_party/blink/web_tests/platform/generic/virtual/scalefactor200/css3/filters/composited-reflected-expected.png +++ b/third_party/blink/web_tests/platform/generic/virtual/scalefactor200/css3/filters/composited-reflected-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/generic/virtual/scalefactor200/css3/filters/effect-reference-subregion-chained-hw-expected.png b/third_party/blink/web_tests/platform/generic/virtual/scalefactor200/css3/filters/effect-reference-subregion-chained-hw-expected.png index 0567d1a..5f431971 100644 --- a/third_party/blink/web_tests/platform/generic/virtual/scalefactor200/css3/filters/effect-reference-subregion-chained-hw-expected.png +++ b/third_party/blink/web_tests/platform/generic/virtual/scalefactor200/css3/filters/effect-reference-subregion-chained-hw-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/compositing/direct-image-compositing-expected.png b/third_party/blink/web_tests/platform/linux/compositing/direct-image-compositing-expected.png index d000b491..1065126 100644 --- a/third_party/blink/web_tests/platform/linux/compositing/direct-image-compositing-expected.png +++ b/third_party/blink/web_tests/platform/linux/compositing/direct-image-compositing-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/compositing/lots-of-img-layers-expected.png b/third_party/blink/web_tests/platform/linux/compositing/lots-of-img-layers-expected.png index 2bef65f..7ac052f 100644 --- a/third_party/blink/web_tests/platform/linux/compositing/lots-of-img-layers-expected.png +++ b/third_party/blink/web_tests/platform/linux/compositing/lots-of-img-layers-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/compositing/lots-of-img-layers-with-opacity-expected.png b/third_party/blink/web_tests/platform/linux/compositing/lots-of-img-layers-with-opacity-expected.png index 9feec27b..73166da 100644 --- a/third_party/blink/web_tests/platform/linux/compositing/lots-of-img-layers-with-opacity-expected.png +++ b/third_party/blink/web_tests/platform/linux/compositing/lots-of-img-layers-with-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/frames/iframe-scaling-with-scroll-expected.png b/third_party/blink/web_tests/platform/linux/fast/frames/iframe-scaling-with-scroll-expected.png index 316ec90..2ac8ce9 100644 --- a/third_party/blink/web_tests/platform/linux/fast/frames/iframe-scaling-with-scroll-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/frames/iframe-scaling-with-scroll-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/replaced/selection-rect-transform-expected.png b/third_party/blink/web_tests/platform/linux/fast/replaced/selection-rect-transform-expected.png index 8d781f2..d768bd3 100644 --- a/third_party/blink/web_tests/platform/linux/fast/replaced/selection-rect-transform-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/replaced/selection-rect-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png b/third_party/blink/web_tests/platform/linux/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png index b8c41ef..64f2ff1 100644 --- a/third_party/blink/web_tests/platform/linux/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/composited-reflected-expected.png b/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/composited-reflected-expected.png index eb1dfc4..8cdd4f86 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/composited-reflected-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/composited-reflected-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-blur-hw-expected.png b/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-blur-hw-expected.png index 1531084..86f5795 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-blur-hw-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-blur-hw-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-reference-colorspace-hw-expected.png b/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-reference-colorspace-hw-expected.png index a989e1c4..ddecfb7 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-reference-colorspace-hw-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-reference-colorspace-hw-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-reference-hw-expected.png b/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-reference-hw-expected.png index 5db2406..35c4f0e 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-reference-hw-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-reference-hw-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-reference-subregion-chained-hw-expected.png b/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-reference-subregion-chained-hw-expected.png index 21822697f..0beadcd 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-reference-subregion-chained-hw-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/scalefactor200/css3/filters/effect-reference-subregion-chained-hw-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/overflow/overflow-update-transform-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/overflow/overflow-update-transform-expected.png index 9e752d0..f13ddef 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/fast/overflow/overflow-update-transform-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/overflow/overflow-update-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/compositing/direct-image-compositing-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/compositing/direct-image-compositing-expected.png index 4e9e1c9..103a86e8 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/compositing/direct-image-compositing-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/compositing/direct-image-compositing-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/compositing/lots-of-img-layers-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/compositing/lots-of-img-layers-expected.png index 605f037..0389d73 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/compositing/lots-of-img-layers-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/compositing/lots-of-img-layers-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/compositing/lots-of-img-layers-with-opacity-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/compositing/lots-of-img-layers-with-opacity-expected.png index af8deae..38f4c4af 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/compositing/lots-of-img-layers-with-opacity-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/compositing/lots-of-img-layers-with-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/composite-relative-keyframes/external/wpt/css/css-transforms/animation/perspective-origin-interpolation-expected.txt b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/composite-relative-keyframes/external/wpt/css/css-transforms/animation/perspective-origin-interpolation-expected.txt deleted file mode 100644 index aa5c600..0000000 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/composite-relative-keyframes/external/wpt/css/css-transforms/animation/perspective-origin-interpolation-expected.txt +++ /dev/null
@@ -1,124 +0,0 @@ -This is a testharness.js-based test. -Found 120 tests; 112 PASS, 8 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS CSS Transitions: property <perspective-origin> from neutral to [20px 20px] at (-0.3) should be [7px 33px] -PASS CSS Transitions: property <perspective-origin> from neutral to [20px 20px] at (0) should be [10px 30px] -PASS CSS Transitions: property <perspective-origin> from neutral to [20px 20px] at (0.3) should be [13px 27px] -PASS CSS Transitions: property <perspective-origin> from neutral to [20px 20px] at (0.6) should be [16px 24px] -PASS CSS Transitions: property <perspective-origin> from neutral to [20px 20px] at (1) should be [20px 20px] -PASS CSS Transitions: property <perspective-origin> from neutral to [20px 20px] at (1.5) should be [25px 15px] -PASS CSS Transitions with transition: all: property <perspective-origin> from neutral to [20px 20px] at (-0.3) should be [7px 33px] -PASS CSS Transitions with transition: all: property <perspective-origin> from neutral to [20px 20px] at (0) should be [10px 30px] -PASS CSS Transitions with transition: all: property <perspective-origin> from neutral to [20px 20px] at (0.3) should be [13px 27px] -PASS CSS Transitions with transition: all: property <perspective-origin> from neutral to [20px 20px] at (0.6) should be [16px 24px] -PASS CSS Transitions with transition: all: property <perspective-origin> from neutral to [20px 20px] at (1) should be [20px 20px] -PASS CSS Transitions with transition: all: property <perspective-origin> from neutral to [20px 20px] at (1.5) should be [25px 15px] -PASS CSS Animations: property <perspective-origin> from neutral to [20px 20px] at (-0.3) should be [7px 33px] -PASS CSS Animations: property <perspective-origin> from neutral to [20px 20px] at (0) should be [10px 30px] -PASS CSS Animations: property <perspective-origin> from neutral to [20px 20px] at (0.3) should be [13px 27px] -PASS CSS Animations: property <perspective-origin> from neutral to [20px 20px] at (0.6) should be [16px 24px] -PASS CSS Animations: property <perspective-origin> from neutral to [20px 20px] at (1) should be [20px 20px] -PASS CSS Animations: property <perspective-origin> from neutral to [20px 20px] at (1.5) should be [25px 15px] -PASS Web Animations: property <perspective-origin> from neutral to [20px 20px] at (-0.3) should be [7px 33px] -PASS Web Animations: property <perspective-origin> from neutral to [20px 20px] at (0) should be [10px 30px] -PASS Web Animations: property <perspective-origin> from neutral to [20px 20px] at (0.3) should be [13px 27px] -PASS Web Animations: property <perspective-origin> from neutral to [20px 20px] at (0.6) should be [16px 24px] -PASS Web Animations: property <perspective-origin> from neutral to [20px 20px] at (1) should be [20px 20px] -PASS Web Animations: property <perspective-origin> from neutral to [20px 20px] at (1.5) should be [25px 15px] -FAIL CSS Transitions: property <perspective-origin> from [initial] to [20px 20px] at (-0.3) should be [26.5px 26.5px] assert_equals: expected "26.5px 26.5px " but got "26.48px 26.48px " -PASS CSS Transitions: property <perspective-origin> from [initial] to [20px 20px] at (0) should be [25px 25px] -PASS CSS Transitions: property <perspective-origin> from [initial] to [20px 20px] at (0.3) should be [23.5px 23.5px] -PASS CSS Transitions: property <perspective-origin> from [initial] to [20px 20px] at (0.6) should be [22px 22px] -PASS CSS Transitions: property <perspective-origin> from [initial] to [20px 20px] at (1) should be [20px 20px] -PASS CSS Transitions: property <perspective-origin> from [initial] to [20px 20px] at (1.5) should be [17.5px 17.5px] -FAIL CSS Transitions with transition: all: property <perspective-origin> from [initial] to [20px 20px] at (-0.3) should be [26.5px 26.5px] assert_equals: expected "26.5px 26.5px " but got "26.48px 26.48px " -PASS CSS Transitions with transition: all: property <perspective-origin> from [initial] to [20px 20px] at (0) should be [25px 25px] -PASS CSS Transitions with transition: all: property <perspective-origin> from [initial] to [20px 20px] at (0.3) should be [23.5px 23.5px] -PASS CSS Transitions with transition: all: property <perspective-origin> from [initial] to [20px 20px] at (0.6) should be [22px 22px] -PASS CSS Transitions with transition: all: property <perspective-origin> from [initial] to [20px 20px] at (1) should be [20px 20px] -PASS CSS Transitions with transition: all: property <perspective-origin> from [initial] to [20px 20px] at (1.5) should be [17.5px 17.5px] -FAIL CSS Animations: property <perspective-origin> from [initial] to [20px 20px] at (-0.3) should be [26.5px 26.5px] assert_equals: expected "26.5px 26.5px " but got "26.48px 26.48px " -PASS CSS Animations: property <perspective-origin> from [initial] to [20px 20px] at (0) should be [25px 25px] -PASS CSS Animations: property <perspective-origin> from [initial] to [20px 20px] at (0.3) should be [23.5px 23.5px] -PASS CSS Animations: property <perspective-origin> from [initial] to [20px 20px] at (0.6) should be [22px 22px] -PASS CSS Animations: property <perspective-origin> from [initial] to [20px 20px] at (1) should be [20px 20px] -PASS CSS Animations: property <perspective-origin> from [initial] to [20px 20px] at (1.5) should be [17.5px 17.5px] -FAIL Web Animations: property <perspective-origin> from [initial] to [20px 20px] at (-0.3) should be [26.5px 26.5px] assert_equals: expected "26.5px 26.5px " but got "26.48px 26.48px " -PASS Web Animations: property <perspective-origin> from [initial] to [20px 20px] at (0) should be [25px 25px] -PASS Web Animations: property <perspective-origin> from [initial] to [20px 20px] at (0.3) should be [23.5px 23.5px] -PASS Web Animations: property <perspective-origin> from [initial] to [20px 20px] at (0.6) should be [22px 22px] -PASS Web Animations: property <perspective-origin> from [initial] to [20px 20px] at (1) should be [20px 20px] -PASS Web Animations: property <perspective-origin> from [initial] to [20px 20px] at (1.5) should be [17.5px 17.5px] -PASS CSS Transitions: property <perspective-origin> from [inherit] to [20px 20px] at (-0.3) should be [33px 7px] -PASS CSS Transitions: property <perspective-origin> from [inherit] to [20px 20px] at (0) should be [30px 10px] -PASS CSS Transitions: property <perspective-origin> from [inherit] to [20px 20px] at (0.3) should be [27px 13px] -PASS CSS Transitions: property <perspective-origin> from [inherit] to [20px 20px] at (0.6) should be [24px 16px] -PASS CSS Transitions: property <perspective-origin> from [inherit] to [20px 20px] at (1) should be [20px 20px] -PASS CSS Transitions: property <perspective-origin> from [inherit] to [20px 20px] at (1.5) should be [15px 25px] -PASS CSS Transitions with transition: all: property <perspective-origin> from [inherit] to [20px 20px] at (-0.3) should be [33px 7px] -PASS CSS Transitions with transition: all: property <perspective-origin> from [inherit] to [20px 20px] at (0) should be [30px 10px] -PASS CSS Transitions with transition: all: property <perspective-origin> from [inherit] to [20px 20px] at (0.3) should be [27px 13px] -PASS CSS Transitions with transition: all: property <perspective-origin> from [inherit] to [20px 20px] at (0.6) should be [24px 16px] -PASS CSS Transitions with transition: all: property <perspective-origin> from [inherit] to [20px 20px] at (1) should be [20px 20px] -PASS CSS Transitions with transition: all: property <perspective-origin> from [inherit] to [20px 20px] at (1.5) should be [15px 25px] -PASS CSS Animations: property <perspective-origin> from [inherit] to [20px 20px] at (-0.3) should be [33px 7px] -PASS CSS Animations: property <perspective-origin> from [inherit] to [20px 20px] at (0) should be [30px 10px] -PASS CSS Animations: property <perspective-origin> from [inherit] to [20px 20px] at (0.3) should be [27px 13px] -PASS CSS Animations: property <perspective-origin> from [inherit] to [20px 20px] at (0.6) should be [24px 16px] -PASS CSS Animations: property <perspective-origin> from [inherit] to [20px 20px] at (1) should be [20px 20px] -PASS CSS Animations: property <perspective-origin> from [inherit] to [20px 20px] at (1.5) should be [15px 25px] -PASS Web Animations: property <perspective-origin> from [inherit] to [20px 20px] at (-0.3) should be [33px 7px] -PASS Web Animations: property <perspective-origin> from [inherit] to [20px 20px] at (0) should be [30px 10px] -PASS Web Animations: property <perspective-origin> from [inherit] to [20px 20px] at (0.3) should be [27px 13px] -PASS Web Animations: property <perspective-origin> from [inherit] to [20px 20px] at (0.6) should be [24px 16px] -PASS Web Animations: property <perspective-origin> from [inherit] to [20px 20px] at (1) should be [20px 20px] -PASS Web Animations: property <perspective-origin> from [inherit] to [20px 20px] at (1.5) should be [15px 25px] -FAIL CSS Transitions: property <perspective-origin> from [unset] to [20px 20px] at (-0.3) should be [26.5px 26.5px] assert_equals: expected "26.5px 26.5px " but got "26.48px 26.48px " -PASS CSS Transitions: property <perspective-origin> from [unset] to [20px 20px] at (0) should be [25px 25px] -PASS CSS Transitions: property <perspective-origin> from [unset] to [20px 20px] at (0.3) should be [23.5px 23.5px] -PASS CSS Transitions: property <perspective-origin> from [unset] to [20px 20px] at (0.6) should be [22px 22px] -PASS CSS Transitions: property <perspective-origin> from [unset] to [20px 20px] at (1) should be [20px 20px] -PASS CSS Transitions: property <perspective-origin> from [unset] to [20px 20px] at (1.5) should be [17.5px 17.5px] -FAIL CSS Transitions with transition: all: property <perspective-origin> from [unset] to [20px 20px] at (-0.3) should be [26.5px 26.5px] assert_equals: expected "26.5px 26.5px " but got "26.48px 26.48px " -PASS CSS Transitions with transition: all: property <perspective-origin> from [unset] to [20px 20px] at (0) should be [25px 25px] -PASS CSS Transitions with transition: all: property <perspective-origin> from [unset] to [20px 20px] at (0.3) should be [23.5px 23.5px] -PASS CSS Transitions with transition: all: property <perspective-origin> from [unset] to [20px 20px] at (0.6) should be [22px 22px] -PASS CSS Transitions with transition: all: property <perspective-origin> from [unset] to [20px 20px] at (1) should be [20px 20px] -PASS CSS Transitions with transition: all: property <perspective-origin> from [unset] to [20px 20px] at (1.5) should be [17.5px 17.5px] -FAIL CSS Animations: property <perspective-origin> from [unset] to [20px 20px] at (-0.3) should be [26.5px 26.5px] assert_equals: expected "26.5px 26.5px " but got "26.48px 26.48px " -PASS CSS Animations: property <perspective-origin> from [unset] to [20px 20px] at (0) should be [25px 25px] -PASS CSS Animations: property <perspective-origin> from [unset] to [20px 20px] at (0.3) should be [23.5px 23.5px] -PASS CSS Animations: property <perspective-origin> from [unset] to [20px 20px] at (0.6) should be [22px 22px] -PASS CSS Animations: property <perspective-origin> from [unset] to [20px 20px] at (1) should be [20px 20px] -PASS CSS Animations: property <perspective-origin> from [unset] to [20px 20px] at (1.5) should be [17.5px 17.5px] -FAIL Web Animations: property <perspective-origin> from [unset] to [20px 20px] at (-0.3) should be [26.5px 26.5px] assert_equals: expected "26.5px 26.5px " but got "26.48px 26.48px " -PASS Web Animations: property <perspective-origin> from [unset] to [20px 20px] at (0) should be [25px 25px] -PASS Web Animations: property <perspective-origin> from [unset] to [20px 20px] at (0.3) should be [23.5px 23.5px] -PASS Web Animations: property <perspective-origin> from [unset] to [20px 20px] at (0.6) should be [22px 22px] -PASS Web Animations: property <perspective-origin> from [unset] to [20px 20px] at (1) should be [20px 20px] -PASS Web Animations: property <perspective-origin> from [unset] to [20px 20px] at (1.5) should be [17.5px 17.5px] -PASS CSS Transitions: property <perspective-origin> from [0% 50%] to [100% 150%] at (-0.3) should be [-30% 20%] -PASS CSS Transitions: property <perspective-origin> from [0% 50%] to [100% 150%] at (0) should be [0% 50%] -PASS CSS Transitions: property <perspective-origin> from [0% 50%] to [100% 150%] at (0.3) should be [30% 80%] -PASS CSS Transitions: property <perspective-origin> from [0% 50%] to [100% 150%] at (0.6) should be [60% 110%] -PASS CSS Transitions: property <perspective-origin> from [0% 50%] to [100% 150%] at (1) should be [100% 150%] -PASS CSS Transitions: property <perspective-origin> from [0% 50%] to [100% 150%] at (1.5) should be [150% 200%] -PASS CSS Transitions with transition: all: property <perspective-origin> from [0% 50%] to [100% 150%] at (-0.3) should be [-30% 20%] -PASS CSS Transitions with transition: all: property <perspective-origin> from [0% 50%] to [100% 150%] at (0) should be [0% 50%] -PASS CSS Transitions with transition: all: property <perspective-origin> from [0% 50%] to [100% 150%] at (0.3) should be [30% 80%] -PASS CSS Transitions with transition: all: property <perspective-origin> from [0% 50%] to [100% 150%] at (0.6) should be [60% 110%] -PASS CSS Transitions with transition: all: property <perspective-origin> from [0% 50%] to [100% 150%] at (1) should be [100% 150%] -PASS CSS Transitions with transition: all: property <perspective-origin> from [0% 50%] to [100% 150%] at (1.5) should be [150% 200%] -PASS CSS Animations: property <perspective-origin> from [0% 50%] to [100% 150%] at (-0.3) should be [-30% 20%] -PASS CSS Animations: property <perspective-origin> from [0% 50%] to [100% 150%] at (0) should be [0% 50%] -PASS CSS Animations: property <perspective-origin> from [0% 50%] to [100% 150%] at (0.3) should be [30% 80%] -PASS CSS Animations: property <perspective-origin> from [0% 50%] to [100% 150%] at (0.6) should be [60% 110%] -PASS CSS Animations: property <perspective-origin> from [0% 50%] to [100% 150%] at (1) should be [100% 150%] -PASS CSS Animations: property <perspective-origin> from [0% 50%] to [100% 150%] at (1.5) should be [150% 200%] -PASS Web Animations: property <perspective-origin> from [0% 50%] to [100% 150%] at (-0.3) should be [-30% 20%] -PASS Web Animations: property <perspective-origin> from [0% 50%] to [100% 150%] at (0) should be [0% 50%] -PASS Web Animations: property <perspective-origin> from [0% 50%] to [100% 150%] at (0.3) should be [30% 80%] -PASS Web Animations: property <perspective-origin> from [0% 50%] to [100% 150%] at (0.6) should be [60% 110%] -PASS Web Animations: property <perspective-origin> from [0% 50%] to [100% 150%] at (1) should be [100% 150%] -PASS Web Animations: property <perspective-origin> from [0% 50%] to [100% 150%] at (1.5) should be [150% 200%] -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/compositing/direct-image-compositing-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/compositing/direct-image-compositing-expected.png index 4e9e1c9..103a86e8 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/compositing/direct-image-compositing-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/compositing/direct-image-compositing-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/compositing/lots-of-img-layers-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/compositing/lots-of-img-layers-expected.png index 605f037..0389d73 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/compositing/lots-of-img-layers-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/compositing/lots-of-img-layers-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/compositing/lots-of-img-layers-with-opacity-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/compositing/lots-of-img-layers-with-opacity-expected.png index af8deae..38f4c4af 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/compositing/lots-of-img-layers-with-opacity-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/compositing/lots-of-img-layers-with-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/compositing/direct-image-compositing-expected.png b/third_party/blink/web_tests/platform/mac/compositing/direct-image-compositing-expected.png index df770ed7..aa006d6b 100644 --- a/third_party/blink/web_tests/platform/mac/compositing/direct-image-compositing-expected.png +++ b/third_party/blink/web_tests/platform/mac/compositing/direct-image-compositing-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/frames/iframe-scaling-with-scroll-expected.png b/third_party/blink/web_tests/platform/mac/fast/frames/iframe-scaling-with-scroll-expected.png index f563ee3..2501c4a 100644 --- a/third_party/blink/web_tests/platform/mac/fast/frames/iframe-scaling-with-scroll-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/frames/iframe-scaling-with-scroll-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/overflow/overflow-update-transform-expected.png b/third_party/blink/web_tests/platform/mac/fast/overflow/overflow-update-transform-expected.png index 37c050ab..696b202 100644 --- a/third_party/blink/web_tests/platform/mac/fast/overflow/overflow-update-transform-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/overflow/overflow-update-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/replaced/selection-rect-transform-expected.png b/third_party/blink/web_tests/platform/mac/fast/replaced/selection-rect-transform-expected.png index f6b53d60..46fb3ae 100644 --- a/third_party/blink/web_tests/platform/mac/fast/replaced/selection-rect-transform-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/replaced/selection-rect-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png b/third_party/blink/web_tests/platform/mac/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png index f2341be8..aa832e3 100644 --- a/third_party/blink/web_tests/platform/mac/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/position/shift-relative-positioned-container-with-image-addition-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/position/shift-relative-positioned-container-with-image-addition-expected.txt index 57fab27..55d29c5 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/position/shift-relative-positioned-container-with-image-addition-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/position/shift-relative-positioned-container-with-image-addition-expected.txt
@@ -9,7 +9,7 @@ [0, 735, 785, 94], [8, 86, 732, 94], [58, 230, 489, 537], - [58, 136, 489, 94] + [58, 136, 489, 537] ] }, {
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/position/shift-relative-positioned-container-with-image-removal-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/position/shift-relative-positioned-container-with-image-removal-expected.txt index f2025f20..373bbd9 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/position/shift-relative-positioned-container-with-image-removal-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/position/shift-relative-positioned-container-with-image-removal-expected.txt
@@ -8,7 +8,7 @@ "invalidations": [ [8, 86, 732, 94], [58, 136, 489, 537], - [58, 673, 489, 62] + [58, 234, 489, 501] ] }, {
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/selected-replaced-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/selected-replaced-expected.txt index 0f242259..728f0c9 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/selected-replaced-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/selected-replaced-expected.txt
@@ -6,8 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [8, 68, 214, 232], - [8, 300, 214, 80] + [8, 148, 214, 232], + [8, 68, 214, 232] ] } ]
diff --git a/third_party/blink/web_tests/platform/mac/virtual/scalefactor200/css3/filters/effect-reference-colorspace-hw-expected.png b/third_party/blink/web_tests/platform/mac/virtual/scalefactor200/css3/filters/effect-reference-colorspace-hw-expected.png index aea1188..59f8d865 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/scalefactor200/css3/filters/effect-reference-colorspace-hw-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/scalefactor200/css3/filters/effect-reference-colorspace-hw-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/scalefactor200/css3/filters/effect-reference-hw-expected.png b/third_party/blink/web_tests/platform/mac/virtual/scalefactor200/css3/filters/effect-reference-hw-expected.png index 1015305..52b3bb79 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/scalefactor200/css3/filters/effect-reference-hw-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/scalefactor200/css3/filters/effect-reference-hw-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/compositing/direct-image-compositing-expected.png b/third_party/blink/web_tests/platform/win/compositing/direct-image-compositing-expected.png index dade3c6..17f5a6f7 100644 --- a/third_party/blink/web_tests/platform/win/compositing/direct-image-compositing-expected.png +++ b/third_party/blink/web_tests/platform/win/compositing/direct-image-compositing-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/frames/iframe-scaling-with-scroll-expected.png b/third_party/blink/web_tests/platform/win/fast/frames/iframe-scaling-with-scroll-expected.png index 1056586..1b6f267e 100644 --- a/third_party/blink/web_tests/platform/win/fast/frames/iframe-scaling-with-scroll-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/frames/iframe-scaling-with-scroll-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/overflow/overflow-update-transform-expected.png b/third_party/blink/web_tests/platform/win/fast/overflow/overflow-update-transform-expected.png index 6a20a1c..7620000 100644 --- a/third_party/blink/web_tests/platform/win/fast/overflow/overflow-update-transform-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/overflow/overflow-update-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/replaced/selection-rect-transform-expected.png b/third_party/blink/web_tests/platform/win/fast/replaced/selection-rect-transform-expected.png index 43ccfc4..7bdc69e 100644 --- a/third_party/blink/web_tests/platform/win/fast/replaced/selection-rect-transform-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/replaced/selection-rect-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png b/third_party/blink/web_tests/platform/win/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png index c2ddd13c..efd71c08 100644 --- a/third_party/blink/web_tests/platform/win/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/paint/invalidation/position/shift-relative-positioned-container-with-image-addition-expected.txt b/third_party/blink/web_tests/platform/win/paint/invalidation/position/shift-relative-positioned-container-with-image-addition-expected.txt index 2bf8c09..a7313d1 100644 --- a/third_party/blink/web_tests/platform/win/paint/invalidation/position/shift-relative-positioned-container-with-image-addition-expected.txt +++ b/third_party/blink/web_tests/platform/win/paint/invalidation/position/shift-relative-positioned-container-with-image-addition-expected.txt
@@ -9,7 +9,7 @@ [0, 742, 785, 94], [8, 92, 732, 94], [58, 236, 489, 537], - [58, 142, 489, 94] + [58, 142, 489, 537] ] }, {
diff --git a/third_party/blink/web_tests/platform/win/paint/invalidation/position/shift-relative-positioned-container-with-image-removal-expected.txt b/third_party/blink/web_tests/platform/win/paint/invalidation/position/shift-relative-positioned-container-with-image-removal-expected.txt index 0874ed6..4dccc5c9 100644 --- a/third_party/blink/web_tests/platform/win/paint/invalidation/position/shift-relative-positioned-container-with-image-removal-expected.txt +++ b/third_party/blink/web_tests/platform/win/paint/invalidation/position/shift-relative-positioned-container-with-image-removal-expected.txt
@@ -8,7 +8,7 @@ "invalidations": [ [8, 92, 732, 94], [58, 142, 489, 537], - [58, 679, 489, 63] + [58, 241, 489, 501] ] }, {
diff --git a/third_party/blink/web_tests/platform/win/paint/invalidation/selection/selected-replaced-expected.txt b/third_party/blink/web_tests/platform/win/paint/invalidation/selection/selected-replaced-expected.txt index f7dd438..9613d4d 100644 --- a/third_party/blink/web_tests/platform/win/paint/invalidation/selection/selected-replaced-expected.txt +++ b/third_party/blink/web_tests/platform/win/paint/invalidation/selection/selected-replaced-expected.txt
@@ -6,8 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [8, 52, 214, 232], - [8, 284, 214, 80] + [8, 132, 214, 232], + [8, 52, 214, 232] ] } ]
diff --git a/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/effect-blur-hw-expected.png b/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/effect-blur-hw-expected.png index 8252d78f..b93bbcd7 100644 --- a/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/effect-blur-hw-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/effect-blur-hw-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/effect-reference-colorspace-hw-expected.png b/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/effect-reference-colorspace-hw-expected.png index 14e1758..2fd3d545 100644 --- a/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/effect-reference-colorspace-hw-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/effect-reference-colorspace-hw-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/effect-reference-hw-expected.png b/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/effect-reference-hw-expected.png index 763634c..a2e4be5 100644 --- a/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/effect-reference-hw-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/effect-reference-hw-expected.png Binary files differ
diff --git a/third_party/boringssl/BUILD.generated_tests.gni b/third_party/boringssl/BUILD.generated_tests.gni index 10aef173..ad1446d 100644 --- a/third_party/boringssl/BUILD.generated_tests.gni +++ b/third_party/boringssl/BUILD.generated_tests.gni
@@ -191,6 +191,21 @@ "src/crypto/x509/test/many_names1.pem", "src/crypto/x509/test/many_names2.pem", "src/crypto/x509/test/many_names3.pem", + "src/crypto/x509/test/pss_sha1.pem", + "src/crypto/x509/test/pss_sha1_explicit.pem", + "src/crypto/x509/test/pss_sha1_mgf1_syntax_error.pem", + "src/crypto/x509/test/pss_sha224.pem", + "src/crypto/x509/test/pss_sha256.pem", + "src/crypto/x509/test/pss_sha256_explicit_trailer.pem", + "src/crypto/x509/test/pss_sha256_mgf1_sha384.pem", + "src/crypto/x509/test/pss_sha256_mgf1_syntax_error.pem", + "src/crypto/x509/test/pss_sha256_omit_nulls.pem", + "src/crypto/x509/test/pss_sha256_salt31.pem", + "src/crypto/x509/test/pss_sha256_salt_overflow.pem", + "src/crypto/x509/test/pss_sha256_unknown_mgf.pem", + "src/crypto/x509/test/pss_sha256_wrong_trailer.pem", + "src/crypto/x509/test/pss_sha384.pem", + "src/crypto/x509/test/pss_sha512.pem", "src/crypto/x509/test/some_names1.pem", "src/crypto/x509/test/some_names2.pem", "src/crypto/x509/test/some_names3.pem",
diff --git a/third_party/libaom/BUILD.gn b/third_party/libaom/BUILD.gn index 49dbee3..4f5b56c 100644 --- a/third_party/libaom/BUILD.gn +++ b/third_party/libaom/BUILD.gn
@@ -36,6 +36,8 @@ } else { cpu_arch_full = "arm" } +} else if (current_cpu == "riscv64") { + cpu_arch_full = "generic" } else { cpu_arch_full = current_cpu }
diff --git a/third_party/libzip/README.chromium b/third_party/libzip/README.chromium index 26eb699..c0a1ce3 100644 --- a/third_party/libzip/README.chromium +++ b/third_party/libzip/README.chromium
@@ -19,9 +19,10 @@ - Add static file zipconfig.h that is generated normally by the build system (patches/0001-add-built-zip_err_str.c.patch) - Add static file zip_err_str.c that is generated normally by the build system (patches/0001-add-built-zipconf.h.patch) - Modify config.h and zipconfig.h to handle multi-platform build (patches/0001-patch-configs.patch) +- Replaces uses of sprintf with snprintf (patches/0001-Replace-usage-of-sprintf-with-snprintf.patch) Update Process: 1) Clone the libzip github repo at the desired commit into src/ 2) Generate the static files by running make in the src/ directory 3) Apply each patch listed above residing in patches/ using `git apply patches/$PATCHFILE`, this - should add the three files listed in the modifications section above \ No newline at end of file + should add and update the files listed in the modifications section above \ No newline at end of file
diff --git a/third_party/libzip/patches/0001-Replace-usage-of-sprintf-with-snprintf.patch b/third_party/libzip/patches/0001-Replace-usage-of-sprintf-with-snprintf.patch new file mode 100644 index 0000000..a077463 --- /dev/null +++ b/third_party/libzip/patches/0001-Replace-usage-of-sprintf-with-snprintf.patch
@@ -0,0 +1,78 @@ +From 740c39a00040ae0dd3c7fe46f2962ffafc5dbd1a Mon Sep 17 00:00:00 2001 +From: Rohit Rao <rohitrao@chromium.org> +Date: Thu, 25 Aug 2022 16:03:07 -0400 +Subject: [PATCH] Replace usage of sprintf with snprintf. + +--- + third_party/libzip/src/lib/zip_error_strerror.c | 7 ++++--- + .../libzip/src/lib/zip_source_file_stdio_named.c | 10 ++++++---- + 2 files changed, 10 insertions(+), 7 deletions(-) + +diff --git a/third_party/libzip/src/lib/zip_error_strerror.c b/third_party/libzip/src/lib/zip_error_strerror.c +index 93b24eab1786e..895a51e6fa63a 100644 +--- a/third_party/libzip/src/lib/zip_error_strerror.c ++++ b/third_party/libzip/src/lib/zip_error_strerror.c +@@ -48,7 +48,7 @@ zip_error_strerror(zip_error_t *err) { + zip_error_fini(err); + + if (err->zip_err < 0 || err->zip_err >= _zip_nerr_str) { +- sprintf(buf, "Unknown error %d", err->zip_err); ++ snprintf(buf, 128, "Unknown error %d", err->zip_err); + zs = NULL; + ss = buf; + } +@@ -72,10 +72,11 @@ zip_error_strerror(zip_error_t *err) { + if (ss == NULL) + return zs; + else { +- if ((s = (char *)malloc(strlen(ss) + (zs ? strlen(zs) + 2 : 0) + 1)) == NULL) ++ size_t length = strlen(ss) + (zs ? strlen(zs) + 2 : 0) + 1; ++ if ((s = (char *)malloc(length)) == NULL) + return _zip_err_str[ZIP_ER_MEMORY]; + +- sprintf(s, "%s%s%s", (zs ? zs : ""), (zs ? ": " : ""), ss); ++ snprintf(s, length, "%s%s%s", (zs ? zs : ""), (zs ? ": " : ""), ss); + err->str = s; + + return s; +diff --git a/third_party/libzip/src/lib/zip_source_file_stdio_named.c b/third_party/libzip/src/lib/zip_source_file_stdio_named.c +index dae8177c49697..97c1301ab460d 100644 +--- a/third_party/libzip/src/lib/zip_source_file_stdio_named.c ++++ b/third_party/libzip/src/lib/zip_source_file_stdio_named.c +@@ -129,7 +129,8 @@ _zip_stdio_op_create_temp_output(zip_source_file_context_t *ctx) { + FILE *tfp; + struct stat st; + +- if ((temp = (char *)malloc(strlen(ctx->fname) + 8)) == NULL) { ++ size_t temp_size = strlen(ctx->fname) + 8; ++ if ((temp = (char *)malloc(temp_size)) == NULL) { + zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0); + return -1; + } +@@ -141,7 +142,7 @@ _zip_stdio_op_create_temp_output(zip_source_file_context_t *ctx) { + mode = -1; + } + +- sprintf(temp, "%s.XXXXXX", ctx->fname); ++ snprintf(temp, temp_size, "%s.XXXXXX", ctx->fname); + + if ((tfd = _zip_mkstempm(temp, mode)) == -1) { + zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno); +@@ -174,11 +175,12 @@ _zip_stdio_op_create_temp_output_cloning(zip_source_file_context_t *ctx, zip_uin + return -1; + } + +- if ((temp = (char *)malloc(strlen(ctx->fname) + 8)) == NULL) { ++ size_t temp_size = strlen(ctx->fname) + 8; ++ if ((temp = (char *)malloc(temp_size)) == NULL) { + zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0); + return -1; + } +- sprintf(temp, "%s.XXXXXX", ctx->fname); ++ snprintf(temp, temp_size, "%s.XXXXXX", ctx->fname); + + #ifdef HAVE_CLONEFILE + #ifndef __clang_analyzer__ +-- +2.37.2.672.g94769d06f0-goog +
diff --git a/third_party/libzip/src/lib/zip_error_strerror.c b/third_party/libzip/src/lib/zip_error_strerror.c index 93b24ea..7acabe8 100644 --- a/third_party/libzip/src/lib/zip_error_strerror.c +++ b/third_party/libzip/src/lib/zip_error_strerror.c
@@ -48,7 +48,7 @@ zip_error_fini(err); if (err->zip_err < 0 || err->zip_err >= _zip_nerr_str) { - sprintf(buf, "Unknown error %d", err->zip_err); + snprintf(buf, 128, "Unknown error %d", err->zip_err); zs = NULL; ss = buf; } @@ -72,10 +72,11 @@ if (ss == NULL) return zs; else { - if ((s = (char *)malloc(strlen(ss) + (zs ? strlen(zs) + 2 : 0) + 1)) == NULL) + size_t length = strlen(ss) + (zs ? strlen(zs) + 2 : 0) + 1; + if ((s = (char *)malloc(length)) == NULL) return _zip_err_str[ZIP_ER_MEMORY]; - sprintf(s, "%s%s%s", (zs ? zs : ""), (zs ? ": " : ""), ss); + snprintf(s, length, "%s%s%s", (zs ? zs : ""), (zs ? ": " : ""), ss); err->str = s; return s;
diff --git a/third_party/libzip/src/lib/zip_source_file_stdio_named.c b/third_party/libzip/src/lib/zip_source_file_stdio_named.c index dae8177c..f4223c7 100644 --- a/third_party/libzip/src/lib/zip_source_file_stdio_named.c +++ b/third_party/libzip/src/lib/zip_source_file_stdio_named.c
@@ -129,7 +129,8 @@ FILE *tfp; struct stat st; - if ((temp = (char *)malloc(strlen(ctx->fname) + 8)) == NULL) { + size_t temp_size = strlen(ctx->fname) + 8; + if ((temp = (char *)malloc(temp_size)) == NULL) { zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0); return -1; } @@ -141,7 +142,7 @@ mode = -1; } - sprintf(temp, "%s.XXXXXX", ctx->fname); + snprintf(temp, temp_size, "%s.XXXXXX", ctx->fname); if ((tfd = _zip_mkstempm(temp, mode)) == -1) { zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno); @@ -174,11 +175,12 @@ return -1; } - if ((temp = (char *)malloc(strlen(ctx->fname) + 8)) == NULL) { + size_t temp_size = strlen(ctx->fname) + 8; + if ((temp = (char *)malloc(temp_size)) == NULL) { zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0); return -1; } - sprintf(temp, "%s.XXXXXX", ctx->fname); + snprintf(temp, temp_size, "%s.XXXXXX", ctx->fname); #ifdef HAVE_CLONEFILE #ifndef __clang_analyzer__
diff --git a/third_party/zlib/README.chromium b/third_party/zlib/README.chromium index 697542d..3db8b7a 100644 --- a/third_party/zlib/README.chromium +++ b/third_party/zlib/README.chromium
@@ -1,8 +1,8 @@ Name: zlib Short Name: zlib URL: http://zlib.net/ -Version: 1.2.12 -CPEPrefix: cpe:/a:zlib:zlib:1.2.12 +Version: 1.2.12.1 +CPEPrefix: cpe:/a:zlib:zlib:1.2.12.1 Security Critical: yes License: Custom license License File: LICENSE @@ -27,6 +27,6 @@ - Plus the changes in 'patches' folder. - Code in contrib/ other than contrib/minizip was added to match zlib's contributor layout. - - In sync with 1.2.12 release plus a few fixes from 'develop' branch. + - In sync with 1.2.12.1 develop branch. - ZIP reader modified to allow for progress callbacks during extraction. - ZIP reader modified to add detection of AES encrypted content.
diff --git a/third_party/zlib/contrib/optimizations/inflate.c b/third_party/zlib/contrib/optimizations/inflate.c index 9e4c086..18b3239 100644 --- a/third_party/zlib/contrib/optimizations/inflate.c +++ b/third_party/zlib/contrib/optimizations/inflate.c
@@ -776,8 +776,9 @@ if (copy > have) copy = have; if (copy) { if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; + state->head->extra != Z_NULL && + (len = state->head->extra_len - state->length) < + state->head->extra_max) { zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy);
diff --git a/third_party/zlib/contrib/tests/infcover.cc b/third_party/zlib/contrib/tests/infcover.cc index 16dd744..2ab0a4be 100644 --- a/third_party/zlib/contrib/tests/infcover.cc +++ b/third_party/zlib/contrib/tests/infcover.cc
@@ -683,4 +683,64 @@ Z_STREAM_END); } +/* Adapted from Evgeny Legerov PoC (https://github.com/ivd38/zlib_overflow) + * this test case crashes in ASAN builds with the correct payload. + */ +local void inf_cve_2022_37434(char *hex, char *what, unsigned step, int win, unsigned len, + int err) +{ + int ret; + unsigned have; + unsigned char *in, *out; + z_stream strm, copy; + gz_header head; + + mem_setup(&strm); + strm.avail_in = 0; + strm.next_in = Z_NULL; + ret = inflateInit2(&strm, win); + if (ret != Z_OK) { + mem_done(&strm, what); + return; + } + out = static_cast<unsigned char *>(malloc(len)); assert(out != NULL); + if (win == 47) { + head.extra = out; + head.extra_max = len; + head.name = out; + head.name_max = len; + head.comment = out; + head.comm_max = len; + ret = inflateGetHeader(&strm, &head); assert(ret == Z_OK); + } + in = h2b(hex, &have); assert(in != NULL); + if (step == 0 || step > have) + step = have; + strm.avail_in = step; + have -= step; + strm.next_in = in; + do { + strm.avail_out = len; + strm.next_out = out; + ret = inflate(&strm, Z_NO_FLUSH); + if (ret != Z_OK && ret != Z_BUF_ERROR && ret != Z_NEED_DICT) + break; + have += strm.avail_in; + strm.avail_in = step > have ? have : step; + have -= strm.avail_in; + } while (strm.avail_in); + free(in); + free(out); + ret = inflateReset2(&strm, -8); + ret = inflateEnd(&strm); + mem_done(&strm, what); +} + +void cover_CVE_2022_37434(void) +{ + char payload[] = "1f 8b 08 04 61 62 63 64 61 62 52 51 1f 8b 08 04 61 62 63 64 61 62 52 51 1f 8b 08 04 61 62 63 64 61 62 52 51 1f 8b 08 04 61 62 63 64 61 62 52 51"; + char cve[] = "wtf"; + inf_cve_2022_37434(payload, cve, 13, 47, 12, Z_OK); +} + // clang-format on
diff --git a/third_party/zlib/contrib/tests/infcover.h b/third_party/zlib/contrib/tests/infcover.h index b3e112f..dbf67d7 100644 --- a/third_party/zlib/contrib/tests/infcover.h +++ b/third_party/zlib/contrib/tests/infcover.h
@@ -8,4 +8,5 @@ void cover_trees(void); void cover_fast(void); +void cover_CVE_2022_37434(void); #endif
diff --git a/third_party/zlib/contrib/tests/utils_unittest.cc b/third_party/zlib/contrib/tests/utils_unittest.cc index 52360b0..6ef90841 100644 --- a/third_party/zlib/contrib/tests/utils_unittest.cc +++ b/third_party/zlib/contrib/tests/utils_unittest.cc
@@ -68,6 +68,10 @@ cover_fast(); } +TEST(ZlibTest, InflateCVE) { + cover_CVE_2022_37434(); +} + TEST(ZlibTest, DeflateStored) { const int no_compression = 0; const zlib_internal::WrapperType type = zlib_internal::WrapperType::GZIP;
diff --git a/third_party/zlib/crc32.c b/third_party/zlib/crc32.c index 142f1e8..12f0d9e1 100644 --- a/third_party/zlib/crc32.c +++ b/third_party/zlib/crc32.c
@@ -651,8 +651,8 @@ len &= 7; /* Do three interleaved CRCs to realize the throughput of one crc32x - instruction per cycle. Each CRC is calcuated on Z_BATCH words. The three - CRCs are combined into a single CRC after each set of batches. */ + instruction per cycle. Each CRC is calculated on Z_BATCH words. The + three CRCs are combined into a single CRC after each set of batches. */ while (num >= 3 * Z_BATCH) { crc1 = 0; crc2 = 0; @@ -1138,7 +1138,7 @@ uLong crc2; z_off_t len2; { - return crc32_combine64(crc1, crc2, len2); + return crc32_combine64(crc1, crc2, (z_off64_t)len2); } /* ========================================================================= */ uLong ZEXPORT crc32_combine_gen64(len2) @@ -1154,7 +1154,7 @@ uLong ZEXPORT crc32_combine_gen(len2) z_off_t len2; { - return crc32_combine_gen64(len2); + return crc32_combine_gen64((z_off64_t)len2); } /* ========================================================================= */
diff --git a/third_party/zlib/deflate.c b/third_party/zlib/deflate.c index 09d1655..0b6c1357 100644 --- a/third_party/zlib/deflate.c +++ b/third_party/zlib/deflate.c
@@ -65,7 +65,7 @@ #endif const char deflate_copyright[] = - " deflate 1.2.12 Copyright 1995-2022 Jean-loup Gailly and Mark Adler "; + " deflate 1.2.12.1 Copyright 1995-2022 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -1736,7 +1736,7 @@ * * deflate_stored() is written to minimize the number of times an input byte is * copied. It is most efficient with large input and output buffers, which - * maximizes the opportunites to have a single copy from next_in to next_out. + * maximizes the opportunities to have a single copy from next_in to next_out. */ local block_state deflate_stored(s, flush) deflate_state *s;
diff --git a/third_party/zlib/infback.c b/third_party/zlib/infback.c index d760657..509c251d9 100644 --- a/third_party/zlib/infback.c +++ b/third_party/zlib/infback.c
@@ -66,6 +66,7 @@ state->window = window; state->wnext = 0; state->whave = 0; + state->sane = 1; return Z_OK; } @@ -606,25 +607,27 @@ break; case DONE: - /* inflate stream terminated properly -- write leftover output */ + /* inflate stream terminated properly */ ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } goto inf_leave; case BAD: ret = Z_DATA_ERROR; goto inf_leave; - default: /* can't happen, but makes compilers happy */ + default: + /* can't happen, but makes compilers happy */ ret = Z_STREAM_ERROR; goto inf_leave; } - /* Return unused input */ + /* Write leftover output and return unused input */ inf_leave: + if (left < state->wsize) { + if (out(out_desc, state->window, state->wsize - left) && + ret == Z_STREAM_END) + ret = Z_BUF_ERROR; + } strm->next_in = next; strm->avail_in = have; return ret;
diff --git a/third_party/zlib/inflate.c b/third_party/zlib/inflate.c index c2d19027..b304229a 100644 --- a/third_party/zlib/inflate.c +++ b/third_party/zlib/inflate.c
@@ -765,8 +765,9 @@ if (copy > have) copy = have; if (copy) { if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; + state->head->extra != Z_NULL && + (len = state->head->extra_len - state->length) < + state->head->extra_max) { zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy);
diff --git a/third_party/zlib/inftrees.c b/third_party/zlib/inftrees.c index 09462a74..3fb7bba 100644 --- a/third_party/zlib/inftrees.c +++ b/third_party/zlib/inftrees.c
@@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.2.12 Copyright 1995-2022 Mark Adler "; + " inflate 1.2.12.1 Copyright 1995-2022 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -62,7 +62,7 @@ 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 202}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 76, 202}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
diff --git a/third_party/zlib/inftrees.h b/third_party/zlib/inftrees.h index baa53a0..f536653 100644 --- a/third_party/zlib/inftrees.h +++ b/third_party/zlib/inftrees.h
@@ -38,7 +38,7 @@ /* Maximum size of the dynamic table. The maximum number of code structures is 1444, which is the sum of 852 for literal/length codes and 592 for distance codes. These values were found by exhaustive searches using the program - examples/enough.c found in the zlib distribtution. The arguments to that + examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes returns returns 852, and "enough 30 6 15" for distance codes returns 592.
diff --git a/third_party/zlib/trees.c b/third_party/zlib/trees.c index 8b438cc..72b521f 100644 --- a/third_party/zlib/trees.c +++ b/third_party/zlib/trees.c
@@ -312,7 +312,7 @@ } /* =========================================================================== - * Genererate the file trees.h describing the static trees. + * Generate the file trees.h describing the static trees. */ #ifdef GEN_TREES_H # ifndef ZLIB_DEBUG
diff --git a/third_party/zlib/zlib.h b/third_party/zlib/zlib.h index c64d67a..8fe9011 100644 --- a/third_party/zlib/zlib.h +++ b/third_party/zlib/zlib.h
@@ -1,5 +1,5 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.12, March 11th, 2022 + version 1.2.12.1, March xxth, 2022 Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler @@ -37,12 +37,12 @@ extern "C" { #endif -#define ZLIB_VERSION "1.2.12" -#define ZLIB_VERNUM 0x12c0 +#define ZLIB_VERSION "1.2.12.1-motley" +#define ZLIB_VERNUM 0x12c1 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 #define ZLIB_VER_REVISION 12 -#define ZLIB_VER_SUBREVISION 0 +#define ZLIB_VER_SUBREVISION 1 /* The 'zlib' compression library provides in-memory compression and @@ -276,7 +276,7 @@ == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. See deflatePending(), - which can be used if desired to determine whether or not there is more ouput + which can be used if desired to determine whether or not there is more output in that case. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to @@ -359,7 +359,6 @@ continue compressing. */ - ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. @@ -660,7 +659,7 @@ to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If deflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. + Similarly, if dictLength is Z_NULL, then it is not set. deflateGetDictionary() may return a length less than the window size, even when more than the window size in input has been provided. It may return up @@ -915,7 +914,7 @@ to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If inflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. + Similarly, if dictLength is Z_NULL, then it is not set. inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the stream state is inconsistent. @@ -1437,12 +1436,12 @@ In the event that the end of file is reached and only a partial item is available at the end, i.e. the remaining uncompressed data length is not a - multiple of size, then the final partial item is nevetheless read into buf + multiple of size, then the final partial item is nevertheless read into buf and the end-of-file flag is set. The length of the partial item read is not provided, but could be inferred from the result of gztell(). This behavior is the same as the behavior of fread() implementations in common libraries, but it prevents the direct use of gzfread() to read a concurrently written - file, reseting and retrying on end-of-file, when size is not 1. + file, resetting and retrying on end-of-file, when size is not 1. */ ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len));
diff --git a/tools/binary_size/libsupersize/function_signature.py b/tools/binary_size/libsupersize/function_signature.py index e4d439c..6f78569 100644 --- a/tools/binary_size/libsupersize/function_signature.py +++ b/tools/binary_size/libsupersize/function_signature.py
@@ -96,19 +96,14 @@ return space_idx -def _StripAttributes(name): +def _StripAbiTag(name): # Clang attribute. E.g.: std::allocator<Foo[6]>construct[abi:100]<Bar[7]>() start_idx = 0 while True: - start_idx = name.find('[', start_idx, len(name) - 1) + start_idx = name.find('[abi:', start_idx, len(name) - 1) if start_idx == -1: break - next_char = name[start_idx + 1] - # Ignore operator[] and arrays. - if next_char in ']0123456789': - start_idx += 1 - continue - end_idx = name.find(']', start_idx) + end_idx = name.find(']', start_idx + 5) if end_idx == -1: break name = name[:start_idx] + name[end_idx + 1:] @@ -226,7 +221,6 @@ assert right_paren_idx > left_paren_idx space_idx = _FindReturnValueSpace(name, left_paren_idx) name_no_params = name[space_idx + 1:left_paren_idx] - name_no_params = _StripAttributes(name_no_params) # Special case for top-level lambdas. if name_no_params.endswith('}::_FUN'): @@ -242,6 +236,7 @@ full_name = name[space_idx + 1:] name = name_no_params + name[right_paren_idx + 1:] + name = _StripAbiTag(name) template_name = name name = _StripTemplateArgs(name) return full_name, template_name, name
diff --git a/tools/binary_size/libsupersize/function_signature_test.py b/tools/binary_size/libsupersize/function_signature_test.py index c6e1ecc..d7b769df 100755 --- a/tools/binary_size/libsupersize/function_signature_test.py +++ b/tools/binary_size/libsupersize/function_signature_test.py
@@ -200,13 +200,19 @@ check('', 'foo::Bar<Z<Y> >::foo<bar>', '(abc)', '::var<baz>', name_without_templates='foo::Bar<>::foo<>::var<>') - # Attributes + # ABI Tag Attributes SIG = 'std::make_unique[abi:v15000]<Foo>(Bar const*&)' got_full_name, got_template_name, got_name = function_signature.Parse(SIG) self.assertEqual('std::make_unique<>', got_name) self.assertEqual('std::make_unique<Foo>', got_template_name) self.assertEqual(SIG, got_full_name) + SIG = 'foo::kBar[abi:baz]' + got_full_name, got_template_name, got_name = function_signature.Parse(SIG) + self.assertEqual('foo::kBar', got_name) + self.assertEqual('foo::kBar', got_template_name) + self.assertEqual(SIG, got_full_name) + # Make sure operator[] is not considered an attribute. check('', 'foo::operator[]', '(abc)')
diff --git a/tools/binary_size/libsupersize/viewer/caspian/function_signature.cc b/tools/binary_size/libsupersize/viewer/caspian/function_signature.cc index 5b60e85a..cec388e 100644 --- a/tools/binary_size/libsupersize/viewer/caspian/function_signature.cc +++ b/tools/binary_size/libsupersize/viewer/caspian/function_signature.cc
@@ -173,21 +173,15 @@ return space_idx; } -void StripAttributes(std::string* name) { +void StripAbiTag(std::string* name) { // Clang attribute. E.g.: std::allocator<Foo[6]>construct[abi:100]<Bar[7]>() size_t start_idx = 0; while (true) { - start_idx = name->find('[', start_idx); - if (start_idx == std::string::npos || start_idx + 1 == name->length()) { + start_idx = name->find("[abi:", start_idx); + if (start_idx == std::string::npos) { return; } - char next_char = (*name)[start_idx + 1]; - // Ignore operator[] and arrays. - if (next_char == ']' || (next_char >= '0' && next_char <= '9')) { - ++start_idx; - continue; - } - size_t end_idx = name->find(']', start_idx); + size_t end_idx = name->find(']', start_idx + 5); if (end_idx == std::string::npos) { return; } @@ -345,8 +339,6 @@ std::string name_no_params = std::string(Slice(full_name, space_idx + 1, left_paren_idx)); - StripAttributes(&name_no_params); - // Special case for top-level lambdas. if (EndsWith(name_no_params, "}::_FUN")) { // Don't use |name_no_params| in here since prior _idx will be off if @@ -370,9 +362,10 @@ } owned_strings->emplace_back(name_view); + StripAbiTag(&owned_strings->back()); std::string_view template_name = owned_strings->back(); - owned_strings->push_back(StripTemplateArgs(name_view)); + owned_strings->push_back(StripTemplateArgs(template_name)); std::string_view returned_name = owned_strings->back(); return std::make_tuple(full_name, template_name, returned_name);
diff --git a/tools/binary_size/libsupersize/viewer/caspian/function_signature_test.cc b/tools/binary_size/libsupersize/viewer/caspian/function_signature_test.cc index 688c552c..520a99e 100644 --- a/tools/binary_size/libsupersize/viewer/caspian/function_signature_test.cc +++ b/tools/binary_size/libsupersize/viewer/caspian/function_signature_test.cc
@@ -251,13 +251,19 @@ check("", "foo::Bar<Z<Y> >::foo<bar>", "(abc)", "::var<baz>", "foo::Bar<>::foo<>::var<>"); - // Attributes + // ABI Tag Attributes sig = "std::make_unique[abi:v15000]<Foo>(Bar const*&)"; ret = caspian::ParseCpp(sig, &owned_strings); EXPECT_EQ("std::make_unique<>", std::get<2>(ret)); EXPECT_EQ("std::make_unique<Foo>", std::get<1>(ret)); EXPECT_EQ(sig, std::get<0>(ret)); + sig = "foo::kBar[abi:baz]"; + ret = caspian::ParseCpp(sig, &owned_strings); + EXPECT_EQ("foo::kBar", std::get<2>(ret)); + EXPECT_EQ("foo::kBar", std::get<1>(ret)); + EXPECT_EQ(sig, std::get<0>(ret)); + // Make sure operator[] is not considered an attribute. check("", "foo::operator[]", "(abc)");
diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec index 845ce12..c12fdf4e 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec
@@ -571,10 +571,9 @@ "ash/webui/media_app_ui/resources/mock/media_app_bundle_mock_resources.grd": { "includes": [3120], }, - "ash/webui/print_management/resources/print_management_resources.grd": { - "META": {"join": 2}, + "<(SHARED_INTERMEDIATE_DIR)/ash/webui/print_management/resources/ash_print_management_resources.grd": { + "META": {"join": 2, "sizes": {"includes": [20]}}, "includes": [3140], - "structures": [3160], }, "<(SHARED_INTERMEDIATE_DIR)/ash/webui/sample_system_web_app_ui/resources/trusted/ash_sample_system_web_app_resources.grd": { "META": {"sizes": {"includes": [50],}},
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 771b968..b63ed73 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -266,8 +266,8 @@ 'Deterministic Fuchsia (dbg)': 'debug_bot_fuchsia', 'Fuchsia ARM64': 'release_bot_fuchsia_arm64', 'Fuchsia x64': 'release_bot_fuchsia', - 'fuchsia-arm64-cast': 'release_bot_fuchsia_arm64_cast', - 'fuchsia-x64-cast': 'release_bot_fuchsia_cast', + 'fuchsia-arm64-cast': 'release_bot_fuchsia_arm64_cast_receiver', + 'fuchsia-x64-cast': 'release_bot_fuchsia_cast_receiver', 'fuchsia-x64-dbg': 'debug_bot_fuchsia_compile_only_reclient', }, @@ -1102,13 +1102,13 @@ }, 'tryserver.chromium.fuchsia': { - 'fuchsia-arm64-cast': 'release_trybot_fuchsia_arm64_cast', + 'fuchsia-arm64-cast': 'release_trybot_fuchsia_arm64_cast_receiver', 'fuchsia-binary-size': 'release_fuchsia_arm64', 'fuchsia-compile-x64-dbg': 'debug_bot_fuchsia_compile_only', 'fuchsia-deterministic-dbg': 'debug_bot_fuchsia', 'fuchsia-fyi-arm64-dbg': 'debug_bot_fuchsia_arm64', 'fuchsia-fyi-x64-dbg': 'debug_bot_fuchsia', - 'fuchsia-x64-cast': 'release_trybot_fuchsia_cast', + 'fuchsia-x64-cast': 'release_trybot_fuchsia_cast_receiver', 'fuchsia_arm64': 'release_trybot_fuchsia_arm64', 'fuchsia_x64': 'release_trybot_fuchsia', }, @@ -1185,7 +1185,7 @@ 'linux_chromium_msan_focal': 'msan_release_bot', 'linux_chromium_msan_rel_ng': 'msan_release_bot', - 'linux_chromium_tsan_rel_ng': 'tsan_disable_nacl_release_trybot', + 'linux_chromium_tsan_rel_ng': 'tsan_disable_nacl_release_trybot_reclient', # This is intentionally a release_bot and not a release_trybot to match # the CI configuration, where no debug builder exists. @@ -3406,12 +3406,12 @@ 'release_bot', 'fuchsia', 'arm64', 'arm64_host', ], - 'release_bot_fuchsia_arm64_cast': [ - 'release_bot', 'fuchsia', 'arm64', 'cast_receiver', 'no_symbols', + 'release_bot_fuchsia_arm64_cast_receiver': [ + 'release_bot', 'fuchsia', 'arm64', 'cast_receiver_size_optimized', 'no_symbols', ], - 'release_bot_fuchsia_cast': [ - 'release_bot', 'fuchsia', 'cast_receiver', 'no_symbols', + 'release_bot_fuchsia_cast_receiver': [ + 'release_bot', 'fuchsia', 'cast_receiver_size_optimized', 'no_symbols', ], 'release_bot_fuchsia_cfv2_script': [ @@ -3554,12 +3554,12 @@ 'release_trybot', 'fuchsia', 'arm64', 'arm64_host', ], - 'release_trybot_fuchsia_arm64_cast': [ - 'release_trybot', 'fuchsia', 'arm64', 'cast_receiver', + 'release_trybot_fuchsia_arm64_cast_receiver': [ + 'release_trybot', 'fuchsia', 'arm64', 'cast_receiver_size_optimized', ], - 'release_trybot_fuchsia_cast': [ - 'release_trybot', 'fuchsia', 'cast_receiver', + 'release_trybot_fuchsia_cast_receiver': [ + 'release_trybot', 'fuchsia', 'cast_receiver_size_optimized', ], 'release_trybot_minimal_symbols_reclient': [ @@ -3590,8 +3590,8 @@ 'tsan', 'disable_nacl', 'release_bot_reclient', ], - 'tsan_disable_nacl_release_trybot': [ - 'tsan', 'disable_nacl', 'release_trybot_minimal_symbols', + 'tsan_disable_nacl_release_trybot_reclient': [ + 'tsan', 'disable_nacl', 'release_trybot_minimal_symbols_reclient', ], 'ubsan_release_bot_reclient': [ @@ -3812,6 +3812,10 @@ 'gn_args': 'enable_cast_receiver=true' }, + 'cast_receiver_size_optimized': { + 'args_file': '//build/config/fuchsia/size_optimized_cast_receiver_args.gn', + }, + 'cfi': { 'gn_args': 'is_cfi=true', },
diff --git a/tools/mb/mb_config_expectations/chromium.fuchsia.json b/tools/mb/mb_config_expectations/chromium.fuchsia.json index bff65f6..f55866f 100644 --- a/tools/mb/mb_config_expectations/chromium.fuchsia.json +++ b/tools/mb/mb_config_expectations/chromium.fuchsia.json
@@ -29,9 +29,9 @@ } }, "fuchsia-arm64-cast": { + "args_file": "//build/config/fuchsia/size_optimized_cast_receiver_args.gn", "gn_args": { "dcheck_always_on": false, - "enable_cast_receiver": true, "is_component_build": false, "is_debug": false, "symbol_level": 0, @@ -41,9 +41,9 @@ } }, "fuchsia-x64-cast": { + "args_file": "//build/config/fuchsia/size_optimized_cast_receiver_args.gn", "gn_args": { "dcheck_always_on": false, - "enable_cast_receiver": true, "is_component_build": false, "is_debug": false, "symbol_level": 0,
diff --git a/tools/mb/mb_config_expectations/tryserver.chromium.fuchsia.json b/tools/mb/mb_config_expectations/tryserver.chromium.fuchsia.json index 1eee440..313ee0b 100644 --- a/tools/mb/mb_config_expectations/tryserver.chromium.fuchsia.json +++ b/tools/mb/mb_config_expectations/tryserver.chromium.fuchsia.json
@@ -1,8 +1,8 @@ { "fuchsia-arm64-cast": { + "args_file": "//build/config/fuchsia/size_optimized_cast_receiver_args.gn", "gn_args": { "dcheck_always_on": true, - "enable_cast_receiver": true, "is_component_build": false, "is_debug": false, "symbol_level": 0, @@ -60,9 +60,9 @@ } }, "fuchsia-x64-cast": { + "args_file": "//build/config/fuchsia/size_optimized_cast_receiver_args.gn", "gn_args": { "dcheck_always_on": true, - "enable_cast_receiver": true, "is_component_build": false, "is_debug": false, "symbol_level": 0,
diff --git a/tools/mb/mb_config_expectations/tryserver.chromium.linux.json b/tools/mb/mb_config_expectations/tryserver.chromium.linux.json index 4f89871fa..6d2ebc8 100644 --- a/tools/mb/mb_config_expectations/tryserver.chromium.linux.json +++ b/tools/mb/mb_config_expectations/tryserver.chromium.linux.json
@@ -734,7 +734,7 @@ "is_debug": false, "is_tsan": true, "symbol_level": 1, - "use_goma": true + "use_remoteexec": true } }, "linux_chromium_ubsan_rel_ng": {
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index cf5a157..af1f7b4 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -56520,6 +56520,7 @@ label="AutofillAutoTriggerManualFallbackForCards:disabled"/> <int value="-1780306716" label="OmniboxSpeculativeServiceWorkerStartOnQueryInput:enabled"/> + <int value="-1780174878" label="SplitTabStrip:disabled"/> <int value="-1779753607" label="VizDisplayCompositor:disabled"/> <int value="-1778993296" label="ContextualSearchMlTapSuppression:disabled"/> <int value="-1778760568" @@ -57324,6 +57325,7 @@ label="AutofillEnableInfoBarAccountIndicationFooterForSingleAccountUsers:disabled"/> <int value="-1301167148" label="WebViewZeroCopyVideo:disabled"/> <int value="-1300934428" label="ExternalNavigationDebugLogs:enabled"/> + <int value="-1300692087" label="SplitTabStrip:enabled"/> <int value="-1298273481" label="http2-grease-settings"/> <int value="-1298067767" label="CalendarModelDebugMode:disabled"/> <int value="-1297079591" label="EnableRemovingAllThirdPartyCookies:disabled"/> @@ -88891,6 +88893,7 @@ <int value="54" label="Eap Authentication Failed"/> <int value="55" label="Eap Local Tls Failed"/> <int value="56" label="Eap Remote Tls Failed"/> + <int value="57" label="WEP networks are not supported"/> </enum> <enum name="ShillSuspendTerminationDarkResumeActionResult">
diff --git a/tools/metrics/histograms/metadata/arc/histograms.xml b/tools/metrics/histograms/metadata/arc/histograms.xml index 73f96b86..dcfd357 100644 --- a/tools/metrics/histograms/metadata/arc/histograms.xml +++ b/tools/metrics/histograms/metadata/arc/histograms.xml
@@ -418,6 +418,18 @@ </token> </histogram> +<histogram name="Arc.AppInstall.PolicySuccessRate" units="%" + expires_after="2023-01-15"> + <owner>batoon@google.com</owner> + <owner>arc-commercial@google.com</owner> + <summary> + Record the success rate for all apps within a single policy. This will allow + us to understand the reliability of force installs for a single customer. + The metric is emitted when success/failure results are received for all apps + in a policy or when 30 minutes have elapsed since the policy was received. + </summary> +</histogram> + <histogram name="Arc.AppInstalledReason" enum="InstallationCounterReasonEnum" expires_after="2023-01-15"> <owner>thanhdng@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/segmentation_platform/histograms.xml b/tools/metrics/histograms/metadata/segmentation_platform/histograms.xml index 4b2ae12..7ee4e8a 100644 --- a/tools/metrics/histograms/metadata/segmentation_platform/histograms.xml +++ b/tools/metrics/histograms/metadata/segmentation_platform/histograms.xml
@@ -25,6 +25,7 @@ <variants name="BooleanModel"> <variant name="ChromeLowUserEngagement"/> <variant name="ChromeStartAndroid"/> + <variant name="CrossDeviceUser"/> <variant name="FeedUserSegment"/> <variant name="PowerUserSegment"/> <variant name="QueryTiles"/> @@ -40,6 +41,7 @@ <variant name="ChromeLowUserEngagement"/> <variant name="ChromeStartAndroid"/> <variant name="ContextualPageActions"/> + <variant name="CrossDeviceUser"/> <variant name="DummyFeature"/> <variant name="FeedUserSegment"/> <variant name="PowerUser"/> @@ -50,6 +52,7 @@ <variant name="ChromeLowUserEngagement"/> <variant name="ChromeStartAndroid"/> <variant name="ContextualPageActionPriceTracking"/> + <variant name="CrossDeviceUser"/> <variant name="Dummy"/> <variant name="FeedUserSegment"/> <variant name="NewTab"/>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 5983be1..adcefb31f 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -22,7 +22,7 @@ }, "linux": { "hash": "3b64eb0819b6715ff25d33900626659ff3158f2e", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/61a33b333e779199f05ba622a90da293654351c1/trace_processor_shell" + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/f6016b7c1ce6f7b79fd6048e4a1496c043d5ff99/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/ui/accessibility/ax_tree_manager_base_unittest.cc b/ui/accessibility/ax_tree_manager_base_unittest.cc index 8d793e7..290767b 100644 --- a/ui/accessibility/ax_tree_manager_base_unittest.cc +++ b/ui/accessibility/ax_tree_manager_base_unittest.cc
@@ -22,12 +22,12 @@ namespace { -class AXTreeManagerTest : public ::testing::Test { +class AXTreeManagerBaseTest : public ::testing::Test { public: - AXTreeManagerTest(); - AXTreeManagerTest(const AXTreeManagerTest&) = delete; - AXTreeManagerTest& operator=(const AXTreeManagerTest&) = delete; - ~AXTreeManagerTest() override = default; + AXTreeManagerBaseTest(); + AXTreeManagerBaseTest(const AXTreeManagerBaseTest&) = delete; + AXTreeManagerBaseTest& operator=(const AXTreeManagerBaseTest&) = delete; + ~AXTreeManagerBaseTest() override = default; protected: static constexpr AXNodeID kIframeID = 4; @@ -48,12 +48,12 @@ AXTreeManagerBase complex_manager_; }; -AXTreeManagerTest::AXTreeManagerTest() +AXTreeManagerBaseTest::AXTreeManagerBaseTest() : simple_manager_(CreateSimpleTree()), complex_manager_(CreateComplexTree()) {} // static -AXTreeUpdate AXTreeManagerTest::CreateSimpleTreeUpdate() { +AXTreeUpdate AXTreeManagerBaseTest::CreateSimpleTreeUpdate() { AXNodeData root; root.id = 1; root.role = ax::mojom::Role::kRootWebArea; @@ -68,12 +68,12 @@ } // static -std::unique_ptr<AXTree> AXTreeManagerTest::CreateSimpleTree() { +std::unique_ptr<AXTree> AXTreeManagerBaseTest::CreateSimpleTree() { return std::make_unique<AXTree>(CreateSimpleTreeUpdate()); } // static -std::unique_ptr<AXTree> AXTreeManagerTest::CreateComplexTree() { +std::unique_ptr<AXTree> AXTreeManagerBaseTest::CreateComplexTree() { AXNodeData root; AXNodeData generic_container_ignored; AXNodeData paragraph; @@ -107,7 +107,7 @@ } // static -void AXTreeManagerTest::HostChildTreeAtNode(AXNode& host_node, +void AXTreeManagerBaseTest::HostChildTreeAtNode(AXNode& host_node, AXTree& child_tree) { ASSERT_NE(nullptr, host_node.tree()); @@ -134,7 +134,7 @@ } } -void AXTreeManagerTest::SetUp() { +void AXTreeManagerBaseTest::SetUp() { ASSERT_EQ(AXTreeIDUnknown(), empty_manager_.GetTreeID()); simple_tree_id_ = simple_manager_.GetTreeID(); ASSERT_NE(ax::mojom::AXTreeIDType::kUnknown, simple_tree_id_.type()); @@ -165,7 +165,7 @@ } // namespace -TEST_F(AXTreeManagerTest, GetManager) { +TEST_F(AXTreeManagerBaseTest, GetManager) { // Since the following two trees are destroyed when their respective managers // are destructed, we cannot use a reference to their tree IDs. We should copy // the tree IDs by value if we want to verify that the managers have indeed @@ -191,7 +191,7 @@ ASSERT_EQ(nullptr, AXTreeManagerBase::GetManager(complex_tree_id)); } -TEST_F(AXTreeManagerTest, MoveConstructor) { +TEST_F(AXTreeManagerBaseTest, MoveConstructor) { AXTreeManagerBase new_manager(std::move(simple_manager_)); EXPECT_EQ(simple_tree_id_, new_manager.GetTreeID()); EXPECT_NE(nullptr, new_manager.GetTree()); @@ -211,7 +211,7 @@ EXPECT_EQ(nullptr, new_manager.GetTree()); } -TEST_F(AXTreeManagerTest, SetTree) { +TEST_F(AXTreeManagerBaseTest, SetTree) { // Try setting a new tree on construction via an `AXTreeUpdate`. const AXTreeUpdate initial_state = CreateSimpleTreeUpdate(); const AXTreeID& initial_tree_id = initial_state.tree_data.tree_id; @@ -235,7 +235,7 @@ EXPECT_EQ(initial_tree_id, initial_manager.GetTreeID()); } -TEST_F(AXTreeManagerTest, ReleaseTree) { +TEST_F(AXTreeManagerBaseTest, ReleaseTree) { std::unique_ptr<AXTree> simple_tree = simple_manager_.ReleaseTree(); EXPECT_EQ(AXTreeIDUnknown(), simple_manager_.GetTreeID()); EXPECT_EQ(nullptr, simple_manager_.GetTree()); @@ -243,7 +243,7 @@ EXPECT_EQ(simple_tree_id_, simple_tree->GetAXTreeID()); } -TEST_F(AXTreeManagerTest, GetNode) { +TEST_F(AXTreeManagerBaseTest, GetNode) { EXPECT_EQ(simple_manager_.GetRoot(), AXTreeManagerBase::GetNodeFromTree( simple_tree_id_, /* AXNodeID */ 1)); EXPECT_EQ( @@ -258,7 +258,7 @@ EXPECT_EQ(kIframeID, iframe->id()); } -TEST_F(AXTreeManagerTest, ParentChildTreeRelationship) { +TEST_F(AXTreeManagerBaseTest, ParentChildTreeRelationship) { EXPECT_EQ(nullptr, empty_manager_.GetRoot()); EXPECT_EQ(nullptr, empty_manager_.GetHostNode()); @@ -278,7 +278,7 @@ EXPECT_EQ(simple_manager_root, complex_manager_.GetRootOfChildTree(*iframe)); } -TEST_F(AXTreeManagerTest, AttachingAndDetachingChildTrees) { +TEST_F(AXTreeManagerBaseTest, AttachingAndDetachingChildTrees) { AXNode* iframe = AXTreeManagerBase::GetNodeFromTree(complex_tree_id_, kIframeID); ASSERT_NE(nullptr, iframe); @@ -326,7 +326,7 @@ complex_manager_.DetachChildTree(kIframeID)); } -TEST_F(AXTreeManagerTest, Observers) { +TEST_F(AXTreeManagerBaseTest, Observers) { TestAXTreeObserver observer; simple_manager_.GetTree()->AddObserver(&observer); EXPECT_TRUE(simple_manager_.GetTree()->HasObserver(&observer));
diff --git a/ui/gl/gl_image_native_pixmap.cc b/ui/gl/gl_image_native_pixmap.cc index 7990afb..3366593 100644 --- a/ui/gl/gl_image_native_pixmap.cc +++ b/ui/gl/gl_image_native_pixmap.cc
@@ -158,20 +158,20 @@ if (format_ == gfx::BufferFormat::YUV_420_BIPLANAR || format_ == gfx::BufferFormat::YVU_420) { // TODO(b/233667677): since https://crrev.com/c/3662252, the only NV12 - // quads that we allow to be promoted to overlays are those that use - // non-BT.2020 primaries with non-full range. Furthermore, since - // https://crrev.com/c/2336347, we force the DRM/KMS driver to use BT.601 - // with limited range. Therefore, for compositing purposes, we need to - // a) use EGL_ITU_REC601_EXT for any video frames that might be promoted - // to overlays - e.g., we shouldn't use EGL_ITU_REC709_EXT for BT709 - // frames because we might then see a slight difference in + // quads that we allow to be promoted to overlays are those that use the + // BT.709 primaries (approximately the same as the BT.601 primaries) with + // limited range. Furthermore, since https://crrev.com/c/2336347, we force + // the DRM/KMS driver to use BT.601 with limited range. Therefore, for + // compositing purposes, we need to a) use EGL_ITU_REC601_EXT for any + // video frames that might be promoted to overlays - we shouldn't use + // EGL_ITU_REC709_EXT because we might then see a slight difference in // compositing vs. overlays (note that the BT.601 and BT.709 primaries are // very close to each other, so this shouldn't be a huge correctness // issue); b) use EGL_ITU_REC2020_EXT for BT.2020 frames in order to // composite them correctly (and we won't need to worry about a difference // in compositing vs. overlays in this case since those frames won't be // promoted to overlays). We'll need to revisit this once we plumb the - // YUV color encoding and range to DRM/KMS. + // color space and range to DRM/KMS. attrs.push_back(EGL_YUV_COLOR_SPACE_HINT_EXT); switch (color_space_.GetPrimaryID()) { case gfx::ColorSpace::PrimaryID::BT2020:
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc index 890de19..61edf372 100644 --- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc +++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
@@ -46,7 +46,8 @@ bool ShouldSetBounds(PlatformWindowState state) { return state == PlatformWindowState::kNormal || state == PlatformWindowState::kSnappedPrimary || - state == PlatformWindowState::kSnappedSecondary; + state == PlatformWindowState::kSnappedSecondary || + state == PlatformWindowState::kFloated; } } @@ -383,6 +384,8 @@ state_ = PlatformWindowState::kSnappedPrimary; } else if (window_states.is_snapped_secondary) { state_ = PlatformWindowState::kSnappedSecondary; + } else if (window_states.is_floated) { + state_ = PlatformWindowState::kFloated; } else { state_ = PlatformWindowState::kNormal; }
diff --git a/ui/ozone/platform/wayland/host/wayland_window.h b/ui/ozone/platform/wayland/host/wayland_window.h index 8423df6..91e6e80 100644 --- a/ui/ozone/platform/wayland/host/wayland_window.h +++ b/ui/ozone/platform/wayland/host/wayland_window.h
@@ -228,6 +228,7 @@ bool is_activated = false; bool is_snapped_primary = false; bool is_snapped_secondary = false; + bool is_floated = false; struct { bool left = false; bool right = false;
diff --git a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc index 090db779..337e2fe 100644 --- a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc +++ b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc
@@ -286,18 +286,18 @@ surface->wayland_window_->HandleAuraToplevelConfigure( x, y, width, height, - { - .is_maximized = - CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_MAXIMIZED), - .is_fullscreen = - CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_FULLSCREEN), - .is_activated = - CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_ACTIVATED), - .is_snapped_primary = CheckIfWlArrayHasValue( - states, ZAURA_TOPLEVEL_STATE_SNAPPED_PRIMARY), - .is_snapped_secondary = CheckIfWlArrayHasValue( - states, ZAURA_TOPLEVEL_STATE_SNAPPED_SECONDARY), - }); + {.is_maximized = + CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_MAXIMIZED), + .is_fullscreen = + CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_FULLSCREEN), + .is_activated = + CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_ACTIVATED), + .is_snapped_primary = + CheckIfWlArrayHasValue(states, ZAURA_TOPLEVEL_STATE_SNAPPED_PRIMARY), + .is_snapped_secondary = CheckIfWlArrayHasValue( + states, ZAURA_TOPLEVEL_STATE_SNAPPED_SECONDARY), + .is_floated = + CheckIfWlArrayHasValue(states, ZAURA_TOPLEVEL_STATE_FLOATED)}); } // static
diff --git a/ui/platform_window/platform_window_delegate.h b/ui/platform_window/platform_window_delegate.h index eb9e571f..b5baa7ab 100644 --- a/ui/platform_window/platform_window_delegate.h +++ b/ui/platform_window/platform_window_delegate.h
@@ -38,6 +38,7 @@ // Currently, only used by ChromeOS. kSnappedPrimary, kSnappedSecondary, + kFloated, }; enum class PlatformWindowOcclusionState {
diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn index d10262f..be13234 100644 --- a/ui/views/BUILD.gn +++ b/ui/views/BUILD.gn
@@ -601,7 +601,6 @@ if (is_mac) { public += [ - "cocoa/immersive_mode_delegate_mac.h", "cocoa/native_widget_mac_ns_window_host.h", "controls/menu/menu_closure_animation_mac.h", "controls/menu/menu_cocoa_watcher_mac.h",
diff --git a/ui/views/cocoa/immersive_mode_delegate_mac.h b/ui/views/cocoa/immersive_mode_delegate_mac.h deleted file mode 100644 index 1b1d012..0000000 --- a/ui/views/cocoa/immersive_mode_delegate_mac.h +++ /dev/null
@@ -1,14 +0,0 @@ -// Copyright 2022 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. - -#ifndef UI_VIEWS_COCOA_IMMERSIVE_MODE_DELEGATE_MAC_H_ -#define UI_VIEWS_COCOA_IMMERSIVE_MODE_DELEGATE_MAC_H_ - -#include <AppKit/AppKit.h> - -@protocol ImmersiveModeDelegate <NSWindowDelegate> -@property(readonly) NSWindow* originalHostingWindow; -@end - -#endif // UI_VIEWS_COCOA_IMMERSIVE_MODE_DELEGATE_MAC_H_
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm index cdaf472a..1a4a33a1 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
@@ -14,6 +14,8 @@ #include "base/numerics/safe_conversions.h" #include "base/strings/sys_string_conversions.h" #include "base/time/time.h" +#include "components/remote_cocoa/app_shim/immersive_mode_controller.h" +#include "components/remote_cocoa/app_shim/immersive_mode_delegate_mac.h" #include "components/remote_cocoa/app_shim/mouse_capture.h" #include "components/remote_cocoa/app_shim/native_widget_mac_nswindow.h" #include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h" @@ -35,7 +37,6 @@ #include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/mac/coordinate_conversion.h" #include "ui/native_theme/native_theme_mac.h" -#include "ui/views/cocoa/immersive_mode_delegate_mac.h" #include "ui/views/cocoa/text_input_host.h" #include "ui/views/cocoa/tooltip_manager_mac.h" #include "ui/views/controls/label.h" @@ -44,7 +45,6 @@ #include "ui/views/views_delegate.h" #include "ui/views/widget/native_widget_mac.h" #include "ui/views/widget/widget_delegate.h" -#include "ui/views/widget/widget_utils_mac.h" #include "ui/views/window/dialog_delegate.h" #include "ui/views/word_lookup_client.h" @@ -241,7 +241,9 @@ // If the window is a system created NSToolbarFullScreenWindow we need to do // some additional work to find the original window. - if (views::IsNSToolbarFullScreenWindow(window)) { + // TODO(mek): Figure out how to make this work with remote remote_cocoa + // windows. + if (remote_cocoa::IsNSToolbarFullScreenWindow(window)) { NSWindow* original = OriginalHostingWindowFromFullScreenWindow(window); if (NativeWidgetMacNSWindow* widget_window = base::mac::ObjCCast<NativeWidgetMacNSWindow>(original)) {
diff --git a/ui/views/controls/webview/web_dialog_view.cc b/ui/views/controls/webview/web_dialog_view.cc index fb523910..6928d3f 100644 --- a/ui/views/controls/webview/web_dialog_view.cc +++ b/ui/views/controls/webview/web_dialog_view.cc
@@ -402,11 +402,11 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) { WebDialogWebContentsDelegate::AddNewContents( - source, std::move(new_contents), target_url, disposition, initial_rect, + source, std::move(new_contents), target_url, disposition, window_features, user_gesture, was_blocked); }
diff --git a/ui/views/controls/webview/web_dialog_view.h b/ui/views/controls/webview/web_dialog_view.h index eb5c113..3c6f0ed 100644 --- a/ui/views/controls/webview/web_dialog_view.h +++ b/ui/views/controls/webview/web_dialog_view.h
@@ -143,7 +143,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; void LoadingStateChanged(content::WebContents* source,
diff --git a/ui/views/views_features.cc b/ui/views/views_features.cc index c86bbdc..ed37411 100644 --- a/ui/views/views_features.cc +++ b/ui/views/views_features.cc
@@ -23,5 +23,9 @@ const base::Feature kEnableViewPaintOptimization{ "EnableViewPaintOptimization", base::FEATURE_DISABLED_BY_DEFAULT}; +// When enabled, widgets will be shown based on their z-order level +const base::Feature kWidgetLayering{"WidgetLayering", + base::FEATURE_DISABLED_BY_DEFAULT}; + } // namespace features } // namespace views
diff --git a/ui/views/views_features.h b/ui/views/views_features.h index d0e00d8..4d65e6b 100644 --- a/ui/views/views_features.h +++ b/ui/views/views_features.h
@@ -15,6 +15,7 @@ // Please keep alphabetized. VIEWS_EXPORT extern const base::Feature kEnablePlatformHighContrastInkDrop; VIEWS_EXPORT extern const base::Feature kEnableViewPaintOptimization; +VIEWS_EXPORT extern const base::Feature kWidgetLayering; } // namespace features } // namespace views
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_lacros.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_lacros.cc index e4c808a..b52371a5 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_lacros.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_lacros.cc
@@ -40,6 +40,8 @@ return chromeos::WindowStateType::kPrimarySnapped; case ui::PlatformWindowState::kSnappedSecondary: return chromeos::WindowStateType::kSecondarySnapped; + case ui::PlatformWindowState::kFloated: + return chromeos::WindowStateType::kFloated; } }
diff --git a/ui/views/widget/native_widget_mac.mm b/ui/views/widget/native_widget_mac.mm index b3fc364..1a13b49 100644 --- a/ui/views/widget/native_widget_mac.mm +++ b/ui/views/widget/native_widget_mac.mm
@@ -17,6 +17,7 @@ #include "base/strings/sys_string_conversions.h" #include "components/crash/core/common/crash_key.h" #import "components/remote_cocoa/app_shim/bridged_content_view.h" +#import "components/remote_cocoa/app_shim/immersive_mode_controller.h" #import "components/remote_cocoa/app_shim/native_widget_mac_nswindow.h" #import "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h" #import "components/remote_cocoa/app_shim/views_nswindow_delegate.h" @@ -42,7 +43,6 @@ #include "ui/views/widget/native_widget_delegate.h" #include "ui/views/widget/widget_aura_utils.h" #include "ui/views/widget/widget_delegate.h" -#include "ui/views/widget/widget_utils_mac.h" #include "ui/views/window/native_frame_view.h" using remote_cocoa::mojom::WindowVisibilityState; @@ -224,7 +224,9 @@ // In immersive fullscreen, bubbles will be shown under the toolbar by // default. Fix it by explicitly StackAbove() its parent. - if (params.parent && views::IsNSToolbarFullScreenWindow( + // TODO(mek): Figure out how to make this work with remote remote_cocoa + // windows. + if (params.parent && remote_cocoa::IsNSToolbarFullScreenWindow( params.parent.GetNativeNSView().window)) { StackAbove(params.parent); }
diff --git a/ui/views/widget/widget_utils_mac.h b/ui/views/widget/widget_utils_mac.h index bf72f1f..9c42eea 100644 --- a/ui/views/widget/widget_utils_mac.h +++ b/ui/views/widget/widget_utils_mac.h
@@ -12,8 +12,6 @@ gfx::Size GetWindowSizeForClientSize(Widget* widget, const gfx::Size& size); -VIEWS_EXPORT bool IsNSToolbarFullScreenWindow(NSWindow* window); - } // namespace views #endif // UI_VIEWS_WIDGET_WIDGET_UTILS_MAC_H_
diff --git a/ui/web_dialogs/test/test_web_contents_handler.cc b/ui/web_dialogs/test/test_web_contents_handler.cc index 1e3fade..9f69eba 100644 --- a/ui/web_dialogs/test/test_web_contents_handler.cc +++ b/ui/web_dialogs/test/test_web_contents_handler.cc
@@ -29,7 +29,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture) {} void TestWebContentsHandler::RunFileChooser(
diff --git a/ui/web_dialogs/test/test_web_contents_handler.h b/ui/web_dialogs/test/test_web_contents_handler.h index b8df928..64772a16 100644 --- a/ui/web_dialogs/test/test_web_contents_handler.h +++ b/ui/web_dialogs/test/test_web_contents_handler.h
@@ -31,7 +31,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture) override; void RunFileChooser(content::RenderFrameHost* render_frame_host, scoped_refptr<content::FileSelectListener> listener,
diff --git a/ui/web_dialogs/web_dialog_web_contents_delegate.cc b/ui/web_dialogs/web_dialog_web_contents_delegate.cc index 0386802..e4681cf 100644 --- a/ui/web_dialogs/web_dialog_web_contents_delegate.cc +++ b/ui/web_dialogs/web_dialog_web_contents_delegate.cc
@@ -47,13 +47,14 @@ std::unique_ptr<WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) { // TODO(erikchen): Refactor AddNewContents to take strong ownership semantics. // https://crbug.com/832879. handler_->AddNewContents(browser_context_, source, std::move(new_contents), - target_url, disposition, initial_rect, user_gesture); + target_url, disposition, window_features, + user_gesture); } bool WebDialogWebContentsDelegate::PreHandleGestureEvent(
diff --git a/ui/web_dialogs/web_dialog_web_contents_delegate.h b/ui/web_dialogs/web_dialog_web_contents_delegate.h index 7ee2974f..c591b09 100644 --- a/ui/web_dialogs/web_dialog_web_contents_delegate.h +++ b/ui/web_dialogs/web_dialog_web_contents_delegate.h
@@ -47,7 +47,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture) = 0; // This is added to allow the injection of a file chooser handler. // The WebDialogWebContentsDelegate's original implementation does not @@ -86,7 +86,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; bool PreHandleGestureEvent(content::WebContents* source,
diff --git a/ui/webui/resources/BUILD.gn b/ui/webui/resources/BUILD.gn index cc05a0c2..c964697 100644 --- a/ui/webui/resources/BUILD.gn +++ b/ui/webui/resources/BUILD.gn
@@ -166,7 +166,6 @@ checked_in_dts_files = [ "cr_elements/cr_button/cr_button.d.ts", "cr_elements/cr_dialog/cr_dialog.d.ts", - "cr_elements/cr_icon_button/cr_icon_button.d.ts", "cr_elements/cr_lottie/cr_lottie.d.ts", "cr_elements/cr_scrollable_behavior.m.d.ts", "cr_elements/find_shortcut_behavior.d.ts",
diff --git a/ui/webui/resources/cr_components/chromeos/multidevice_setup/BUILD.gn b/ui/webui/resources/cr_components/chromeos/multidevice_setup/BUILD.gn index d79e18a..cf9450f 100644 --- a/ui/webui/resources/cr_components/chromeos/multidevice_setup/BUILD.gn +++ b/ui/webui/resources/cr_components/chromeos/multidevice_setup/BUILD.gn
@@ -191,7 +191,7 @@ html_type = "dom-module" namespace_rewrites = cr_components_chromeos_namespace_rewrites migrated_imports = cr_components_migrated_imports - auto_imports = cr_components_chromeos_auto_imports + auto_imports = cr_components_chromeos_auto_imports + [ "ui/webui/resources/cr_elements/cr_lottie/cr_lottie.html|CrLottieElement" ] } polymer_modulizer("multidevice_setup_shared_css") {
diff --git a/ui/webui/resources/cr_components/chromeos/network/BUILD.gn b/ui/webui/resources/cr_components/chromeos/network/BUILD.gn index e88d7120..7fa8627 100644 --- a/ui/webui/resources/cr_components/chromeos/network/BUILD.gn +++ b/ui/webui/resources/cr_components/chromeos/network/BUILD.gn
@@ -274,7 +274,6 @@ ":network_config_element_behavior.m", ":network_shared_css.m", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button", "//ui/webui/resources/js:i18n_behavior.m", ] externs_list = @@ -324,7 +323,6 @@ ":network_shared_css.m", "//third_party/polymer/v3_0/components-chromium/iron-flex-layout:iron-flex-layout-classes", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button", "//ui/webui/resources/js:i18n_behavior.m", ] extra_deps = [ ":network_proxy_exclusions_module" ]
diff --git a/ui/webui/resources/cr_elements/BUILD.gn b/ui/webui/resources/cr_elements/BUILD.gn index ba03c553..f9ed4c2 100644 --- a/ui/webui/resources/cr_elements/BUILD.gn +++ b/ui/webui/resources/cr_elements/BUILD.gn
@@ -122,7 +122,6 @@ "cr_actionable_row_style.m.js", "cr_button/cr_button.js", "cr_dialog/cr_dialog.js", - "cr_icon_button/cr_icon_button.js", "cr_icons_css.m.js", "cr_lottie/cr_lottie.js", "cr_scrollable_behavior.m.js", @@ -154,7 +153,6 @@ ":cr_elements_module_resources", "cr_button:closure_compile_module", "cr_dialog:closure_compile_module", - "cr_icon_button:closure_compile_module", "cr_lottie:closure_compile_module", "policy:closure_compile_module", ] @@ -250,7 +248,6 @@ ":shared_vars_css_module", "cr_button:web_components", "cr_dialog:web_components", - "cr_icon_button:web_components", "cr_lottie:web_components", "policy:web_components", ]
diff --git a/ui/webui/resources/cr_elements/cr_elements.gni b/ui/webui/resources/cr_elements/cr_elements.gni index 5eaffaec..a892097a 100644 --- a/ui/webui/resources/cr_elements/cr_elements.gni +++ b/ui/webui/resources/cr_elements/cr_elements.gni
@@ -35,6 +35,7 @@ "cr_expand_button/cr_expand_button.ts", "cr_fingerprint/cr_fingerprint_progress_arc.ts", "cr_grid/cr_grid.ts", + "cr_icon_button/cr_icon_button.ts", "cr_input/cr_input.ts", "cr_link_row/cr_link_row.ts", "cr_profile_avatar_selector/cr_profile_avatar_selector_grid.ts",
diff --git a/ui/webui/resources/cr_elements/cr_icon_button/BUILD.gn b/ui/webui/resources/cr_elements/cr_icon_button/BUILD.gn deleted file mode 100644 index b6d3b4d9d..0000000 --- a/ui/webui/resources/cr_elements/cr_icon_button/BUILD.gn +++ /dev/null
@@ -1,22 +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. - -import("//third_party/closure_compiler/compile_js.gni") -import("//tools/polymer/html_to_js.gni") - -html_to_js("web_components") { - js_files = [ "cr_icon_button.js" ] -} - -js_type_check("closure_compile_module") { - is_polymer3 = true - deps = [ ":cr_icon_button" ] -} - -js_library("cr_icon_button") { - deps = [ - "//third_party/polymer/v3_0/components-chromium/paper-behaviors:paper-ripple-behavior", - "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - ] -}
diff --git a/ui/webui/resources/cr_elements/cr_icon_button/cr_icon_button.d.ts b/ui/webui/resources/cr_elements/cr_icon_button/cr_icon_button.d.ts deleted file mode 100644 index 674e241..0000000 --- a/ui/webui/resources/cr_elements/cr_icon_button/cr_icon_button.d.ts +++ /dev/null
@@ -1,20 +0,0 @@ -// Copyright 2021 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. - -import {LegacyElementMixin} from 'chrome://resources/polymer/v3_0/polymer/lib/legacy/legacy-element-mixin.js'; - -interface CrIconButtonElement extends LegacyElementMixin, HTMLElement { - disabled: boolean; - customTabIndex: number|null|undefined; - ironIcon: string|null|undefined; - hostAttributes: object|null; -} - -export {CrIconButtonElement}; - -declare global { - interface HTMLElementTagNameMap { - 'cr-icon-button': CrIconButtonElement; - } -}
diff --git a/ui/webui/resources/cr_elements/cr_icon_button/cr_icon_button.js b/ui/webui/resources/cr_elements/cr_icon_button/cr_icon_button.ts similarity index 72% rename from ui/webui/resources/cr_elements/cr_icon_button/cr_icon_button.js rename to ui/webui/resources/cr_elements/cr_icon_button/cr_icon_button.ts index 460c64dd..e3109b60 100644 --- a/ui/webui/resources/cr_elements/cr_icon_button/cr_icon_button.js +++ b/ui/webui/resources/cr_elements/cr_icon_button/cr_icon_button.ts
@@ -44,7 +44,15 @@ import '../shared_vars_css.m.js'; import '//resources/polymer/v3_0/iron-icon/iron-icon.js'; -import {html, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {getTemplate} from './cr_icon_button.html.js'; + +export interface CrIconButtonElement { + $: { + icon: HTMLElement, + }; +} export class CrIconButtonElement extends PolymerElement { static get is() { @@ -52,7 +60,7 @@ } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { @@ -78,7 +86,6 @@ reflectToAttribute: true, }, - /** @private */ multipleIcons_: { type: Boolean, reflectToAttribute: true, @@ -86,31 +93,33 @@ }; } + disabled: boolean; + customTabIndex: number; + ironIcon: string; + private multipleIcons_: boolean; + + /** + * It is possible to activate a tab when the space key is pressed down. When + * this element has focus, the keyup event for the space key should not + * perform a 'click'. |spaceKeyDown_| tracks when a space pressed and + * handled by this element. Space keyup will only result in a 'click' when + * |spaceKeyDown_| is true. |spaceKeyDown_| is set to false when element + * loses focus. + */ + private spaceKeyDown_: boolean = false; + constructor() { super(); - /** - * It is possible to activate a tab when the space key is pressed down. When - * this element has focus, the keyup event for the space key should not - * perform a 'click'. |spaceKeyDown_| tracks when a space pressed and - * handled by this element. Space keyup will only result in a 'click' when - * |spaceKeyDown_| is true. |spaceKeyDown_| is set to false when element - * loses focus. - * @private {boolean} - */ - this.spaceKeyDown_ = false; this.addEventListener('blur', this.onBlur_.bind(this)); this.addEventListener('click', this.onClick_.bind(this)); - this.addEventListener( - 'keydown', e => this.onKeyDown_(/** @type {!KeyboardEvent} */ (e))); - this.addEventListener( - 'keyup', e => this.onKeyUp_(/** @type {!KeyboardEvent} */ (e))); + this.addEventListener('keydown', this.onKeyDown_.bind(this)); + this.addEventListener('keyup', this.onKeyUp_.bind(this)); } - /** @override */ - ready() { + override ready() { super.ready(); - this.setAttribute('aria-disabled', 'false'); + this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false'); if (!this.hasAttribute('role')) { this.setAttribute('role', 'button'); } @@ -119,21 +128,11 @@ } } - /** @param {string} className */ - toggleClass(className) { - if (this.classList.contains(className)) { - this.classList.remove(className); - } else { - this.classList.add(className); - } + toggleClass(className: string) { + this.classList.toggle(className); } - /** - * @param {boolean} newValue - * @param {boolean} oldValue - * @private - */ - disabledChanged_(newValue, oldValue) { + private disabledChanged_(newValue: boolean, oldValue?: boolean) { if (!newValue && oldValue === undefined) { return; } @@ -146,34 +145,27 @@ /** * Updates the tabindex HTML attribute to the actual value. - * @private */ - applyTabIndex_() { + private applyTabIndex_() { let value = this.customTabIndex; if (value === undefined) { value = this.disabled ? -1 : 0; } - this.setAttribute('tabindex', value); + this.setAttribute('tabindex', value.toString()); } - /** @private */ - onBlur_() { + private onBlur_() { this.spaceKeyDown_ = false; } - /** - * @param {!Event} e - * @private - */ - onClick_(e) { + private onClick_(e: Event) { if (this.disabled) { e.stopImmediatePropagation(); } } - /** @private */ - onIronIconChanged_() { - this.shadowRoot.querySelectorAll('iron-icon').forEach(el => el.remove()); + private onIronIconChanged_() { + this.shadowRoot!.querySelectorAll('iron-icon').forEach(el => el.remove()); if (!this.ironIcon) { return; } @@ -184,17 +176,13 @@ ironIcon.icon = icon; this.$.icon.appendChild(ironIcon); if (ironIcon.shadowRoot) { - ironIcon.shadowRoot.querySelectorAll('svg', 'img') + ironIcon.shadowRoot.querySelectorAll('svg, img') .forEach(child => child.setAttribute('role', 'none')); } }); } - /** - * @param {!KeyboardEvent} e - * @private - */ - onKeyDown_(e) { + private onKeyDown_(e: KeyboardEvent) { if (e.key !== ' ' && e.key !== 'Enter') { return; } @@ -212,11 +200,7 @@ } } - /** - * @param {!KeyboardEvent} e - * @private - */ - onKeyUp_(e) { + private onKeyUp_(e: KeyboardEvent) { if (e.key === ' ' || e.key === 'Enter') { e.preventDefault(); e.stopPropagation(); @@ -229,4 +213,10 @@ } } +declare global { + interface HTMLElementTagNameMap { + 'cr-icon-button': CrIconButtonElement; + } +} + customElements.define(CrIconButtonElement.is, CrIconButtonElement);
diff --git a/ui/webui/resources/cr_elements/cr_lottie/cr_lottie.js b/ui/webui/resources/cr_elements/cr_lottie/cr_lottie.js index 18137d4..156a36c 100644 --- a/ui/webui/resources/cr_elements/cr_lottie/cr_lottie.js +++ b/ui/webui/resources/cr_elements/cr_lottie/cr_lottie.js
@@ -22,100 +22,113 @@ export const LOTTIE_JS_URL = 'chrome://resources/lottie/lottie_worker.min.js'; import {assert} from '../../js/assert.m.js'; -import {Polymer, html} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {PolymerElement, html} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -Polymer({ - is: 'cr-lottie', +export class CrLottieElement extends PolymerElement { + static get is() { + return 'cr-lottie'; + } - _template: html`{__html_template__}`, + static get template() { + return html`{__html_template__}`; + } - properties: { - animationUrl: { - type: String, - value: '', - observer: 'animationUrlChanged_', - }, + static get properties() { + return { + animationUrl: { + type: String, + value: '', + observer: 'animationUrlChanged_', + }, - autoplay: { - type: Boolean, - value: false, - }, + autoplay: { + type: Boolean, + value: false, + }, - hidden: { - type: Boolean, - value: false, - }, + hidden: { + type: Boolean, + value: false, + }, - singleLoop: { - type: Boolean, - value: false, - }, - }, + singleLoop: { + type: Boolean, + value: false, + }, + }; + } - /** @private {?HTMLCanvasElement} */ - canvasElement_: null, + constructor() { + super(); - /** @private {boolean} Whether the animation has loaded successfully */ - isAnimationLoaded_: false, + /** @private {?HTMLCanvasElement} */ + this.canvasElement_ = null; - /** @private {?OffscreenCanvas} */ - offscreenCanvas_: null, + /** @private {boolean} Whether the animation has loaded successfully */ + this.isAnimationLoaded_ = false; - /** - * @private {boolean} Whether the canvas has been transferred to the worker - * thread. - */ - hasTransferredCanvas_: false, + /** @private {?OffscreenCanvas} */ + this.offscreenCanvas_ = null; - /** @private {?ResizeObserver} */ - resizeObserver_: null, + /** + * @private {boolean} Whether the canvas has been transferred to the worker + * thread. + */ + this.hasTransferredCanvas_ = false; - /** - * @private {boolean} The last state that was explicitly set via setPlay. - * In case setPlay() is invoked before the animation is initialized, the - * state is stored in this variable. Once the animation initializes, the - * state is sent to the worker. - */ - playState_: false, + /** @private {?ResizeObserver} */ + this.resizeObserver_ = null; - /** - * @private {boolean} Whether the Worker needs to receive new size - * information about the canvas. This is necessary for the corner case - * when the size information is received when the animation is still being - * loaded into the worker. - */ - workerNeedsSizeUpdate_: false, + /** + * @private {boolean} The last state that was explicitly set via setPlay. + * In case setPlay() is invoked before the animation is initialized, the + * state is stored in this variable. Once the animation initializes, the + * state is sent to the worker. + */ + this.playState_ = false; - /** - * @private {boolean} Whether the Worker needs to receive new control - * information about its desired state. This is necessary for the corner case - * when the control information is received when the animation is still being - * loaded into the worker. - */ - workerNeedsPlayControlUpdate_: false, + /** + * @private {boolean} Whether the Worker needs to receive new size + * information about the canvas. This is necessary for the corner case + * when the size information is received when the animation is still being + * loaded into the worker. + */ + this.workerNeedsSizeUpdate_ = false; - /** @private {?Worker} */ - worker_: null, + /** + * @private {boolean} Whether the Worker needs to receive new control + * information about its desired state. This is necessary for the corner + * case when the control information is received when the animation is still + * being loaded into the worker. + */ + this.workerNeedsPlayControlUpdate_ = false; - /** @private {?XMLHttpRequest} The current in-flight request. */ - xhr_: null, + /** @private {?Worker} */ + this.worker_ = null; + + /** @private {?XMLHttpRequest} The current in-flight request. */ + this.xhr_ = null; + } /** @override */ - attached() { + connectedCallback() { + super.connectedCallback(); + // CORS blocks loading worker script from a different origin but // loading scripts as blob and then instantiating it as web worker // is possible. this.sendXmlHttpRequest_(LOTTIE_JS_URL, 'blob', function(response) { - if (this.isAttached) { + if (this.isConnected) { this.worker_ = new Worker(URL.createObjectURL(response)); this.worker_.onmessage = this.onMessage_.bind(this); this.initialize_(); } }.bind(this)); - }, + } /** @override */ - detached() { + disconnectedCallback() { + super.disconnectedCallback(); if (this.resizeObserver_) { this.resizeObserver_.disconnect(); } @@ -127,7 +140,7 @@ this.xhr_.abort(); this.xhr_ = null; } - }, + } /** * Controls the animation based on the value of |shouldPlay|. If the @@ -142,7 +155,7 @@ } else { this.workerNeedsPlayControlUpdate_ = true; } - }, + } /** * Sends control (play/pause) information to the worker. @@ -150,7 +163,7 @@ */ sendPlayControlInformationToWorker_() { this.worker_.postMessage({control: {play: this.playState_}}); - }, + } /** * Initializes all the members of this polymer element. @@ -173,7 +186,7 @@ // Open animation file and start playing the animation. this.sendXmlHttpRequest_( this.animationUrl, 'json', this.initAnimation_.bind(this)); - }, + } /** * Updates the animation that is being displayed. @@ -199,7 +212,7 @@ } this.sendXmlHttpRequest_( this.animationUrl, 'json', this.initAnimation_.bind(this)); - }, + } /** * Computes the draw buffer size for the canvas. This ensures that the @@ -216,7 +229,7 @@ height: clientRect.height * devicePixelRatio, }; return drawSize; - }, + } /** * Returns true if the |maybeValidUrl| provided is safe to use in an @@ -230,7 +243,7 @@ return url.protocol === 'chrome:' || (url.protocol === 'data:' && url.pathname.startsWith('application/json;')); - }, + } /** * Sends an XMLHTTPRequest to load a resource and runs the callback on @@ -259,7 +272,7 @@ successCallback(response); } }; - }, + } /** * Handles the canvas element resize event. If the animation isn't fully @@ -273,7 +286,7 @@ // Mark a size update as necessary once the animation is loaded. this.workerNeedsSizeUpdate_ = true; } - }, + } /** * This informs the offscreen canvas worker of the current canvas size. @@ -281,7 +294,7 @@ */ sendCanvasSizeToWorker_() { this.worker_.postMessage({drawSize: this.getCanvasDrawBufferSize_()}); - }, + } /** * Initializes the the animation on the web worker with the data provided. @@ -301,7 +314,17 @@ this.hasTransferredCanvas_ = true; } this.worker_.postMessage(...message); - }, + } + + /** + * @param {string} eventName + * @param {number=} eventData + * @private + */ + fire_(eventName, eventData) { + this.dispatchEvent(new CustomEvent( + eventName, {bubbles: true, composed: true, detail: eventData})); + } /** * Handles the messages sent from the web worker to its parent thread. @@ -312,17 +335,17 @@ if (event.data.name === 'initialized' && event.data.success) { this.isAnimationLoaded_ = true; this.sendPendingInfo_(); - this.fire('cr-lottie-initialized'); + this.fire_('cr-lottie-initialized'); } else if (event.data.name === 'playing') { - this.fire('cr-lottie-playing'); + this.fire_('cr-lottie-playing'); } else if (event.data.name === 'paused') { - this.fire('cr-lottie-paused'); + this.fire_('cr-lottie-paused'); } else if (event.data.name === 'stopped') { - this.fire('cr-lottie-stopped'); + this.fire_('cr-lottie-stopped'); } else if (event.data.name === 'resized') { - this.fire('cr-lottie-resized', event.data.size); + this.fire_('cr-lottie-resized', event.data.size); } - }, + } /** * Called once the animation is fully loaded into the worker. Sends any @@ -339,6 +362,7 @@ this.workerNeedsPlayControlUpdate_ = false; this.sendPlayControlInformationToWorker_(); } - }, + } +} -}); +customElements.define(CrLottieElement.is, CrLottieElement);
diff --git a/weblayer/browser/tab_impl.cc b/weblayer/browser/tab_impl.cc index bfa7537..f683957 100644 --- a/weblayer/browser/tab_impl.cc +++ b/weblayer/browser/tab_impl.cc
@@ -1204,13 +1204,14 @@ : blink::mojom::DisplayMode::kBrowser; } -void TabImpl::AddNewContents(content::WebContents* source, - std::unique_ptr<content::WebContents> new_contents, - const GURL& target_url, - WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, - bool user_gesture, - bool* was_blocked) { +void TabImpl::AddNewContents( + content::WebContents* source, + std::unique_ptr<content::WebContents> new_contents, + const GURL& target_url, + WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures& window_features, + bool user_gesture, + bool* was_blocked) { if (!new_tab_delegate_) { *was_blocked = true; return;
diff --git a/weblayer/browser/tab_impl.h b/weblayer/browser/tab_impl.h index c982d7b..5cc0ecd 100644 --- a/weblayer/browser/tab_impl.h +++ b/weblayer/browser/tab_impl.h
@@ -299,7 +299,7 @@ std::unique_ptr<content::WebContents> new_contents, const GURL& target_url, WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, + const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; void CloseContents(content::WebContents* source) override;