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

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

Issue 2843113002: make base::SharedMemoryHandle a class on POSIX. (Closed)
Patch Set: Fix test error. Created 3 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
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"
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 if (!kUseSharedMemoryForFieldTrials) 1149 if (!kUseSharedMemoryForFieldTrials)
1150 return false; 1150 return false;
1151 1151
1152 if (fd_key == -1) 1152 if (fd_key == -1)
1153 return false; 1153 return false;
1154 1154
1155 int fd = GlobalDescriptors::GetInstance()->MaybeGet(fd_key); 1155 int fd = GlobalDescriptors::GetInstance()->MaybeGet(fd_key);
1156 if (fd == -1) 1156 if (fd == -1)
1157 return false; 1157 return false;
1158 1158
1159 #if defined(OS_MACOSX) && !defined(OS_IOS)
1160 SharedMemoryHandle shm_handle(FileDescriptor(fd, true)); 1159 SharedMemoryHandle shm_handle(FileDescriptor(fd, true));
1161 #else
1162 SharedMemoryHandle shm_handle(fd, true);
1163 #endif
1164 1160
1165 bool result = FieldTrialList::CreateTrialsFromSharedMemoryHandle(shm_handle); 1161 bool result = FieldTrialList::CreateTrialsFromSharedMemoryHandle(shm_handle);
1166 DCHECK(result); 1162 DCHECK(result);
1167 return true; 1163 return true;
1168 } 1164 }
1169 #endif 1165 #endif
1170 1166
1171 // static 1167 // static
1172 bool FieldTrialList::CreateTrialsFromSharedMemoryHandle( 1168 bool FieldTrialList::CreateTrialsFromSharedMemoryHandle(
1173 SharedMemoryHandle shm_handle) { 1169 SharedMemoryHandle shm_handle) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 return; 1354 return;
1359 } 1355 }
1360 AutoLock auto_lock(global_->lock_); 1356 AutoLock auto_lock(global_->lock_);
1361 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); 1357 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name();
1362 trial->AddRef(); 1358 trial->AddRef();
1363 trial->SetTrialRegistered(); 1359 trial->SetTrialRegistered();
1364 global_->registered_[trial->trial_name()] = trial; 1360 global_->registered_[trial->trial_name()] = trial;
1365 } 1361 }
1366 1362
1367 } // namespace base 1363 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698