blob: 0a4f1d11d1fc31bb3d90f0b2526e88b771d84b0a (
plain)
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
42
43
44
|
// Copyright 2016 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 HEADLESS_PUBLIC_UTIL_EXPEDITED_DISPATCHER_H_
#define HEADLESS_PUBLIC_UTIL_EXPEDITED_DISPATCHER_H_
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/single_thread_task_runner.h"
#include "headless/public/headless_export.h"
#include "headless/public/util/url_request_dispatcher.h"
#include "net/base/net_errors.h"
namespace headless {
class ManagedDispatchURLRequestJob;
// This class dispatches calls to OnHeadersComplete and OnStartError
// immediately sacrificing determinism for performance.
class HEADLESS_EXPORT ExpeditedDispatcher : public URLRequestDispatcher {
public:
explicit ExpeditedDispatcher(
scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner);
~ExpeditedDispatcher() override;
// UrlRequestDispatcher implementation:
void JobCreated(ManagedDispatchURLRequestJob* job) override;
void JobKilled(ManagedDispatchURLRequestJob* job) override;
void JobFailed(ManagedDispatchURLRequestJob* job, net::Error error) override;
void DataReady(ManagedDispatchURLRequestJob* job) override;
void JobDeleted(ManagedDispatchURLRequestJob* job) override;
void NavigationRequested(
std::unique_ptr<NavigationRequest> navigation_request) override;
protected:
scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_;
DISALLOW_COPY_AND_ASSIGN(ExpeditedDispatcher);
};
} // namespace headless
#endif // HEADLESS_PUBLIC_UTIL_EXPEDITED_DISPATCHER_H_
|