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

Side by Side Diff: base/message_loop.cc

Issue 160035: Reapply r21429 - Cleanup pending tasks under Valgrind as well. (Closed)
Patch Set: fix mac break Created 11 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
« no previous file with comments | « no previous file | no next file » | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 work_queue_.pop(); 365 work_queue_.pop();
366 if (!pending_task.delayed_run_time.is_null()) { 366 if (!pending_task.delayed_run_time.is_null()) {
367 // We want to delete delayed tasks in the same order in which they would 367 // We want to delete delayed tasks in the same order in which they would
368 // normally be deleted in case of any funny dependencies between delayed 368 // normally be deleted in case of any funny dependencies between delayed
369 // tasks. 369 // tasks.
370 AddToDelayedWorkQueue(pending_task); 370 AddToDelayedWorkQueue(pending_task);
371 } else { 371 } else {
372 // TODO(darin): Delete all tasks once it is safe to do so. 372 // TODO(darin): Delete all tasks once it is safe to do so.
373 // Until it is totally safe, just do it when running Purify or 373 // Until it is totally safe, just do it when running Purify or
374 // Valgrind. 374 // Valgrind.
375 #if defined(OS_WIN) 375 #if defined(PURIFY)
376 #ifdef PURIFY
377 delete pending_task.task; 376 delete pending_task.task;
378 #endif // PURIFY
379 #elif defined(OS_POSIX) 377 #elif defined(OS_POSIX)
380 if (RUNNING_ON_VALGRIND) 378 if (RUNNING_ON_VALGRIND)
381 delete pending_task.task; 379 delete pending_task.task;
382 #endif // defined(OS_POSIX) 380 #endif // defined(OS_POSIX)
383 } 381 }
384 } 382 }
385 did_work |= !deferred_non_nestable_work_queue_.empty(); 383 did_work |= !deferred_non_nestable_work_queue_.empty();
386 while (!deferred_non_nestable_work_queue_.empty()) { 384 while (!deferred_non_nestable_work_queue_.empty()) {
387 // TODO(darin): Delete all tasks once it is safe to do so. 385 // TODO(darin): Delete all tasks once it is safe to do so.
388 // Until it is totaly safe, just delete them to keep purify happy. 386 // Until it is totaly safe, only delete them under Purify and Valgrind.
389 #ifdef PURIFY 387 Task* task = NULL;
390 Task* task = deferred_non_nestable_work_queue_.front().task; 388 #if defined(PURIFY)
389 task = deferred_non_nestable_work_queue_.front().task;
390 #elif defined(OS_POSIX)
391 if (RUNNING_ON_VALGRIND)
392 task = deferred_non_nestable_work_queue_.front().task;
391 #endif 393 #endif
392 deferred_non_nestable_work_queue_.pop(); 394 deferred_non_nestable_work_queue_.pop();
393 #ifdef PURIFY 395 if (task)
394 delete task; 396 delete task;
395 #endif
396 } 397 }
397 did_work |= !delayed_work_queue_.empty(); 398 did_work |= !delayed_work_queue_.empty();
398 while (!delayed_work_queue_.empty()) { 399 while (!delayed_work_queue_.empty()) {
399 Task* task = delayed_work_queue_.top().task; 400 Task* task = delayed_work_queue_.top().task;
400 delayed_work_queue_.pop(); 401 delayed_work_queue_.pop();
401 delete task; 402 delete task;
402 } 403 }
403 return did_work; 404 return did_work;
404 } 405 }
405 406
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 Watcher *delegate) { 624 Watcher *delegate) {
624 return pump_libevent()->WatchFileDescriptor( 625 return pump_libevent()->WatchFileDescriptor(
625 fd, 626 fd,
626 persistent, 627 persistent,
627 static_cast<base::MessagePumpLibevent::Mode>(mode), 628 static_cast<base::MessagePumpLibevent::Mode>(mode),
628 controller, 629 controller,
629 delegate); 630 delegate);
630 } 631 }
631 632
632 #endif 633 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698