OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/services/network/url_loader_impl.h" | 5 #include "mojo/services/network/url_loader_impl.h" |
6 | 6 |
7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "mojo/common/common_type_converters.h" | 9 #include "mojo/common/common_type_converters.h" |
10 #include "mojo/common/url_type_converters.h" | 10 #include "mojo/common/url_type_converters.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 ScopedDataPipeConsumerHandle pipe_; | 89 ScopedDataPipeConsumerHandle pipe_; |
90 uint32_t num_bytes_; | 90 uint32_t num_bytes_; |
91 uint32_t offset_; | 91 uint32_t offset_; |
92 | 92 |
93 DISALLOW_COPY_AND_ASSIGN(UploadDataPipeElementReader); | 93 DISALLOW_COPY_AND_ASSIGN(UploadDataPipeElementReader); |
94 }; | 94 }; |
95 | 95 |
96 } // namespace | 96 } // namespace |
97 | 97 |
98 URLLoaderImpl::URLLoaderImpl(NetworkContext* context, | 98 URLLoaderImpl::URLLoaderImpl(NetworkContext* context, |
99 InterfaceRequest<URLLoader> request) | 99 InterfaceRequest<URLLoader> request, |
| 100 scoped_ptr<mojo::AppRefCount> app_refcount) |
100 : context_(context), | 101 : context_(context), |
101 response_body_buffer_size_(0), | 102 response_body_buffer_size_(0), |
102 auto_follow_redirects_(true), | 103 auto_follow_redirects_(true), |
103 connected_(true), | 104 connected_(true), |
104 binding_(this, request.Pass()), | 105 binding_(this, request.Pass()), |
| 106 app_refcount_(app_refcount.Pass()), |
105 weak_ptr_factory_(this) { | 107 weak_ptr_factory_(this) { |
106 binding_.set_error_handler(this); | 108 binding_.set_error_handler(this); |
107 context_->RegisterURLLoader(this); | 109 context_->RegisterURLLoader(this); |
108 } | 110 } |
109 | 111 |
110 URLLoaderImpl::~URLLoaderImpl() { | 112 URLLoaderImpl::~URLLoaderImpl() { |
111 context_->DeregisterURLLoader(this); | 113 context_->DeregisterURLLoader(this); |
112 } | 114 } |
113 | 115 |
114 void URLLoaderImpl::Cleanup() { | 116 void URLLoaderImpl::Cleanup() { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 366 |
365 void URLLoaderImpl::ListenForPeerClosed() { | 367 void URLLoaderImpl::ListenForPeerClosed() { |
366 handle_watcher_.Start(response_body_stream_.get(), | 368 handle_watcher_.Start(response_body_stream_.get(), |
367 MOJO_HANDLE_SIGNAL_PEER_CLOSED, | 369 MOJO_HANDLE_SIGNAL_PEER_CLOSED, |
368 MOJO_DEADLINE_INDEFINITE, | 370 MOJO_DEADLINE_INDEFINITE, |
369 base::Bind(&URLLoaderImpl::OnResponseBodyStreamClosed, | 371 base::Bind(&URLLoaderImpl::OnResponseBodyStreamClosed, |
370 base::Unretained(this))); | 372 base::Unretained(this))); |
371 } | 373 } |
372 | 374 |
373 } // namespace mojo | 375 } // namespace mojo |
OLD | NEW |