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

Side by Side Diff: services/shell/public/cpp/shell_connection_ref.h

Issue 1987583002: Fix race in ShellConnectionRef (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « services/shell/public/cpp/lib/shell_connection_ref.cc ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 SERVICES_SHELL_PUBLIC_CPP_SHELL_CONNECTION_REF_H_ 5 #ifndef SERVICES_SHELL_PUBLIC_CPP_SHELL_CONNECTION_REF_H_
6 #define SERVICES_SHELL_PUBLIC_CPP_SHELL_CONNECTION_REF_H_ 6 #define SERVICES_SHELL_PUBLIC_CPP_SHELL_CONNECTION_REF_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
12 13
13 namespace shell { 14 namespace shell {
14 15
15 class ShellConnectionRefImpl; 16 class ShellConnectionRefImpl;
16 17
17 // An interface implementation can keep this object as a member variable to 18 // An interface implementation can keep this object as a member variable to
18 // hold a reference to the ShellConnection, keeping it alive as long as the 19 // hold a reference to the ShellConnection, keeping it alive as long as the
19 // bound implementation exists. 20 // bound implementation exists.
20 // 21 //
21 // This class is safe to use on any thread and instances may be passed to other 22 // This class is safe to use on any thread and instances may be passed to other
(...skipping 19 matching lines...) Expand all
41 42
42 private: 43 private:
43 friend ShellConnectionRefImpl; 44 friend ShellConnectionRefImpl;
44 45
45 // Called from ShellConnectionRefImpl. 46 // Called from ShellConnectionRefImpl.
46 void AddRef(); 47 void AddRef();
47 void Release(); 48 void Release();
48 49
49 const base::Closure quit_closure_; 50 const base::Closure quit_closure_;
50 int ref_count_ = 0; 51 int ref_count_ = 0;
52 base::WeakPtrFactory<ShellConnectionRefFactory> weak_factory_;
51 53
52 DISALLOW_COPY_AND_ASSIGN(ShellConnectionRefFactory); 54 DISALLOW_COPY_AND_ASSIGN(ShellConnectionRefFactory);
53 }; 55 };
54 56
55 } // namespace shell 57 } // namespace shell
56 58
57 #endif // SERVICES_SHELL_PUBLIC_CPP_SHELL_CONNECTION_REF_H_ 59 #endif // SERVICES_SHELL_PUBLIC_CPP_SHELL_CONNECTION_REF_H_
OLDNEW
« no previous file with comments | « services/shell/public/cpp/lib/shell_connection_ref.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698