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

Side by Side Diff: base/metrics/field_trial.cc

Issue 2929013002: Revert of Add crash keys about field trial shared memory errors. (Closed)
Patch Set: Rebase & fix conflicts. Created 3 years, 6 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 | « base/memory/shared_memory_posix.cc ('k') | chrome/app/chrome_crash_reporter_client_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/metrics/field_trial.h" 5 #include "base/metrics/field_trial.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/base_switches.h" 10 #include "base/base_switches.h"
11 #include "base/build_time.h" 11 #include "base/build_time.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/debug/activity_tracker.h" 13 #include "base/debug/activity_tracker.h"
14 #include "base/debug/crash_logging.h"
15 #include "base/logging.h" 14 #include "base/logging.h"
16 #include "base/metrics/field_trial_param_associator.h" 15 #include "base/metrics/field_trial_param_associator.h"
17 #include "base/process/memory.h" 16 #include "base/process/memory.h"
18 #include "base/rand_util.h" 17 #include "base/rand_util.h"
19 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/string_split.h" 19 #include "base/strings/string_split.h"
21 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
22 #include "base/strings/stringprintf.h" 21 #include "base/strings/stringprintf.h"
23 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
24 #include "base/unguessable_token.h" 23 #include "base/unguessable_token.h"
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 return; 1272 return;
1274 1273
1275 SharedMemoryCreateOptions options; 1274 SharedMemoryCreateOptions options;
1276 options.size = kFieldTrialAllocationSize; 1275 options.size = kFieldTrialAllocationSize;
1277 options.share_read_only = true; 1276 options.share_read_only = true;
1278 #if defined(OS_MACOSX) && !defined(OS_IOS) 1277 #if defined(OS_MACOSX) && !defined(OS_IOS)
1279 options.type = SharedMemoryHandle::POSIX; 1278 options.type = SharedMemoryHandle::POSIX;
1280 #endif 1279 #endif
1281 1280
1282 std::unique_ptr<SharedMemory> shm(new SharedMemory()); 1281 std::unique_ptr<SharedMemory> shm(new SharedMemory());
1283 if (!shm->Create(options)) { 1282 if (!shm->Create(options))
1284 #if !defined(OS_NACL)
1285 // Temporary for http://crbug.com/703649.
1286 base::debug::ScopedCrashKey crash_key(
1287 "field_trial_shmem_create_error",
1288 base::IntToString(static_cast<int>(shm->get_last_error())));
1289 #endif
1290 OnOutOfMemory(kFieldTrialAllocationSize); 1283 OnOutOfMemory(kFieldTrialAllocationSize);
1291 }
1292 1284
1293 if (!shm->Map(kFieldTrialAllocationSize)) { 1285 if (!shm->Map(kFieldTrialAllocationSize))
1294 #if !defined(OS_NACL)
1295 // Temporary for http://crbug.com/703649.
1296 base::debug::ScopedCrashKey crash_key(
1297 "field_trial_shmem_map_error",
1298 base::IntToString(static_cast<int>(shm->get_last_error())));
1299 #endif
1300 OnOutOfMemory(kFieldTrialAllocationSize); 1286 OnOutOfMemory(kFieldTrialAllocationSize);
1301 }
1302 1287
1303 global_->field_trial_allocator_.reset( 1288 global_->field_trial_allocator_.reset(
1304 new FieldTrialAllocator(std::move(shm), 0, kAllocatorName, false)); 1289 new FieldTrialAllocator(std::move(shm), 0, kAllocatorName, false));
1305 global_->field_trial_allocator_->CreateTrackingHistograms(kAllocatorName); 1290 global_->field_trial_allocator_->CreateTrackingHistograms(kAllocatorName);
1306 1291
1307 // Add all existing field trials. 1292 // Add all existing field trials.
1308 for (const auto& registered : global_->registered_) { 1293 for (const auto& registered : global_->registered_) {
1309 AddToAllocatorWhileLocked(global_->field_trial_allocator_.get(), 1294 AddToAllocatorWhileLocked(global_->field_trial_allocator_.get(),
1310 registered.second); 1295 registered.second);
1311 } 1296 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 return; 1408 return;
1424 } 1409 }
1425 AutoLock auto_lock(global_->lock_); 1410 AutoLock auto_lock(global_->lock_);
1426 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); 1411 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name();
1427 trial->AddRef(); 1412 trial->AddRef();
1428 trial->SetTrialRegistered(); 1413 trial->SetTrialRegistered();
1429 global_->registered_[trial->trial_name()] = trial; 1414 global_->registered_[trial->trial_name()] = trial;
1430 } 1415 }
1431 1416
1432 } // namespace base 1417 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/shared_memory_posix.cc ('k') | chrome/app/chrome_crash_reporter_client_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698