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

Unified Diff: headless/public/util/managed_dispatch_url_request_job.cc

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
Index: headless/public/util/managed_dispatch_url_request_job.cc
diff --git a/headless/public/util/managed_dispatch_url_request_job.cc b/headless/public/util/managed_dispatch_url_request_job.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2f79373af0d99083d1f6ec9fb2315fec0bcedd3a
--- /dev/null
+++ b/headless/public/util/managed_dispatch_url_request_job.cc
@@ -0,0 +1,47 @@
+// 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.
+
+#include "headless/public/util/managed_dispatch_url_request_job.h"
+
+#include "headless/public/util/url_request_dispatcher.h"
+
+namespace headless {
+
+ManagedDispatchURLRequestJob::ManagedDispatchURLRequestJob(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
+ URLRequestDispatcher* url_request_dispatcher)
+ : net::URLRequestJob(request, network_delegate),
+ url_request_dispatcher_(url_request_dispatcher) {
+ url_request_dispatcher_->JobCreated(this);
+}
+
+ManagedDispatchURLRequestJob::~ManagedDispatchURLRequestJob() {
+ // We can be fairly certain the renderer has finished by the time the job gets
+ // deleted.
+ url_request_dispatcher_->JobDeleted(this);
+}
+
+void ManagedDispatchURLRequestJob::Kill() {
+ url_request_dispatcher_->JobKilled(this);
+ URLRequestJob::Kill();
+}
+
+void ManagedDispatchURLRequestJob::DispatchStartError(net::Error error) {
+ url_request_dispatcher_->JobFailed(this, error);
+}
+
+void ManagedDispatchURLRequestJob::DispatchHeadersComplete() {
+ url_request_dispatcher_->DataReady(this);
+}
+
+void ManagedDispatchURLRequestJob::OnHeadersComplete() {
+ NotifyHeadersComplete();
+}
+
+void ManagedDispatchURLRequestJob::OnStartError(net::Error error) {
+ NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED, error));
+}
+
+} // namespace headless

Powered by Google App Engine
This is Rietveld 408576698