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

Side by Side Diff: services/view_manager/view_manager_app.cc

Issue 989553002: Fix crash in ViewManager: fail gracefully when no ServiceProvider is (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 "services/view_manager/view_manager_app.h" 5 #include "services/view_manager/view_manager_app.h"
6 6
7 #include "mojo/application/application_runner_chromium.h" 7 #include "mojo/application/application_runner_chromium.h"
8 #include "mojo/common/tracing_impl.h" 8 #include "mojo/common/tracing_impl.h"
9 #include "mojo/public/c/system/main.h" 9 #include "mojo/public/c/system/main.h"
10 #include "mojo/public/cpp/application/application_connection.h" 10 #include "mojo/public/cpp/application/application_connection.h"
(...skipping 27 matching lines...) Expand all
38 if (connection_manager_.get()) { 38 if (connection_manager_.get()) {
39 VLOG(1) << "ViewManager allows only one window manager connection."; 39 VLOG(1) << "ViewManager allows only one window manager connection.";
40 return false; 40 return false;
41 } 41 }
42 wm_app_connection_ = connection; 42 wm_app_connection_ = connection;
43 // |connection| originates from the WindowManager. Let it connect directly 43 // |connection| originates from the WindowManager. Let it connect directly
44 // to the ViewManager and WindowManagerInternalClient. 44 // to the ViewManager and WindowManagerInternalClient.
45 connection->AddService<ViewManagerService>(this); 45 connection->AddService<ViewManagerService>(this);
46 connection->AddService<WindowManagerInternalClient>(this); 46 connection->AddService<WindowManagerInternalClient>(this);
47 connection->ConnectToService(&wm_internal_); 47 connection->ConnectToService(&wm_internal_);
48 // If no ServiceProvider has been sent, refuse the connection.
sky 2015/03/06 18:25:28 This doesn't make sense. It is expected that the f
49 if (!wm_internal_)
50 return false;
48 wm_internal_.set_error_handler(this); 51 wm_internal_.set_error_handler(this);
49 52
50 scoped_ptr<DefaultDisplayManager> display_manager(new DefaultDisplayManager( 53 scoped_ptr<DefaultDisplayManager> display_manager(new DefaultDisplayManager(
51 app_impl_, connection, 54 app_impl_, connection,
52 base::Bind(&ViewManagerApp::OnLostConnectionToWindowManager, 55 base::Bind(&ViewManagerApp::OnLostConnectionToWindowManager,
53 base::Unretained(this)))); 56 base::Unretained(this))));
54 connection_manager_.reset( 57 connection_manager_.reset(
55 new ConnectionManager(this, display_manager.Pass(), wm_internal_.get())); 58 new ConnectionManager(this, display_manager.Pass(), wm_internal_.get()));
56 return true; 59 return true;
57 } 60 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 wm_internal_client_binding_->set_error_handler(this); 128 wm_internal_client_binding_->set_error_handler(this);
126 wm_internal_->SetViewManagerClient( 129 wm_internal_->SetViewManagerClient(
127 wm_internal_client_request_.PassMessagePipe()); 130 wm_internal_client_request_.PassMessagePipe());
128 } 131 }
129 132
130 void ViewManagerApp::OnConnectionError() { 133 void ViewManagerApp::OnConnectionError() {
131 ApplicationImpl::Terminate(); 134 ApplicationImpl::Terminate();
132 } 135 }
133 136
134 } // namespace view_manager 137 } // namespace view_manager
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