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

Side by Side Diff: dm/DM.cpp

Issue 1006443002: Rejigger keep-alive thread so TSAN and LSAN don't complain. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 9 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 #include "CrashHandler.h" 1 #include "CrashHandler.h"
2 #include "DMJsonWriter.h" 2 #include "DMJsonWriter.h"
3 #include "DMSrcSink.h" 3 #include "DMSrcSink.h"
4 #include "DMSrcSinkAndroid.h" 4 #include "DMSrcSinkAndroid.h"
5 #include "OverwriteLine.h" 5 #include "OverwriteLine.h"
6 #include "ProcStats.h" 6 #include "ProcStats.h"
7 #include "SkBBHFactory.h" 7 #include "SkBBHFactory.h"
8 #include "SkChecksum.h" 8 #include "SkChecksum.h"
9 #include "SkCommonFlags.h" 9 #include "SkCommonFlags.h"
10 #include "SkForceLinking.h" 10 #include "SkForceLinking.h"
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // If we're isolating all GPU-bound work to one thread (the default), this funct ion runs all that. 511 // If we're isolating all GPU-bound work to one thread (the default), this funct ion runs all that.
512 static void run_enclave_and_gpu_tests(SkTArray<Task>* tasks) { 512 static void run_enclave_and_gpu_tests(SkTArray<Task>* tasks) {
513 run_enclave(tasks); 513 run_enclave(tasks);
514 for (int i = 0; i < gGPUTests.count(); i++) { 514 for (int i = 0; i < gGPUTests.count(); i++) {
515 run_test(&gGPUTests[i]); 515 run_test(&gGPUTests[i]);
516 } 516 }
517 } 517 }
518 518
519 // Some runs (mostly, Valgrind) are so slow that the bot framework thinks we've hung. 519 // Some runs (mostly, Valgrind) are so slow that the bot framework thinks we've hung.
520 // This prints something every once in a while so that it knows we're still work ing. 520 // This prints something every once in a while so that it knows we're still work ing.
521 static void keep_alive(void*) { 521 static void start_keepalive() {
522 for (;;) { 522 struct Loop {
523 static const int kSec = 300; 523 static void forever(void*) {
524 #if defined(SK_BUILD_FOR_WIN) 524 for (;;) {
525 Sleep(kSec * 1000); 525 static const int kSec = 300;
526 #else 526 #if defined(SK_BUILD_FOR_WIN)
527 sleep(kSec); 527 Sleep(kSec * 1000);
528 #endif 528 #else
529 SkDebugf("\nStill alive: doing science, reticulating splines...\n"); 529 sleep(kSec);
530 } 530 #endif
531 SkDebugf("\nStill alive: doing science, reticulating splines...\ n");
532 }
533 }
534 };
535 static SkThread* intentionallyLeaked = new SkThread(Loop::forever);
536 intentionallyLeaked->start();
531 } 537 }
532 538
533 int dm_main(); 539 int dm_main();
534 int dm_main() { 540 int dm_main() {
535 SetupCrashHandler(); 541 SetupCrashHandler();
536 SkAutoGraphics ag; 542 SkAutoGraphics ag;
537 SkTaskGroup::Enabler enabled(FLAGS_threads); 543 SkTaskGroup::Enabler enabled(FLAGS_threads);
538 if (FLAGS_leaks) { 544 if (FLAGS_leaks) {
539 SkInstCountPrintLeaksOnExit(); 545 SkInstCountPrintLeaksOnExit();
540 } 546 }
541 547
542 SkThread keepAlive(keep_alive); // This thread will just be killed by proce sses shutdown. 548 start_keepalive();
543 keepAlive.start();
544 549
545 gather_gold(); 550 gather_gold();
546 551
547 gather_srcs(); 552 gather_srcs();
548 gather_sinks(); 553 gather_sinks();
549 gather_tests(); 554 gather_tests();
550 555
551 gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTes ts.count(); 556 gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTes ts.count();
552 SkDebugf("%d srcs * %d sinks + %d tests == %d tasks\n", 557 SkDebugf("%d srcs * %d sinks + %d tests == %d tasks\n",
553 gSrcs.count(), gSinks.count(), gThreadedTests.count() + gGPUTests.c ount(), gPending); 558 gSrcs.count(), gSinks.count(), gThreadedTests.count() + gGPUTests.c ount(), gPending);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 601 }
597 return 0; 602 return 0;
598 } 603 }
599 604
600 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 605 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
601 int main(int argc, char** argv) { 606 int main(int argc, char** argv) {
602 SkCommandLineFlags::Parse(argc, argv); 607 SkCommandLineFlags::Parse(argc, argv);
603 return dm_main(); 608 return dm_main();
604 } 609 }
605 #endif 610 #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