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

Side by Side Diff: mojo/services/view_manager/view_manager_init_service_impl.cc

Issue 372273004: Shutdown cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 | Annotate | Revision Log
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/view_manager/view_manager_init_service_impl.h" 5 #include "mojo/services/view_manager/view_manager_init_service_impl.h"
6 6
7 #include "base/bind.h"
7 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" 8 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h"
8 #include "mojo/services/view_manager/ids.h" 9 #include "mojo/services/view_manager/ids.h"
9 #include "mojo/services/view_manager/view_manager_service_impl.h" 10 #include "mojo/services/view_manager/view_manager_service_impl.h"
10 11
11 namespace mojo { 12 namespace mojo {
12 class ApplicationConnection; 13 class ApplicationConnection;
13 namespace view_manager { 14 namespace view_manager {
14 namespace service { 15 namespace service {
15 16
16 ViewManagerInitServiceImpl::ConnectParams::ConnectParams() {} 17 ViewManagerInitServiceImpl::ConnectParams::ConnectParams() {}
17 18
18 ViewManagerInitServiceImpl::ConnectParams::~ConnectParams() {} 19 ViewManagerInitServiceImpl::ConnectParams::~ConnectParams() {}
19 20
20 ViewManagerInitServiceImpl::ViewManagerInitServiceImpl( 21 ViewManagerInitServiceImpl::ViewManagerInitServiceImpl(
21 ApplicationConnection* connection) 22 ApplicationConnection* connection)
22 : root_node_manager_(connection, this), 23 : root_node_manager_(
24 connection,
25 this,
26 base::Bind(&ViewManagerInitServiceImpl::OnNativeViewportDeleted,
27 base::Unretained(this))),
23 is_tree_host_ready_(false) { 28 is_tree_host_ready_(false) {
24 } 29 }
25 30
26 ViewManagerInitServiceImpl::~ViewManagerInitServiceImpl() { 31 ViewManagerInitServiceImpl::~ViewManagerInitServiceImpl() {
27 } 32 }
28 33
29 void ViewManagerInitServiceImpl::MaybeEmbedRoot( 34 void ViewManagerInitServiceImpl::MaybeEmbedRoot(
30 const std::string& url, 35 const std::string& url,
31 const Callback<void(bool)>& callback) { 36 const Callback<void(bool)>& callback) {
32 if (!is_tree_host_ready_) 37 if (!is_tree_host_ready_)
(...skipping 17 matching lines...) Expand all
50 MaybeEmbedRoot(url.To<std::string>(), callback); 55 MaybeEmbedRoot(url.To<std::string>(), callback);
51 } 56 }
52 57
53 void ViewManagerInitServiceImpl::OnRootViewManagerWindowTreeHostCreated() { 58 void ViewManagerInitServiceImpl::OnRootViewManagerWindowTreeHostCreated() {
54 DCHECK(!is_tree_host_ready_); 59 DCHECK(!is_tree_host_ready_);
55 is_tree_host_ready_ = true; 60 is_tree_host_ready_ = true;
56 if (connect_params_.get()) 61 if (connect_params_.get())
57 MaybeEmbedRoot(connect_params_->url, connect_params_->callback); 62 MaybeEmbedRoot(connect_params_->url, connect_params_->callback);
58 } 63 }
59 64
65 void ViewManagerInitServiceImpl::OnNativeViewportDeleted() {
66 // TODO(beng): Should not have to rely on implementation detail of
67 // InterfaceImpl to close the connection. Instead should simply
68 // be able to delete this object.
69 internal_state()->router()->CloseMessagePipe();
70 }
71
60 } // namespace service 72 } // namespace service
61 } // namespace view_manager 73 } // namespace view_manager
62 } // namespace mojo 74 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698