Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdio.h> | 5 #include <stdio.h> |
| 6 #if defined(OS_POSIX) | 6 #if defined(OS_POSIX) |
| 7 #include <unistd.h> | 7 #include <unistd.h> |
| 8 #elif defined(OS_WIN) | 8 #elif defined(OS_WIN) |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif | 10 #endif |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 // conditionals inside the argument of a macro, so we put the | 185 // conditionals inside the argument of a macro, so we put the |
| 186 // conditionals on a helper function. We are already in an anonymous | 186 // conditionals on a helper function. We are already in an anonymous |
| 187 // namespace, so the name of the helper is not visible in external | 187 // namespace, so the name of the helper is not visible in external |
| 188 // scope. | 188 // scope. |
| 189 #if defined(OS_POSIX) | 189 #if defined(OS_POSIX) |
| 190 base::FilePath::StringType NumberOfCoresAsFilePathString() { | 190 base::FilePath::StringType NumberOfCoresAsFilePathString() { |
| 191 char string_rep[23]; | 191 char string_rep[23]; |
| 192 long nprocessors = sysconf(_SC_NPROCESSORS_ONLN); | 192 long nprocessors = sysconf(_SC_NPROCESSORS_ONLN); |
| 193 #if TELEMETRY | 193 #if TELEMETRY |
| 194 fprintf(stderr, "browser says nprocessors = %ld\n", nprocessors); | 194 fprintf(stderr, "browser says nprocessors = %ld\n", nprocessors); |
| 195 fflush(NULL); | 195 // crbug.com/597899 |
|
Mark Seaborn
2016/03/25 21:26:25
This reference isn't really necessary -- the absen
cylee1
2016/03/25 21:34:03
Ye.. But anyway I think it doesn't hurt to keep it
| |
| 196 fflush(stderr); | |
| 196 #endif | 197 #endif |
| 197 snprintf(string_rep, sizeof string_rep, "%ld", nprocessors); | 198 snprintf(string_rep, sizeof string_rep, "%ld", nprocessors); |
| 198 return string_rep; | 199 return string_rep; |
| 199 } | 200 } |
| 200 #elif defined(OS_WIN) | 201 #elif defined(OS_WIN) |
| 201 base::FilePath::StringType NumberOfCoresAsFilePathString() { | 202 base::FilePath::StringType NumberOfCoresAsFilePathString() { |
| 202 wchar_t string_rep[23]; | 203 wchar_t string_rep[23]; |
| 203 SYSTEM_INFO system_info; | 204 SYSTEM_INFO system_info; |
| 204 GetSystemInfo(&system_info); | 205 GetSystemInfo(&system_info); |
| 205 #if TELEMETRY | 206 #if TELEMETRY |
| 206 fprintf(stderr, "browser says nprocessors = %lu\n", | 207 fprintf(stderr, "browser says nprocessors = %lu\n", |
| 207 system_info.dwNumberOfProcessors); | 208 system_info.dwNumberOfProcessors); |
| 208 fflush(NULL); | 209 // crbug.com/597899 |
| 210 fflush(stderr); | |
| 209 #endif | 211 #endif |
| 210 _snwprintf_s(string_rep, sizeof string_rep / sizeof string_rep[0], _TRUNCATE, | 212 _snwprintf_s(string_rep, sizeof string_rep / sizeof string_rep[0], _TRUNCATE, |
| 211 L"%u", system_info.dwNumberOfProcessors); | 213 L"%u", system_info.dwNumberOfProcessors); |
| 212 return string_rep; | 214 return string_rep; |
| 213 } | 215 } |
| 214 #endif | 216 #endif |
| 215 | 217 |
| 216 #if TELEMETRY | 218 #if TELEMETRY |
| 217 static void PathTelemetry(base::FilePath::StringType const &path) { | 219 static void PathTelemetry(base::FilePath::StringType const &path) { |
| 218 # if defined(OS_WIN) | 220 # if defined(OS_WIN) |
| 219 fwprintf(stderr, L"path = %s\n", path.c_str()); | 221 fwprintf(stderr, L"path = %s\n", path.c_str()); |
| 220 # else | 222 # else |
| 221 fprintf(stderr, "path = %s\n", path.c_str()); | 223 fprintf(stderr, "path = %s\n", path.c_str()); |
| 222 # endif | 224 # endif |
| 223 fflush(NULL); | 225 // crbug.com/597899 |
| 226 fflush(stderr); | |
| 224 } | 227 } |
| 225 #else | 228 #else |
| 226 static void PathTelemetry(base::FilePath::StringType const &path) { | 229 static void PathTelemetry(base::FilePath::StringType const &path) { |
| 227 (void) path; | 230 (void) path; |
| 228 } | 231 } |
| 229 #endif | 232 #endif |
| 230 | 233 |
| 231 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_SysconfNprocessorsOnln, { | 234 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_SysconfNprocessorsOnln, { |
| 232 base::FilePath::StringType path = | 235 base::FilePath::StringType path = |
| 233 FILE_PATH_LITERAL("sysconf_nprocessors_onln_test.html?cpu_count="); | 236 FILE_PATH_LITERAL("sysconf_nprocessors_onln_test.html?cpu_count="); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 } | 431 } |
| 429 | 432 |
| 430 // TODO(ncbray) support glibc and PNaCl | 433 // TODO(ncbray) support glibc and PNaCl |
| 431 // flaky: crbug.com/375894 | 434 // flaky: crbug.com/375894 |
| 432 IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlibExtension, DISABLED_MimeHandler) { | 435 IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlibExtension, DISABLED_MimeHandler) { |
| 433 RunNaClIntegrationTest(FILE_PATH_LITERAL( | 436 RunNaClIntegrationTest(FILE_PATH_LITERAL( |
| 434 "ppapi_extension_mime_handler.html")); | 437 "ppapi_extension_mime_handler.html")); |
| 435 } | 438 } |
| 436 | 439 |
| 437 } // namespace | 440 } // namespace |
| OLD | NEW |