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

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

Issue 2633203002: Enable field trial shared memory segment on Android. (Closed)
Patch Set: Add #error Unsupported OS. Created 3 years, 11 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 | « no previous file | base/metrics/field_trial.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 // FieldTrial is a class for handling details of statistical experiments 5 // FieldTrial is a class for handling details of statistical experiments
6 // performed by actual users in the field (i.e., in a shipped or beta product). 6 // performed by actual users in the field (i.e., in a shipped or beta product).
7 // All code is called exclusively on the UI thread currently. 7 // All code is called exclusively on the UI thread currently.
8 // 8 //
9 // The simplest example is an experiment to see whether one of two options 9 // The simplest example is an experiment to see whether one of two options
10 // produces "better" results across our user population. In that scenario, UMA 10 // produces "better" results across our user population. In that scenario, UMA
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 const char* enable_features_switch, 560 const char* enable_features_switch,
561 const char* disable_features_switch, 561 const char* disable_features_switch,
562 FeatureList* feature_list); 562 FeatureList* feature_list);
563 563
564 #if defined(OS_WIN) 564 #if defined(OS_WIN)
565 // On Windows, we need to explicitly pass down any handles to be inherited. 565 // On Windows, we need to explicitly pass down any handles to be inherited.
566 // This function adds the shared memory handle to field trial state to the 566 // This function adds the shared memory handle to field trial state to the
567 // list of handles to be inherited. 567 // list of handles to be inherited.
568 static void AppendFieldTrialHandleIfNeeded( 568 static void AppendFieldTrialHandleIfNeeded(
569 base::HandlesToInheritVector* handles); 569 base::HandlesToInheritVector* handles);
570 #elif defined(OS_POSIX) 570 #endif
571
572 #if defined(OS_POSIX) && !defined(OS_NACL)
571 // On POSIX, we also need to explicitly pass down this file descriptor that 573 // On POSIX, we also need to explicitly pass down this file descriptor that
572 // should be shared with the child process. Returns kInvalidPlatformFile if no 574 // should be shared with the child process. Returns kInvalidPlatformFile if no
573 // handle exists or was not initialized properly. 575 // handle exists or was not initialized properly.
574 static PlatformFile GetFieldTrialHandle(); 576 static PlatformFile GetFieldTrialHandle();
575 #endif 577 #endif
576 578
577 // Adds a switch to the command line containing the field trial state as a 579 // Adds a switch to the command line containing the field trial state as a
578 // string (if not using shared memory to share field trial state), or the 580 // string (if not using shared memory to share field trial state), or the
579 // shared memory handle + length. 581 // shared memory handle + length.
580 // Needs the |field_trial_handle_switch| argument to be passed in since base/ 582 // Needs the |field_trial_handle_switch| argument to be passed in since base/
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest, AssociateFieldTrialParams); 644 FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest, AssociateFieldTrialParams);
643 FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest, ClearParamsFromSharedMemory); 645 FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest, ClearParamsFromSharedMemory);
644 646
645 #if defined(OS_WIN) 647 #if defined(OS_WIN)
646 // Takes in |handle_switch| from the command line which represents the shared 648 // Takes in |handle_switch| from the command line which represents the shared
647 // memory handle for field trials, parses it, and creates the field trials. 649 // memory handle for field trials, parses it, and creates the field trials.
648 // Returns true on success, false on failure. 650 // Returns true on success, false on failure.
649 static bool CreateTrialsFromHandleSwitch(const std::string& handle_switch); 651 static bool CreateTrialsFromHandleSwitch(const std::string& handle_switch);
650 #endif 652 #endif
651 653
652 #if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_ANDROID) 654 #if defined(OS_POSIX) && !defined(OS_NACL)
653 // On POSIX systems that use the zygote, we look up the correct fd that backs 655 // On POSIX systems that use the zygote, we look up the correct fd that backs
654 // the shared memory segment containing the field trials by looking it up via 656 // the shared memory segment containing the field trials by looking it up via
655 // an fd key in GlobalDescriptors. Returns true on success, false on failure. 657 // an fd key in GlobalDescriptors. Returns true on success, false on failure.
656 static bool CreateTrialsFromDescriptor(int fd_key); 658 static bool CreateTrialsFromDescriptor(int fd_key);
657 #endif 659 #endif
658 660
659 // Takes an unmapped SharedMemoryHandle, creates a SharedMemory object from it 661 // Takes an unmapped SharedMemoryHandle, creates a SharedMemory object from it
660 // and maps it with the correct size. 662 // and maps it with the correct size.
661 static bool CreateTrialsFromSharedMemoryHandle(SharedMemoryHandle shm_handle); 663 static bool CreateTrialsFromSharedMemoryHandle(SharedMemoryHandle shm_handle);
662 664
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 733
732 // Tracks whether CreateTrialsFromCommandLine() has been called. 734 // Tracks whether CreateTrialsFromCommandLine() has been called.
733 bool create_trials_from_command_line_called_ = false; 735 bool create_trials_from_command_line_called_ = false;
734 736
735 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); 737 DISALLOW_COPY_AND_ASSIGN(FieldTrialList);
736 }; 738 };
737 739
738 } // namespace base 740 } // namespace base
739 741
740 #endif // BASE_METRICS_FIELD_TRIAL_H_ 742 #endif // BASE_METRICS_FIELD_TRIAL_H_
OLDNEW
« no previous file with comments | « no previous file | base/metrics/field_trial.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698