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

Side by Side Diff: components/html_viewer/html_document_application_delegate.cc

Issue 1431573002: Fix hangs in Mandoline page cycler on Linux with --enable-multiprocess. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/html_viewer/html_document_application_delegate.h" 5 #include "components/html_viewer/html_document_application_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "components/html_viewer/global_state.h" 8 #include "components/html_viewer/global_state.h"
9 #include "components/html_viewer/html_document.h" 9 #include "components/html_viewer/html_document.h"
10 #include "mojo/application/public/cpp/application_connection.h" 10 #include "mojo/application/public/cpp/application_connection.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 ScopedVector<Request> requests_; 50 ScopedVector<Request> requests_;
51 51
52 DISALLOW_COPY_AND_ASSIGN(ServiceConnectorQueue); 52 DISALLOW_COPY_AND_ASSIGN(ServiceConnectorQueue);
53 }; 53 };
54 54
55 HTMLDocumentApplicationDelegate::HTMLDocumentApplicationDelegate( 55 HTMLDocumentApplicationDelegate::HTMLDocumentApplicationDelegate(
56 mojo::InterfaceRequest<mojo::Application> request, 56 mojo::InterfaceRequest<mojo::Application> request,
57 mojo::URLResponsePtr response, 57 mojo::URLResponsePtr response,
58 GlobalState* global_state, 58 GlobalState* global_state,
59 scoped_ptr<mojo::AppRefCount> parent_app_refcount) 59 scoped_ptr<mojo::AppRefCount> parent_app_refcount,
60 const mojo::Callback<void()>& destruct_callback)
60 : app_(this, 61 : app_(this,
61 request.Pass(), 62 request.Pass(),
62 base::Bind(&HTMLDocumentApplicationDelegate::OnTerminate, 63 base::Bind(&HTMLDocumentApplicationDelegate::OnTerminate,
63 base::Unretained(this))), 64 base::Unretained(this))),
64 parent_app_refcount_(parent_app_refcount.Pass()), 65 parent_app_refcount_(parent_app_refcount.Pass()),
65 url_(response->url), 66 url_(response->url),
66 initial_response_(response.Pass()), 67 initial_response_(response.Pass()),
67 global_state_(global_state), 68 global_state_(global_state),
68 html_factory_(this), 69 html_factory_(this),
70 destruct_callback_(destruct_callback),
69 weak_factory_(this) {} 71 weak_factory_(this) {}
70 72
71 HTMLDocumentApplicationDelegate::~HTMLDocumentApplicationDelegate() { 73 HTMLDocumentApplicationDelegate::~HTMLDocumentApplicationDelegate() {
72 // Deleting the documents is going to trigger a callback to 74 // Deleting the documents is going to trigger a callback to
73 // OnHTMLDocumentDeleted() and remove from |documents_|. Copy the set so we 75 // OnHTMLDocumentDeleted() and remove from |documents_|. Copy the set so we
74 // don't have to worry about the set being modified out from under us. 76 // don't have to worry about the set being modified out from under us.
75 std::set<HTMLDocument*> documents2(documents2_); 77 std::set<HTMLDocument*> documents2(documents2_);
76 for (HTMLDocument* doc : documents2) 78 for (HTMLDocument* doc : documents2)
77 doc->Destroy(); 79 doc->Destroy();
78 DCHECK(documents2_.empty()); 80 DCHECK(documents2_.empty());
81 destruct_callback_.Run();
79 } 82 }
80 83
81 // Callback from the quit closure. We key off this rather than 84 // Callback from the quit closure. We key off this rather than
82 // ApplicationDelegate::Quit() as we don't want to shut down the messageloop 85 // ApplicationDelegate::Quit() as we don't want to shut down the messageloop
83 // when we quit (the messageloop is shared among multiple 86 // when we quit (the messageloop is shared among multiple
84 // HTMLDocumentApplicationDelegates). 87 // HTMLDocumentApplicationDelegates).
85 void HTMLDocumentApplicationDelegate::OnTerminate() { 88 void HTMLDocumentApplicationDelegate::OnTerminate() {
86 delete this; 89 delete this;
87 } 90 }
88 91
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 HTMLFrame::CreateParams* params) { 179 HTMLFrame::CreateParams* params) {
177 return new HTMLFrame(params); 180 return new HTMLFrame(params);
178 } 181 }
179 182
180 HTMLWidgetRootLocal* HTMLDocumentApplicationDelegate::CreateHTMLWidgetRootLocal( 183 HTMLWidgetRootLocal* HTMLDocumentApplicationDelegate::CreateHTMLWidgetRootLocal(
181 HTMLWidgetRootLocal::CreateParams* params) { 184 HTMLWidgetRootLocal::CreateParams* params) {
182 return new HTMLWidgetRootLocal(params); 185 return new HTMLWidgetRootLocal(params);
183 } 186 }
184 187
185 } // namespace html_viewer 188 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/html_document_application_delegate.h ('k') | components/html_viewer/layout_test_content_handler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698