| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chromecast/crash/app_state_tracker.h" | 5 #include "chromecast/crash/app_state_tracker.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "chromecast/crash/cast_crash_keys.h" | 8 #include "chromecast/crash/cast_crash_keys.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| 11 | 11 |
| 12 struct CurrentAppState { | 12 struct CurrentAppState { |
| 13 std::string previous_app; | 13 std::string previous_app; |
| 14 std::string current_app; | 14 std::string current_app; |
| 15 std::string last_launched_app; | 15 std::string last_launched_app; |
| 16 }; | 16 }; |
| 17 | 17 |
| 18 base::LazyInstance<CurrentAppState> g_app_state = LAZY_INSTANCE_INITIALIZER; | 18 base::LazyInstance<CurrentAppState>::DestructorAtExit g_app_state = |
| 19 LAZY_INSTANCE_INITIALIZER; |
| 19 | 20 |
| 20 CurrentAppState* GetAppState() { | 21 CurrentAppState* GetAppState() { |
| 21 return g_app_state.Pointer(); | 22 return g_app_state.Pointer(); |
| 22 } | 23 } |
| 23 | 24 |
| 24 } // namespace | 25 } // namespace |
| 25 | 26 |
| 26 namespace chromecast { | 27 namespace chromecast { |
| 27 | 28 |
| 28 // static | 29 // static |
| (...skipping 25 matching lines...) Expand all Loading... |
| 54 CurrentAppState* app_state = GetAppState(); | 55 CurrentAppState* app_state = GetAppState(); |
| 55 app_state->previous_app = app_state->current_app; | 56 app_state->previous_app = app_state->current_app; |
| 56 app_state->current_app = app_id; | 57 app_state->current_app = app_id; |
| 57 | 58 |
| 58 base::debug::SetCrashKeyValue(crash_keys::kCurrentApp, app_id); | 59 base::debug::SetCrashKeyValue(crash_keys::kCurrentApp, app_id); |
| 59 base::debug::SetCrashKeyValue(crash_keys::kPreviousApp, | 60 base::debug::SetCrashKeyValue(crash_keys::kPreviousApp, |
| 60 app_state->previous_app); | 61 app_state->previous_app); |
| 61 } | 62 } |
| 62 | 63 |
| 63 } // namespace chromecast | 64 } // namespace chromecast |
| OLD | NEW |