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

Side by Side Diff: components/nacl/renderer/platform_info.cc

Issue 2695883003: Change uses of base::JoinString to pass StringPieces where possible. (Closed)
Patch Set: Remove dependency CL. Created 3 years, 9 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
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 #include "base/cpu.h" 5 #include "base/cpu.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/strings/string_piece.h"
7 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
8 #include "build/build_config.h" 9 #include "build/build_config.h"
9 #if defined(OS_WIN) 10 #if defined(OS_WIN)
10 #include "base/win/windows_version.h" 11 #include "base/win/windows_version.h"
11 #endif 12 #endif
12 13
13 namespace nacl { 14 namespace nacl {
14 15
15 const char* GetSandboxArch() { 16 const char* GetSandboxArch() {
16 #if defined(ARCH_CPU_ARM_FAMILY) 17 #if defined(ARCH_CPU_ARM_FAMILY)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // TODO(jfb) Some features are missing, either because the NaCl 53 // TODO(jfb) Some features are missing, either because the NaCl
53 // sandbox doesn't support them, because base::CPU doesn't 54 // sandbox doesn't support them, because base::CPU doesn't
54 // detect them, or because they don't help vector shuffles 55 // detect them, or because they don't help vector shuffles
55 // (and we omit them because it simplifies testing). Add the 56 // (and we omit them because it simplifies testing). Add the
56 // other features. 57 // other features.
57 // 58 //
58 // TODO(jfb) The following is x86-specific. The base::CPU class 59 // TODO(jfb) The following is x86-specific. The base::CPU class
59 // doesn't handle other architectures very well, and we 60 // doesn't handle other architectures very well, and we
60 // should at least detect the presence of ARM's integer 61 // should at least detect the presence of ARM's integer
61 // divide. 62 // divide.
62 std::vector<std::string> features; 63 std::vector<base::StringPiece> features;
63 base::CPU cpu; 64 base::CPU cpu;
64 65
65 // On x86, SSE features are ordered: the most recent one implies the 66 // On x86, SSE features are ordered: the most recent one implies the
66 // others. Care is taken here to only specify the latest SSE version, 67 // others. Care is taken here to only specify the latest SSE version,
67 // whereas non-SSE features don't follow this model: POPCNT is 68 // whereas non-SSE features don't follow this model: POPCNT is
68 // effectively always implied by SSE4.2 but has to be specified 69 // effectively always implied by SSE4.2 but has to be specified
69 // separately. 70 // separately.
70 // 71 //
71 // TODO: AVX2, AVX, SSE 4.2. 72 // TODO: AVX2, AVX, SSE 4.2.
72 if (cpu.has_sse41()) features.push_back("+sse4.1"); 73 if (cpu.has_sse41()) features.push_back("+sse4.1");
73 // TODO: SSE 4A, SSE 4. 74 // TODO: SSE 4A, SSE 4.
74 else if (cpu.has_ssse3()) features.push_back("+ssse3"); 75 else if (cpu.has_ssse3()) features.push_back("+ssse3");
75 // TODO: SSE 3 76 // TODO: SSE 3
76 else if (cpu.has_sse2()) features.push_back("+sse2"); 77 else if (cpu.has_sse2()) features.push_back("+sse2");
77 78
78 if (cpu.has_popcnt()) features.push_back("+popcnt"); 79 if (cpu.has_popcnt()) features.push_back("+popcnt");
79 80
80 // TODO: AES, LZCNT, ... 81 // TODO: AES, LZCNT, ...
81 return base::JoinString(features, ","); 82 return base::JoinString(features, ",");
82 } 83 }
83 84
84 } // namespace nacl 85 } // namespace nacl
OLDNEW
« no previous file with comments | « components/history/core/browser/top_sites_database.cc ('k') | components/password_manager/core/browser/password_ui_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698