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

Side by Side Diff: mojo/shell/content_handler_connection.cc

Issue 1228743002: Mandoline: Move ContentHandlerConnection into separate file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/shell/content_handler_connection.h"
6
7 #include "mojo/shell/application_manager.h"
8
9 namespace mojo {
10 namespace shell {
11
12 ContentHandlerConnection::ContentHandlerConnection(
13 ApplicationManager* manager,
14 const GURL& content_handler_url,
15 const GURL& requestor_url,
16 const std::string& qualifier)
17 : manager_(manager),
18 content_handler_url_(content_handler_url),
19 content_handler_qualifier_(qualifier),
20 connection_closed_(false) {
21 ServiceProviderPtr services;
22 mojo::URLRequestPtr request(mojo::URLRequest::New());
23 request->url = mojo::String::From(content_handler_url.spec());
24 manager->ConnectToApplicationInternal(
25 request.Pass(), qualifier, requestor_url, GetProxy(&services),
26 nullptr, base::Closure());
27 MessagePipe pipe;
28 content_handler_.Bind(
29 InterfacePtrInfo<ContentHandler>(pipe.handle0.Pass(), 0u));
30 services->ConnectToService(ContentHandler::Name_, pipe.handle1.Pass());
31 content_handler_.set_error_handler(this);
32 }
33
34 void ContentHandlerConnection::CloseConnection() {
35 if (connection_closed_)
36 return;
jam 2015/07/09 17:27:23 in this case, how does the object get deleted?
Fady Samuel 2015/07/09 17:49:21 The point of this flag is to ensure that CloseConn
jam 2015/07/09 18:00:17 Sure. But what I mean, if connection_closed_ is tr
37 connection_closed_ = true;
38 manager_->OnContentHandlerConnectionClosed(this);
39 delete this;
40 }
41
42 ContentHandlerConnection::~ContentHandlerConnection() {
43 // If this DCHECK fails then something has tried to delete this object without
44 // calling CloseConnection.
45 DCHECK(connection_closed_);
46 }
47
48 void ContentHandlerConnection::OnConnectionError() {
49 CloseConnection();
50 }
51
52 } // namespace shell
53 } // namespace mojo
OLDNEW
« mojo/shell/content_handler_connection.h ('K') | « mojo/shell/content_handler_connection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698