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

Side by Side Diff: chrome/browser/metrics/thread_watcher.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 565
566 // static 566 // static
567 void ThreadWatcherObserver::RemoveNotifications() { 567 void ThreadWatcherObserver::RemoveNotifications() {
568 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 568 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
569 if (!g_thread_watcher_observer_) 569 if (!g_thread_watcher_observer_)
570 return; 570 return;
571 g_thread_watcher_observer_->registrar_.RemoveAll(); 571 g_thread_watcher_observer_->registrar_.RemoveAll();
572 delete g_thread_watcher_observer_; 572 delete g_thread_watcher_observer_;
573 } 573 }
574 574
575 void ThreadWatcherObserver::Observe(NotificationType type, 575 void ThreadWatcherObserver::Observe(int type,
576 const NotificationSource& source, 576 const NotificationSource& source,
577 const NotificationDetails& details) { 577 const NotificationDetails& details) {
578 // There is some user activity, see if thread watchers are to be awakened. 578 // There is some user activity, see if thread watchers are to be awakened.
579 base::TimeTicks now = base::TimeTicks::Now(); 579 base::TimeTicks now = base::TimeTicks::Now();
580 if ((now - last_wakeup_time_) < wakeup_interval_) 580 if ((now - last_wakeup_time_) < wakeup_interval_)
581 return; 581 return;
582 last_wakeup_time_ = now; 582 last_wakeup_time_ = now;
583 WatchDogThread::PostTask( 583 WatchDogThread::PostTask(
584 FROM_HERE, 584 FROM_HERE,
585 NewRunnableFunction(&ThreadWatcherList::WakeUpAll)); 585 NewRunnableFunction(&ThreadWatcherList::WakeUpAll));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 651
652 base::AutoLock lock(lock_); 652 base::AutoLock lock(lock_);
653 CHECK(!watchdog_thread_); 653 CHECK(!watchdog_thread_);
654 watchdog_thread_ = this; 654 watchdog_thread_ = this;
655 } 655 }
656 656
657 void WatchDogThread::CleanUp() { 657 void WatchDogThread::CleanUp() {
658 base::AutoLock lock(lock_); 658 base::AutoLock lock(lock_);
659 watchdog_thread_ = NULL; 659 watchdog_thread_ = NULL;
660 } 660 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/thread_watcher.h ('k') | chrome/browser/net/chrome_url_request_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698