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
content / browser / devtools / devtools_throttle_handle.h [blame]
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_THROTTLE_HANDLE_H_
#define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_THROTTLE_HANDLE_H_
#include "base/functional/callback.h"
#include "base/memory/scoped_refptr.h"
namespace content {
// A simple class that holds the callback that unthrottles either a SW or a
// navigation. It is refcounted and runs `throttle_callback` when destroyed.
class DevToolsThrottleHandle : public base::RefCounted<DevToolsThrottleHandle> {
public:
explicit DevToolsThrottleHandle(base::OnceCallback<void()> throttle_callback);
DevToolsThrottleHandle(const DevToolsThrottleHandle&) = delete;
DevToolsThrottleHandle& operator=(const DevToolsThrottleHandle&) = delete;
private:
friend class base::RefCounted<DevToolsThrottleHandle>;
~DevToolsThrottleHandle();
base::OnceCallback<void()> throttle_callback_;
};
} // namespace content
#endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_THROTTLE_HANDLE_H_