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

Unified Diff: headless/public/util/expedited_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/deterministic_dispatcher_test.cc ('k') | headless/public/util/expedited_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/public/util/expedited_dispatcher.h
diff --git a/headless/public/util/expedited_dispatcher.h b/headless/public/util/expedited_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..39b8057fdfc5656bad3e94c3f41d61674a4b9c52
--- /dev/null
+++ b/headless/public/util/expedited_dispatcher.h
@@ -0,0 +1,41 @@
+// 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/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 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;
+
+ private:
+ scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExpeditedDispatcher);
+};
+
+} // namespace headless
+
+#endif // HEADLESS_PUBLIC_UTIL_EXPEDITED_DISPATCHER_H_
« no previous file with comments | « headless/public/util/deterministic_dispatcher_test.cc ('k') | headless/public/util/expedited_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698