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

Side by Side Diff: tests/PathOpsExtendedTest.cpp

Issue 25366002: Writing to testName and reading its size isn't thread safe. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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
« 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 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "PathOpsExtendedTest.h" 8 #include "PathOpsExtendedTest.h"
9 #include "PathOpsThreadedCommon.h" 9 #include "PathOpsThreadedCommon.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 bool testThreadedPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkP ath& b, 625 bool testThreadedPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkP ath& b,
626 const SkPathOp shapeOp, const char* testName) { 626 const SkPathOp shapeOp, const char* testName) {
627 return innerPathOp(reporter, a, b, shapeOp, testName, true); 627 return innerPathOp(reporter, a, b, shapeOp, testName, true);
628 } 628 }
629 629
630 int initializeTests(skiatest::Reporter* reporter, const char* test) { 630 int initializeTests(skiatest::Reporter* reporter, const char* test) {
631 #ifdef SK_DEBUG 631 #ifdef SK_DEBUG
632 SkPathOpsDebug::gMaxWindSum = 4; 632 SkPathOpsDebug::gMaxWindSum = 4;
633 SkPathOpsDebug::gMaxWindValue = 4; 633 SkPathOpsDebug::gMaxWindValue = 4;
634 #endif 634 #endif
635 #if DEBUG_SHOW_TEST_NAME
635 testName = test; 636 testName = test;
636 size_t testNameSize = strlen(test); 637 size_t testNameSize = strlen(test);
637 SkFILEStream inFile("../../experimental/Intersection/op.htm"); 638 SkFILEStream inFile("../../experimental/Intersection/op.htm");
638 if (inFile.isValid()) { 639 if (inFile.isValid()) {
639 SkTDArray<char> inData; 640 SkTDArray<char> inData;
640 inData.setCount(inFile.getLength()); 641 inData.setCount(inFile.getLength());
641 size_t inLen = inData.count(); 642 size_t inLen = inData.count();
642 inFile.read(inData.begin(), inLen); 643 inFile.read(inData.begin(), inLen);
643 inFile.setPath(NULL); 644 inFile.setPath(NULL);
644 char* insert = strstr(inData.begin(), marker); 645 char* insert = strstr(inData.begin(), marker);
645 if (insert) { 646 if (insert) {
646 insert += sizeof(marker) - 1; 647 insert += sizeof(marker) - 1;
647 const char* numLoc = insert + 4 /* indent spaces */ + testNameSize - 1; 648 const char* numLoc = insert + 4 /* indent spaces */ + testNameSize - 1;
648 testNumber = atoi(numLoc) + 1; 649 testNumber = atoi(numLoc) + 1;
649 } 650 }
650 } 651 }
652 #endif
651 return reporter->allowThreaded() ? SkThreadPool::kThreadPerCore : 1; 653 return reporter->allowThreaded() ? SkThreadPool::kThreadPerCore : 1;
652 } 654 }
653 655
654 void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType pathFill Type) { 656 void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType pathFill Type) {
655 const char testFunction[] = "testSimplify(path);"; 657 const char testFunction[] = "testSimplify(path);";
656 const char* pathPrefix = NULL; 658 const char* pathPrefix = NULL;
657 const char* nameSuffix = NULL; 659 const char* nameSuffix = NULL;
658 if (pathFillType == SkPath::kEvenOdd_FillType) { 660 if (pathFillType == SkPath::kEvenOdd_FillType) {
659 pathPrefix = " path.setFillType(SkPath::kEvenOdd_FillType);\n"; 661 pathPrefix = " path.setFillType(SkPath::kEvenOdd_FillType);\n";
660 nameSuffix = "x"; 662 nameSuffix = "x";
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 } 700 }
699 if (tests[index].fun == stopTest) { 701 if (tests[index].fun == stopTest) {
700 SkDebugf("lastTest\n"); 702 SkDebugf("lastTest\n");
701 } 703 }
702 if (index == last) { 704 if (index == last) {
703 break; 705 break;
704 } 706 }
705 index += reverse ? -1 : 1; 707 index += reverse ? -1 : 1;
706 } while (true); 708 } while (true);
707 } 709 }
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