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

Side by Side Diff: mojo/public/cpp/application/lib/service_connector.h

Issue 327523004: Introduce very beginning of navigation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add url dependency to two smaple apps Created 6 years, 6 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
« no previous file with comments | « mojo/mojo_services.gypi ('k') | mojo/service_manager/service_manager_unittest.cc » ('j') | 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 #ifndef MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_CONNECTOR_H_ 5 #ifndef MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_CONNECTOR_H_
6 #define MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_CONNECTOR_H_ 6 #define MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_CONNECTOR_H_
7 7
8 #include <assert.h> 8 #include <assert.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 connections_.push_back(impl); 116 connections_.push_back(impl);
117 } 117 }
118 118
119 void RemoveConnection(ServiceImpl* impl) { 119 void RemoveConnection(ServiceImpl* impl) {
120 // Called from ~ServiceImpl, in response to a connection error. 120 // Called from ~ServiceImpl, in response to a connection error.
121 for (typename ConnectionList::iterator it = connections_.begin(); 121 for (typename ConnectionList::iterator it = connections_.begin();
122 it != connections_.end(); ++it) { 122 it != connections_.end(); ++it) {
123 if (*it == impl) { 123 if (*it == impl) {
124 delete impl; 124 delete impl;
125 connections_.erase(it); 125 connections_.erase(it);
126 if (connections_.empty())
127 owner_->RemoveServiceConnector(this);
128 return; 126 return;
129 } 127 }
130 } 128 }
131 } 129 }
132 130
133 Context* context() const { return context_; } 131 Context* context() const { return context_; }
134 132
135 private: 133 private:
136 typedef std::vector<ServiceImpl*> ConnectionList; 134 typedef std::vector<ServiceImpl*> ConnectionList;
137 ConnectionList connections_; 135 ConnectionList connections_;
138 Context* context_; 136 Context* context_;
139 }; 137 };
140 138
141 } // namespace internal 139 } // namespace internal
142 } // namespace mojo 140 } // namespace mojo
143 141
144 #endif // MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_CONNECTOR_H_ 142 #endif // MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_CONNECTOR_H_
OLDNEW
« no previous file with comments | « mojo/mojo_services.gypi ('k') | mojo/service_manager/service_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698