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

Side by Side Diff: mojo/services/network/url_loader_impl.cc

Issue 1236333003: Fix double delete in url_loader_impl.cc (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 5 years, 5 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 7 #include <memory>
8 8
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 URLLoaderImpl::URLLoaderImpl(NetworkContext* context, 261 URLLoaderImpl::URLLoaderImpl(NetworkContext* context,
262 InterfaceRequest<URLLoader> request, 262 InterfaceRequest<URLLoader> request,
263 std::vector<URLLoaderInterceptorPtr> interceptors) 263 std::vector<URLLoaderInterceptorPtr> interceptors)
264 : context_(context), 264 : context_(context),
265 interceptors_(std::move(interceptors)), 265 interceptors_(std::move(interceptors)),
266 response_body_buffer_size_(0), 266 response_body_buffer_size_(0),
267 auto_follow_redirects_(true), 267 auto_follow_redirects_(true),
268 current_fetcher_id_(0), 268 current_fetcher_id_(0),
269 binding_(this, request.Pass()) { 269 binding_(this, request.Pass()) {
270 for (auto& interceptor : interceptors_) { 270 for (auto& interceptor : interceptors_) {
271 interceptor.set_connection_error_handler([this]() { OnConnectionError(); }); 271 interceptor.set_connection_error_handler([this]() { delete this; });
272 } 272 }
273 interceptor_index_ = interceptors_.size() - 1; 273 interceptor_index_ = interceptors_.size() - 1;
274 binding_.set_connection_error_handler([this]() { OnConnectionError(); }); 274 binding_.set_connection_error_handler([this]() { OnConnectionError(); });
275 context_->RegisterURLLoader(this); 275 context_->RegisterURLLoader(this);
276 } 276 }
277 277
278 URLLoaderImpl::~URLLoaderImpl() { 278 URLLoaderImpl::~URLLoaderImpl() {
279 context_->DeregisterURLLoader(this); 279 context_->DeregisterURLLoader(this);
280 } 280 }
281 281
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 if ((*it)->id() == current_fetcher_id_) { 576 if ((*it)->id() == current_fetcher_id_) {
577 last_status_ = fetcher->QueryStatus(); 577 last_status_ = fetcher->QueryStatus();
578 last_status_->is_loading = false; 578 last_status_->is_loading = false;
579 } 579 }
580 body_fetchers_.erase(it); 580 body_fetchers_.erase(it);
581 if (body_fetchers_.empty() and !binding_.is_bound()) 581 if (body_fetchers_.empty() and !binding_.is_bound())
582 delete this; 582 delete this;
583 } 583 }
584 584
585 } // namespace mojo 585 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698