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

Side by Side Diff: mojo/common/weak_binding_set.h

Issue 1198513003: Revert "Adding Chrome-side WebVR interface and Cardboard implementation" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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
« no previous file with comments | « content/renderer/vr/vr_type_converters.cc ('k') | third_party/cardboard-java/BUILD.gn » ('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_COMMON_WEAK_BINDING_SET_H_ 5 #ifndef MOJO_COMMON_WEAK_BINDING_SET_H_
6 #define MOJO_COMMON_WEAK_BINDING_SET_H_ 6 #define MOJO_COMMON_WEAK_BINDING_SET_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 36
37 void CloseAllBindings() { 37 void CloseAllBindings() {
38 for (const auto& it : bindings_) { 38 for (const auto& it : bindings_) {
39 if (it) 39 if (it)
40 it->Close(); 40 it->Close();
41 } 41 }
42 bindings_.clear(); 42 bindings_.clear();
43 } 43 }
44 44
45 bool empty() const { return bindings_.empty(); }
46
47 private: 45 private:
48 // ErrorHandler implementation. 46 // ErrorHandler implementation.
49 void OnConnectionError() override { 47 void OnConnectionError() override {
50 // Clear any deleted bindings. 48 // Clear any deleted bindings.
51 bindings_.erase( 49 bindings_.erase(
52 std::remove_if(bindings_.begin(), bindings_.end(), 50 std::remove_if(bindings_.begin(), bindings_.end(),
53 [](const base::WeakPtr<WeakBinding<Interface>>& p) { 51 [](const base::WeakPtr<WeakBinding<Interface>>& p) {
54 return p.get() == nullptr; 52 return p.get() == nullptr;
55 }), 53 }),
56 bindings_.end()); 54 bindings_.end());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 mojo::Binding<Interface> binding_; 97 mojo::Binding<Interface> binding_;
100 ErrorHandler* error_handler_; 98 ErrorHandler* error_handler_;
101 base::WeakPtrFactory<WeakBinding> weak_ptr_factory_; 99 base::WeakPtrFactory<WeakBinding> weak_ptr_factory_;
102 100
103 DISALLOW_COPY_AND_ASSIGN(WeakBinding); 101 DISALLOW_COPY_AND_ASSIGN(WeakBinding);
104 }; 102 };
105 103
106 } // namespace mojo 104 } // namespace mojo
107 105
108 #endif // MOJO_COMMON_WEAK_BINDING_SET_H_ 106 #endif // MOJO_COMMON_WEAK_BINDING_SET_H_
OLDNEW
« no previous file with comments | « content/renderer/vr/vr_type_converters.cc ('k') | third_party/cardboard-java/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698