1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
android_webview / browser / network_service / aw_browser_context_io_thread_handle.h [blame]
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_BROWSER_CONTEXT_IO_THREAD_HANDLE_H_
#define ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_BROWSER_CONTEXT_IO_THREAD_HANDLE_H_
#include "android_webview/browser/aw_browser_context.h"
#include "base/memory/ref_counted.h"
namespace android_webview {
class AwContentsIoThreadClient;
// This is an IO thread owned object that wraps an AwBrowserContext. The
// internal AwBrowserContext pointer can be gotten from the UI thread or the
// associated browser context's service worker IO thread client can be gotten
// on the IO thread.
class AwBrowserContextIoThreadHandle
: public base::RefCountedThreadSafe<AwBrowserContextIoThreadHandle> {
public:
// Constructs a new AwBrowserContextIoThreadHandle wrapping the provided
// AwBrowserContext.
explicit AwBrowserContextIoThreadHandle(AwBrowserContext*);
// Returns the internal pointer to the AwBrowserContext. Must only be called
// from the UI thread.
AwBrowserContext* GetOnUiThread();
// Gets the service worker IO thread client associated with the wrapped
// AwBrowserContext.
std::unique_ptr<AwContentsIoThreadClient> GetServiceWorkerIoThreadClient();
private:
friend class base::RefCountedThreadSafe<AwBrowserContextIoThreadHandle>;
~AwBrowserContextIoThreadHandle();
raw_ptr<AwBrowserContext> browser_context_;
};
} // namespace android_webview
#endif // ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_BROWSER_CONTEXT_IO_THREAD_HANDLE_H_