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

Side by Side Diff: base/message_loop.cc

Issue 4081003: Added task to Observer methods (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made default birthplace a local static Created 10 years, 1 month 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
« no previous file with comments | « base/message_loop.h ('k') | base/message_loop_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/message_loop.h" 5 #include "base/message_loop.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 405
406 //------------------------------------------------------------------------------ 406 //------------------------------------------------------------------------------
407 407
408 void MessageLoop::RunTask(Task* task) { 408 void MessageLoop::RunTask(Task* task) {
409 DCHECK(nestable_tasks_allowed_); 409 DCHECK(nestable_tasks_allowed_);
410 // Execute the task and assume the worst: It is probably not reentrant. 410 // Execute the task and assume the worst: It is probably not reentrant.
411 nestable_tasks_allowed_ = false; 411 nestable_tasks_allowed_ = false;
412 412
413 HistogramEvent(kTaskRunEvent); 413 HistogramEvent(kTaskRunEvent);
414 FOR_EACH_OBSERVER(TaskObserver, task_observers_, 414 FOR_EACH_OBSERVER(TaskObserver, task_observers_,
415 WillProcessTask(task->tracked_birth_time())); 415 WillProcessTask(task));
416 task->Run(); 416 task->Run();
417 FOR_EACH_OBSERVER(TaskObserver, task_observers_, DidProcessTask()); 417 FOR_EACH_OBSERVER(TaskObserver, task_observers_, DidProcessTask(task));
418 delete task; 418 delete task;
419 419
420 nestable_tasks_allowed_ = true; 420 nestable_tasks_allowed_ = true;
421 } 421 }
422 422
423 bool MessageLoop::DeferOrRunPendingTask(const PendingTask& pending_task) { 423 bool MessageLoop::DeferOrRunPendingTask(const PendingTask& pending_task) {
424 if (pending_task.nestable || state_->run_depth == 1) { 424 if (pending_task.nestable || state_->run_depth == 1) {
425 RunTask(pending_task.task); 425 RunTask(pending_task.task);
426 // Show that we ran a task (Note: a new one might arrive as a 426 // Show that we ran a task (Note: a new one might arrive as a
427 // consequence!). 427 // consequence!).
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 Watcher *delegate) { 686 Watcher *delegate) {
687 return pump_libevent()->WatchFileDescriptor( 687 return pump_libevent()->WatchFileDescriptor(
688 fd, 688 fd,
689 persistent, 689 persistent,
690 static_cast<base::MessagePumpLibevent::Mode>(mode), 690 static_cast<base::MessagePumpLibevent::Mode>(mode),
691 controller, 691 controller,
692 delegate); 692 delegate);
693 } 693 }
694 694
695 #endif 695 #endif
OLDNEW
« no previous file with comments | « base/message_loop.h ('k') | base/message_loop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698