| Index: mojo/package_manager/content_handler_connection.cc
|
| diff --git a/mojo/package_manager/content_handler_connection.cc b/mojo/package_manager/content_handler_connection.cc
|
| index e778c4d09befd05c951b365b572a0fd504e21f8b..8552f8933b24489fdde490230259f719ffc07a26 100644
|
| --- a/mojo/package_manager/content_handler_connection.cc
|
| +++ b/mojo/package_manager/content_handler_connection.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "mojo/package_manager/content_handler_connection.h"
|
|
|
| +#include "base/bind.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "mojo/shell/application_manager.h"
|
| #include "mojo/shell/connect_to_application_params.h"
|
| @@ -21,7 +22,8 @@ ContentHandlerConnection::ContentHandlerConnection(
|
| : connection_closed_callback_(connection_closed_callback),
|
| identity_(content_handler),
|
| connection_closed_(false),
|
| - id_(id) {
|
| + id_(id),
|
| + ref_count_(0) {
|
| ServiceProviderPtr services;
|
|
|
| scoped_ptr<shell::ConnectToApplicationParams> params(
|
| @@ -39,6 +41,16 @@ ContentHandlerConnection::ContentHandlerConnection(
|
| [this]() { CloseConnection(); });
|
| }
|
|
|
| +void ContentHandlerConnection::StartApplication(
|
| + InterfaceRequest<Application> request,
|
| + URLResponsePtr response) {
|
| + content_handler_->StartApplication(
|
| + request.Pass(), response.Pass(),
|
| + base::Bind(&ContentHandlerConnection::ApplicationDestructed,
|
| + base::Unretained(this)));
|
| + ref_count_++;
|
| +}
|
| +
|
| void ContentHandlerConnection::CloseConnection() {
|
| if (connection_closed_)
|
| return;
|
| @@ -53,5 +65,10 @@ ContentHandlerConnection::~ContentHandlerConnection() {
|
| DCHECK(connection_closed_);
|
| }
|
|
|
| +void ContentHandlerConnection::ApplicationDestructed() {
|
| + if (!--ref_count_)
|
| + CloseConnection();
|
| +}
|
| +
|
| } // namespace package_manager
|
| } // namespace mojo
|
|
|