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

Side by Side Diff: components/arc/instance_holder.h

Issue 2205843004: [Merge to M53] arc: Initial implemetation of Chrome sync for Arc packages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 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 | « chrome/chrome_browser_ui.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 COMPONENTS_ARC_INSTANCE_HOLDER_H_ 5 #ifndef COMPONENTS_ARC_INSTANCE_HOLDER_H_
6 #define COMPONENTS_ARC_INSTANCE_HOLDER_H_ 6 #define COMPONENTS_ARC_INSTANCE_HOLDER_H_
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 observer->OnInstanceReady(); 55 observer->OnInstanceReady();
56 } 56 }
57 57
58 void RemoveObserver(Observer* observer) { 58 void RemoveObserver(Observer* observer) {
59 DCHECK(thread_checker_.CalledOnValidThread()); 59 DCHECK(thread_checker_.CalledOnValidThread());
60 observer_list_.RemoveObserver(observer); 60 observer_list_.RemoveObserver(observer);
61 } 61 }
62 62
63 // Called when the channel is closed. 63 // Called when the channel is closed.
64 void CloseChannel() { 64 void CloseChannel() {
65 if (!ptr_) 65 if (!raw_ptr_)
66 return; 66 return;
67 67
68 ptr_.reset(); 68 ptr_.reset();
69 raw_ptr_ = nullptr; 69 raw_ptr_ = nullptr;
70 version_ = 0; 70 version_ = 0;
71 if (observer_list_.might_have_observers()) { 71 if (observer_list_.might_have_observers()) {
72 typename base::ObserverList<Observer>::Iterator it(&observer_list_); 72 typename base::ObserverList<Observer>::Iterator it(&observer_list_);
73 Observer* obs; 73 Observer* obs;
74 while ((obs = it.GetNext()) != nullptr) 74 while ((obs = it.GetNext()) != nullptr)
75 obs->OnInstanceClosed(); 75 obs->OnInstanceClosed();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // This needs to be the last member in order to cancel all inflight callbacks 128 // This needs to be the last member in order to cancel all inflight callbacks
129 // before destroying any other members. 129 // before destroying any other members.
130 base::WeakPtrFactory<InstanceHolder<T>> weak_factory_; 130 base::WeakPtrFactory<InstanceHolder<T>> weak_factory_;
131 131
132 DISALLOW_COPY_AND_ASSIGN(InstanceHolder<T>); 132 DISALLOW_COPY_AND_ASSIGN(InstanceHolder<T>);
133 }; 133 };
134 134
135 } // namespace arc 135 } // namespace arc
136 136
137 #endif // COMPONENTS_ARC_INSTANCE_HOLDER_H_ 137 #endif // COMPONENTS_ARC_INSTANCE_HOLDER_H_
OLDNEW
« no previous file with comments | « chrome/chrome_browser_ui.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698