| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/app_list/profile_loader.h" | 5 #include "chrome/browser/ui/app_list/profile_loader.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 Profile* profile, | 52 Profile* profile, |
| 53 Profile::CreateStatus status) { | 53 Profile::CreateStatus status) { |
| 54 switch (status) { | 54 switch (status) { |
| 55 case Profile::CREATE_STATUS_CREATED: | 55 case Profile::CREATE_STATUS_CREATED: |
| 56 break; | 56 break; |
| 57 case Profile::CREATE_STATUS_INITIALIZED: | 57 case Profile::CREATE_STATUS_INITIALIZED: |
| 58 if (profile_load_sequence_id == profile_load_sequence_id_) | 58 if (profile_load_sequence_id == profile_load_sequence_id_) |
| 59 callback.Run(profile); | 59 callback.Run(profile); |
| 60 DecrementPendingProfileLoads(); | 60 DecrementPendingProfileLoads(); |
| 61 break; | 61 break; |
| 62 case Profile::CREATE_STATUS_FAIL: | 62 case Profile::CREATE_STATUS_LOCAL_FAIL: |
| 63 case Profile::CREATE_STATUS_REMOTE_FAIL: |
| 63 DecrementPendingProfileLoads(); | 64 DecrementPendingProfileLoads(); |
| 64 break; | 65 break; |
| 66 case Profile::MAX_CREATE_STATUS: |
| 67 NOTREACHED(); |
| 68 break; |
| 65 } | 69 } |
| 66 } | 70 } |
| 67 | 71 |
| 68 void ProfileLoader::IncrementPendingProfileLoads() { | 72 void ProfileLoader::IncrementPendingProfileLoads() { |
| 69 pending_profile_loads_++; | 73 pending_profile_loads_++; |
| 70 if (pending_profile_loads_ == 1) | 74 if (pending_profile_loads_ == 1) |
| 71 chrome::StartKeepAlive(); | 75 chrome::StartKeepAlive(); |
| 72 } | 76 } |
| 73 | 77 |
| 74 void ProfileLoader::DecrementPendingProfileLoads() { | 78 void ProfileLoader::DecrementPendingProfileLoads() { |
| 75 pending_profile_loads_--; | 79 pending_profile_loads_--; |
| 76 if (pending_profile_loads_ == 0) | 80 if (pending_profile_loads_ == 0) |
| 77 chrome::EndKeepAlive(); | 81 chrome::EndKeepAlive(); |
| 78 } | 82 } |
| OLD | NEW |