OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <math.h> // ceil | 5 #include <math.h> // ceil |
6 | 6 |
7 #include "base/string_tokenizer.h" | 7 #include "base/string_tokenizer.h" |
8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/metrics/metrics_service.h" | 10 #include "chrome/browser/metrics/metrics_service.h" |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 } | 642 } |
643 delete task; | 643 delete task; |
644 | 644 |
645 return false; | 645 return false; |
646 } | 646 } |
647 | 647 |
648 void WatchDogThread::Init() { | 648 void WatchDogThread::Init() { |
649 // This thread shouldn't be allowed to perform any blocking disk I/O. | 649 // This thread shouldn't be allowed to perform any blocking disk I/O. |
650 base::ThreadRestrictions::SetIOAllowed(false); | 650 base::ThreadRestrictions::SetIOAllowed(false); |
651 | 651 |
652 #if defined(OS_WIN) | |
653 // Initializes the COM library on the current thread. | |
654 HRESULT result = CoInitialize(NULL); | |
655 CHECK(result == S_OK); | |
656 #endif | |
657 | |
658 base::AutoLock lock(lock_); | 652 base::AutoLock lock(lock_); |
659 CHECK(!watchdog_thread_); | 653 CHECK(!watchdog_thread_); |
660 watchdog_thread_ = this; | 654 watchdog_thread_ = this; |
661 } | 655 } |
662 | 656 |
663 void WatchDogThread::CleanUp() { | 657 void WatchDogThread::CleanUp() { |
664 base::AutoLock lock(lock_); | 658 base::AutoLock lock(lock_); |
665 watchdog_thread_ = NULL; | 659 watchdog_thread_ = NULL; |
666 } | 660 } |
667 | |
668 void WatchDogThread::CleanUpAfterMessageLoopDestruction() { | |
669 #if defined(OS_WIN) | |
670 // Closes the COM library on the current thread. CoInitialize must be balanced | |
671 // by a corresponding call to CoUninitialize. | |
672 CoUninitialize(); | |
673 #endif | |
674 } | |
OLD | NEW |