| // Copyright 2026 The Chromium Authors | |
| // Use of this source code is governed by a BSD-style license that can be | |
| // found in the LICENSE file. | |
| #include "content/browser/preloading/prefetch/pre_prefetch_handle_impl.h" | |
| #include "content/public/browser/browser_thread.h" | |
| #include "content/public/common/content_features.h" | |
| namespace content { | |
| PrePrefetchHandleImpl::PrePrefetchHandleImpl( | |
| std::unique_ptr<PrePrefetchContainer> pre_prefetch_container) | |
| : pre_prefetch_container_(std::move(pre_prefetch_container)) { | |
| CHECK(base::FeatureList::IsEnabled(features::kPrefetchOffTheMainThread)); | |
| CHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI), | |
| base::NotFatalUntil::M159); | |
| } | |
| PrePrefetchHandleImpl::~PrePrefetchHandleImpl() = default; | |
| std::unique_ptr<PrePrefetchContainer> | |
| PrePrefetchHandleImpl::TakePrePrefetchContainerOnUIThread() { | |
| CHECK_CURRENTLY_ON(BrowserThread::UI, base::NotFatalUntil::M159); | |
| CHECK(pre_prefetch_container_); | |
| return std::move(pre_prefetch_container_); | |
| } | |
| } // namespace content |