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

Side by Side Diff: components/metrics/metrics_service.h

Issue 630983003: Declaring the weak_ptr_factory in proper order in src/components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « components/enhanced_bookmarks/enhanced_bookmark_model.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file defines a service that collects information about the user 5 // This file defines a service that collects information about the user
6 // experience in order to help improve future versions of the app. 6 // experience in order to help improve future versions of the app.
7 7
8 #ifndef COMPONENTS_METRICS_METRICS_SERVICE_H_ 8 #ifndef COMPONENTS_METRICS_METRICS_SERVICE_H_
9 #define COMPONENTS_METRICS_METRICS_SERVICE_H_ 9 #define COMPONENTS_METRICS_METRICS_SERVICE_H_
10 10
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 SENDING_INITIAL_METRICS_LOG, // Initial metrics log being sent. 237 SENDING_INITIAL_METRICS_LOG, // Initial metrics log being sent.
238 SENDING_OLD_LOGS, // Sending unsent logs from last session. 238 SENDING_OLD_LOGS, // Sending unsent logs from last session.
239 SENDING_CURRENT_LOGS, // Sending ongoing logs as they accrue. 239 SENDING_CURRENT_LOGS, // Sending ongoing logs as they accrue.
240 }; 240 };
241 241
242 enum ShutdownCleanliness { 242 enum ShutdownCleanliness {
243 CLEANLY_SHUTDOWN = 0xdeadbeef, 243 CLEANLY_SHUTDOWN = 0xdeadbeef,
244 NEED_TO_SHUTDOWN = ~CLEANLY_SHUTDOWN 244 NEED_TO_SHUTDOWN = ~CLEANLY_SHUTDOWN
245 }; 245 };
246 246
247 friend class ::MetricsServiceAccessor;
248
247 typedef std::vector<SyntheticTrialGroup> SyntheticTrialGroups; 249 typedef std::vector<SyntheticTrialGroup> SyntheticTrialGroups;
248 250
249 // Calls into the client to start metrics gathering. 251 // Calls into the client to start metrics gathering.
250 void StartGatheringMetrics(); 252 void StartGatheringMetrics();
251 253
252 // Callback that moves the state to INIT_TASK_DONE. When this is called, the 254 // Callback that moves the state to INIT_TASK_DONE. When this is called, the
253 // state should be INIT_TASK_SCHEDULED. 255 // state should be INIT_TASK_SCHEDULED.
254 void FinishedGatheringInitialMetrics(); 256 void FinishedGatheringInitialMetrics();
255 257
256 void OnUserAction(const std::string& action); 258 void OnUserAction(const std::string& action);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 // Whether there is a current log upload in progress. 425 // Whether there is a current log upload in progress.
424 bool log_upload_in_progress_; 426 bool log_upload_in_progress_;
425 427
426 // Whether the MetricsService object has received any notifications since 428 // Whether the MetricsService object has received any notifications since
427 // the last time a transmission was sent. 429 // the last time a transmission was sent.
428 bool idle_since_last_transmission_; 430 bool idle_since_last_transmission_;
429 431
430 // A number that identifies the how many times the app has been launched. 432 // A number that identifies the how many times the app has been launched.
431 int session_id_; 433 int session_id_;
432 434
433 // Weak pointers factory used to post task on different threads. All weak
434 // pointers managed by this factory have the same lifetime as MetricsService.
435 base::WeakPtrFactory<MetricsService> self_ptr_factory_;
436
437 // Weak pointers factory used for saving state. All weak pointers managed by
438 // this factory are invalidated in ScheduleNextStateSave.
439 base::WeakPtrFactory<MetricsService> state_saver_factory_;
440
441 // The scheduler for determining when uploads should happen. 435 // The scheduler for determining when uploads should happen.
442 scoped_ptr<MetricsReportingScheduler> scheduler_; 436 scoped_ptr<MetricsReportingScheduler> scheduler_;
443 437
444 // Stores the time of the first call to |GetUptimes()|. 438 // Stores the time of the first call to |GetUptimes()|.
445 base::TimeTicks first_updated_time_; 439 base::TimeTicks first_updated_time_;
446 440
447 // Stores the time of the last call to |GetUptimes()|. 441 // Stores the time of the last call to |GetUptimes()|.
448 base::TimeTicks last_updated_time_; 442 base::TimeTicks last_updated_time_;
449 443
450 // Field trial groups that map to Chrome configuration states. 444 // Field trial groups that map to Chrome configuration states.
451 SyntheticTrialGroups synthetic_trial_groups_; 445 SyntheticTrialGroups synthetic_trial_groups_;
452 446
453 // Execution phase the browser is in. 447 // Execution phase the browser is in.
454 static ExecutionPhase execution_phase_; 448 static ExecutionPhase execution_phase_;
455 449
456 // Reduntant marker to check that we completed our shutdown, and set the 450 // Reduntant marker to check that we completed our shutdown, and set the
457 // exited-cleanly bit in the prefs. 451 // exited-cleanly bit in the prefs.
458 static ShutdownCleanliness clean_shutdown_status_; 452 static ShutdownCleanliness clean_shutdown_status_;
459 453
460 friend class ::MetricsServiceAccessor;
461
462 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); 454 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess);
463 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, 455 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest,
464 PermutedEntropyCacheClearedWhenLowEntropyReset); 456 PermutedEntropyCacheClearedWhenLowEntropyReset);
465 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); 457 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial);
466 458
459 // Weak pointers factory used to post task on different threads. All weak
460 // pointers managed by this factory have the same lifetime as MetricsService.
461 base::WeakPtrFactory<MetricsService> self_ptr_factory_;
462
463 // Weak pointers factory used for saving state. All weak pointers managed by
464 // this factory are invalidated in ScheduleNextStateSave.
465 base::WeakPtrFactory<MetricsService> state_saver_factory_;
466
467 DISALLOW_COPY_AND_ASSIGN(MetricsService); 467 DISALLOW_COPY_AND_ASSIGN(MetricsService);
468 }; 468 };
469 469
470 } // namespace metrics 470 } // namespace metrics
471 471
472 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ 472 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_
OLDNEW
« no previous file with comments | « components/enhanced_bookmarks/enhanced_bookmark_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698