| OLD | NEW |
| 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 "chrome/browser/profiles/profile_destroyer.h" | 5 #include "chrome/browser/profiles/profile_destroyer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "build/build_config.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "content/public/browser/render_process_host.h" | 15 #include "content/public/browser/render_process_host.h" |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 #if defined(OS_ANDROID) | 19 #if defined(OS_ANDROID) |
| 19 // Set the render host waiting time to 5s on Android, that's the same | 20 // Set the render host waiting time to 5s on Android, that's the same |
| 20 // as an "Application Not Responding" timeout. | 21 // as an "Application Not Responding" timeout. |
| 21 const int64 kTimerDelaySeconds = 5; | 22 const int64_t kTimerDelaySeconds = 5; |
| 22 #else | 23 #else |
| 23 const int64 kTimerDelaySeconds = 1; | 24 const int64_t kTimerDelaySeconds = 1; |
| 24 #endif | 25 #endif |
| 25 | 26 |
| 26 } // namespace | 27 } // namespace |
| 27 | 28 |
| 28 ProfileDestroyer::DestroyerSet* ProfileDestroyer::pending_destroyers_ = NULL; | 29 ProfileDestroyer::DestroyerSet* ProfileDestroyer::pending_destroyers_ = NULL; |
| 29 | 30 |
| 30 // static | 31 // static |
| 31 void ProfileDestroyer::DestroyProfileWhenAppropriate(Profile* const profile) { | 32 void ProfileDestroyer::DestroyProfileWhenAppropriate(Profile* const profile) { |
| 32 TRACE_EVENT0("shutdown", "ProfileDestroyer::DestroyProfileWhenAppropriate"); | 33 TRACE_EVENT0("shutdown", "ProfileDestroyer::DestroyProfileWhenAppropriate"); |
| 33 | 34 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 content::RenderProcessHost::AllHostsIterator()); | 176 content::RenderProcessHost::AllHostsIterator()); |
| 176 !iter.IsAtEnd(); iter.Advance()) { | 177 !iter.IsAtEnd(); iter.Advance()) { |
| 177 content::RenderProcessHost* render_process_host = iter.GetCurrentValue(); | 178 content::RenderProcessHost* render_process_host = iter.GetCurrentValue(); |
| 178 if (render_process_host && | 179 if (render_process_host && |
| 179 render_process_host->GetBrowserContext() == profile) { | 180 render_process_host->GetBrowserContext() == profile) { |
| 180 hosts->insert(render_process_host); | 181 hosts->insert(render_process_host); |
| 181 } | 182 } |
| 182 } | 183 } |
| 183 return !hosts->empty(); | 184 return !hosts->empty(); |
| 184 } | 185 } |
| OLD | NEW |