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

Side by Side Diff: Source/web/tests/SpinLockTest.cpp

Issue 545123002: Cleanup namespace usage in Source/web/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 | « Source/web/tests/PinchViewportTest.cpp ('k') | Source/web/tests/TextFinderTest.cpp » ('j') | 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 (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "wtf/SpinLock.h" 32 #include "wtf/SpinLock.h"
33 33
34 #include "platform/Task.h" 34 #include "platform/Task.h"
35 #include "public/platform/Platform.h" 35 #include "public/platform/Platform.h"
36 #include "public/platform/WebThread.h" 36 #include "public/platform/WebThread.h"
37 #include "wtf/OwnPtr.h" 37 #include "wtf/OwnPtr.h"
38 #include "wtf/PassOwnPtr.h" 38 #include "wtf/PassOwnPtr.h"
39
40 #include <gtest/gtest.h> 39 #include <gtest/gtest.h>
41 40
42 using blink::Task; 41 namespace {
43 42
44 namespace { 43 using namespace blink;
45 44
46 static const size_t bufferSize = 16; 45 static const size_t bufferSize = 16;
47 46
48 static int lock = 0; 47 static int lock = 0;
49 48
50 static void fillBuffer(volatile char* buffer, char fillPattern) 49 static void fillBuffer(volatile char* buffer, char fillPattern)
51 { 50 {
52 for (size_t i = 0; i < bufferSize; ++i) 51 for (size_t i = 0; i < bufferSize; ++i)
53 buffer[i] = fillPattern; 52 buffer[i] = fillPattern;
54 } 53 }
(...skipping 18 matching lines...) Expand all
73 spinLockLock(&lock); 72 spinLockLock(&lock);
74 changeAndCheckBuffer(buffer); 73 changeAndCheckBuffer(buffer);
75 spinLockUnlock(&lock); 74 spinLockUnlock(&lock);
76 } 75 }
77 } 76 }
78 77
79 TEST(WTF_SpinLock, Torture) 78 TEST(WTF_SpinLock, Torture)
80 { 79 {
81 char sharedBuffer[bufferSize]; 80 char sharedBuffer[bufferSize];
82 81
83 OwnPtr<blink::WebThread> thread1 = adoptPtr(blink::Platform::current()->crea teThread("thread1")); 82 OwnPtr<WebThread> thread1 = adoptPtr(Platform::current()->createThread("thre ad1"));
84 OwnPtr<blink::WebThread> thread2 = adoptPtr(blink::Platform::current()->crea teThread("thread2")); 83 OwnPtr<WebThread> thread2 = adoptPtr(Platform::current()->createThread("thre ad2"));
85 84
86 thread1->postTask(new Task(WTF::bind(&threadMain, static_cast<char*>(sharedB uffer)))); 85 thread1->postTask(new Task(WTF::bind(&threadMain, static_cast<char*>(sharedB uffer))));
87 thread2->postTask(new Task(WTF::bind(&threadMain, static_cast<char*>(sharedB uffer)))); 86 thread2->postTask(new Task(WTF::bind(&threadMain, static_cast<char*>(sharedB uffer))));
88 87
89 thread1.clear(); 88 thread1.clear();
90 thread2.clear(); 89 thread2.clear();
91 } 90 }
92 91
93 } // namespace 92 } // namespace
OLDNEW
« no previous file with comments | « Source/web/tests/PinchViewportTest.cpp ('k') | Source/web/tests/TextFinderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698