Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(456)

Side by Side Diff: headless/public/util/managed_dispatch_url_request_job.h

Issue 2260793002: Headless utility classes for making deterministic protocol handlers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef HEADLESS_PUBLIC_UTIL_MANAGED_DISPATCH_URL_REQUEST_JOB_H_
6 #define HEADLESS_PUBLIC_UTIL_MANAGED_DISPATCH_URL_REQUEST_JOB_H_
7
8 #include "base/macros.h"
9 #include "net/base/net_errors.h"
10 #include "net/url_request/url_request.h"
11 #include "net/url_request/url_request_job.h"
12
13 namespace headless {
14 class URLRequestDispatcher;
15
16 // A ManagedDispatchURLRequestJob exists to allow a URLRequestDispatcher control
17 // the order in which a set of fetches complete. Typically this is done to make
18 // fetching deterministic. NOTE URLRequestDispatcher sub classes use
19 // OnHeadersComplete and OnStartError to drive the URLRequestJob.
20 class ManagedDispatchURLRequestJob : public net::URLRequestJob {
21 public:
22 ManagedDispatchURLRequestJob(net::URLRequest* request,
23 net::NetworkDelegate* network_delegate,
24 URLRequestDispatcher* url_request_dispatcher);
25
26 ~ManagedDispatchURLRequestJob() override;
27
28 // Tells the net::URLRequestJob that the data has been fetched and is ready to
29 // be consumed.
30 virtual void OnHeadersComplete();
31
32 // Tells the net::URLRequestJob that the fetch failed.
33 virtual void OnStartError(net::Error error);
34
35 protected:
36 // net::URLRequestJob implementation:
37 void Kill() override;
38
39 // Tell the dispatcher the request failed.
40 virtual void DispatchStartError(net::Error error);
41
42 // Tell the dispatcher the data is ready for the net stack to consume.
43 virtual void DispatchHeadersComplete();
44
45 URLRequestDispatcher* url_request_dispatcher_; // Not owned.
46
47 private:
48 // Derived classes should not use NotifyHeadersComplete or NotifyStartError
49 // directly. Instead they should use DispatchHeadersComplete or
50 // DispatchStartError.
51 using URLRequestJob::NotifyHeadersComplete;
52 using URLRequestJob::NotifyStartError;
53
54 DISALLOW_COPY_AND_ASSIGN(ManagedDispatchURLRequestJob);
55 };
56
57 } // namespace headless
58
59 #endif // HEADLESS_PUBLIC_UTIL_MANAGED_DISPATCH_URL_REQUEST_JOB_H_
OLDNEW
« no previous file with comments | « headless/public/util/generic_url_request_job_test.cc ('k') | headless/public/util/managed_dispatch_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698