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

Side by Side Diff: remoting/host/host_attributes.h

Issue 2464293002: [Chromoting] GetHostAttributes with tests (Closed)
Patch Set: Resolve review comments Created 4 years, 1 month 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 2016 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 #ifndef REMOTING_HOST_HOST_ATTRIBUTES_H_
6 #define REMOTING_HOST_HOST_ATTRIBUTES_H_
7
8 #include <string>
9
10 namespace remoting {
11
12 struct DynamicAttribute {
Sergey Ulanov 2016/11/07 20:11:33 I don't think we need this to be in the header.
Hzj_jie 2016/11/08 01:29:54 Done.
13 const char* name;
14 bool(* value)();
Sergey Ulanov 2016/11/07 20:11:33 this is not a good name for a function. maybe get_
Hzj_jie 2016/11/08 01:29:54 Done.
15 };
16
17 // This structure requires to be POD, so use EvaluatedValue() instead of |value|
18 // or |attribute| variables directly.
19 // This class is thread-safe, but |attribute|.value() may be evaluated several
20 // times concurrently if EvaluatedValue() function is called concurrently.
21 struct StaticAttribute {
22 static StaticAttribute Create(DynamicAttribute&& attribute) {
Hzj_jie 2016/11/05 05:29:28 MSVC does not allow to change a constexpr object,
23 // std::move is not constexpr in c++ 11.
24 // TODO(zijiehe): Add std::move once we move to c++ 14.
25 return StaticAttribute { attribute, false, false };
26 }
27
28 const char* name() const;
29 bool EvaluatedValue();
30
31 DynamicAttribute attribute;
Hzj_jie 2016/11/05 05:29:28 I do not think it's a good idea to evaluate the St
Sergey Ulanov 2016/11/07 20:11:33 We are not allowed to have any static initializers
Hzj_jie 2016/11/08 01:29:54 See my comments in host_attributes_win.h
32 bool evaluated;
33 bool value;
34 };
35
36 // Returns a comma-separated string to represent host attributes. The result may
37 // vary if any system configurations change. So consumers should not cache the
38 // result.
39 // This function is thread-safe.
40 std::string GetHostAttributes();
41
42 } // namespace remoting
43
44 #endif // REMOTING_HOST_HOST_ATTRIBUTES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698