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

Unified Diff: headless/public/util/url_request_dispatcher.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « headless/public/util/url_fetcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/public/util/url_request_dispatcher.h
diff --git a/headless/public/util/url_request_dispatcher.h b/headless/public/util/url_request_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..1f34509a3a53ecbedd252eebe313680dd4871f4b
--- /dev/null
+++ b/headless/public/util/url_request_dispatcher.h
@@ -0,0 +1,45 @@
+// 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_URL_REQUEST_DISPATCHER_H_
+#define HEADLESS_PUBLIC_UTIL_URL_REQUEST_DISPATCHER_H_
+
+#include "base/macros.h"
+#include "net/base/net_errors.h"
+
+namespace headless {
+class ManagedDispatchURLRequestJob;
+
+// Interface to abstract and potentially reorder (for determinism) calls to
+// ManagedDispatchUrlRequestJob::OnHeadersComplete and
+// ManagedDispatchUrlRequestJob::NotifyStartError.
+class URLRequestDispatcher {
+ public:
+ URLRequestDispatcher() {}
+ virtual ~URLRequestDispatcher() {}
+
+ // Tells us a URLRequestJob was created. Can be called from any thread.
+ virtual void JobCreated(ManagedDispatchURLRequestJob* job) = 0;
+
+ // Tells us a URLRequestJob got killed. Can be called from any thread.
+ virtual void JobKilled(ManagedDispatchURLRequestJob* job) = 0;
+
+ // Tells us a URLRequestJob failed. Can be called from any thread.
+ virtual void JobFailed(ManagedDispatchURLRequestJob* job,
+ net::Error error) = 0;
+
+ // Tells us a URLRequestJob has fetched the data and is ready for the net
+ // stack to consume it. Can be called from any thread.
+ virtual void DataReady(ManagedDispatchURLRequestJob* job) = 0;
+
+ // Tells us the job has finished. Can be called from any thread.
+ virtual void JobDeleted(ManagedDispatchURLRequestJob* job) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(URLRequestDispatcher);
+};
+
+} // namespace headless
+
+#endif // HEADLESS_PUBLIC_UTIL_URL_REQUEST_DISPATCHER_H_
« no previous file with comments | « headless/public/util/url_fetcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698