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/application/public/cpp/application_connection.h" | 5 #include "mojo/application/public/cpp/application_connection.h" |
6 | 6 |
| 7 #include "base/logging.h" |
| 8 |
7 namespace mojo { | 9 namespace mojo { |
8 | 10 |
| 11 ApplicationConnection::ApplicationConnection() : connection_closed_(false) { |
| 12 } |
| 13 |
| 14 void ApplicationConnection::CloseConnection() { |
| 15 if (connection_closed_) |
| 16 return; |
| 17 OnCloseConnection(); |
| 18 connection_closed_ = true; |
| 19 delete this; |
| 20 } |
| 21 |
9 ApplicationConnection::~ApplicationConnection() { | 22 ApplicationConnection::~ApplicationConnection() { |
| 23 // If this DCHECK fails then something has tried to delete this object without |
| 24 // calling CloseConnection. |
| 25 DCHECK(connection_closed_); |
10 } | 26 } |
11 | 27 |
12 } // namespace mojo | 28 } // namespace mojo |
OLD | NEW |