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

Side by Side Diff: content/browser/service_worker/service_worker_blob_reader.h

Issue 2290453005: service worker: Refactor blob reading out of ServiceWorkerURLRequestJob (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_blob_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_BLOB_READER_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_BLOB_READER_H_
7
8 #include <memory>
9
10 #include "content/browser/service_worker/service_worker_url_request_job.h"
11 #include "net/base/io_buffer.h"
12 #include "net/url_request/url_request.h"
13
14 namespace content {
15
16 // Reads a blob response for ServiceWorkerURLRequestJob.
17 // Owned by ServiceWorkerURLRequestJob.
18 class ServiceWorkerBlobReader : public net::URLRequest::Delegate {
19 public:
20 explicit ServiceWorkerBlobReader(ServiceWorkerURLRequestJob* owner);
21 ~ServiceWorkerBlobReader() override;
22
23 // Starts reading the blob. owner_->OnResponseStarted will be called when the
24 // response starts.
25 void Start(std::unique_ptr<storage::BlobDataHandle> blob_data_handle,
26 const net::URLRequestContext* request_context);
27
28 scoped_refptr<net::IOBufferWithSize> response_metadata() {
29 return blob_request_->response_info().metadata;
30 }
31
32 // Same as URLRequestJob::ReadRawData. If ERR_IO_PENDING is returned,
33 // owner_->OnReadRawDataComplete will be called when the read completes.
34 int ReadRawData(net::IOBuffer* buf, int buf_size);
35
36 // net::URLRequest::Delegate overrides
37 void OnReceivedRedirect(net::URLRequest* request,
38 const net::RedirectInfo& redirect_info,
39 bool* defer_redirect) override;
40 void OnAuthRequired(net::URLRequest* request,
41 net::AuthChallengeInfo* auth_info) override;
42 void OnCertificateRequested(
43 net::URLRequest* request,
44 net::SSLCertRequestInfo* cert_request_info) override;
45 void OnSSLCertificateError(net::URLRequest* request,
46 const net::SSLInfo& ssl_info,
47 bool fatal) override;
48 void OnResponseStarted(net::URLRequest* request) override;
49 void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
50
51 private:
52 ServiceWorkerURLRequestJob* owner_;
53 std::unique_ptr<net::URLRequest> blob_request_;
54
55 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerBlobReader);
56 };
57
58 } // namespace content
59
60 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_BLOB_READER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_blob_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698