OLD | NEW |
1 // Copyright (c) 2009 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 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 6 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
7 #include "base/thread.h" | 7 #include "base/thread.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace { | 10 namespace { |
11 | 11 |
(...skipping 17 matching lines...) Expand all Loading... |
29 | 29 |
30 void ReadUninitializedValue(char *ptr) { | 30 void ReadUninitializedValue(char *ptr) { |
31 if (*ptr == '\0') { | 31 if (*ptr == '\0') { |
32 (*ptr)++; | 32 (*ptr)++; |
33 } else { | 33 } else { |
34 (*ptr)--; | 34 (*ptr)--; |
35 } | 35 } |
36 } | 36 } |
37 | 37 |
38 void ReadValueOutOfArrayBoundsLeft(char *ptr) { | 38 void ReadValueOutOfArrayBoundsLeft(char *ptr) { |
39 LOG(INFO) << "Reading a byte out of bounds: " << ptr[-2]; | 39 VLOG(1) << "Reading a byte out of bounds: " << ptr[-2]; |
40 } | 40 } |
41 | 41 |
42 void ReadValueOutOfArrayBoundsRight(char *ptr, size_t size) { | 42 void ReadValueOutOfArrayBoundsRight(char *ptr, size_t size) { |
43 LOG(INFO) << "Reading a byte out of bounds: " << ptr[size + 1]; | 43 VLOG(1) << "Reading a byte out of bounds: " << ptr[size + 1]; |
44 } | 44 } |
45 | 45 |
46 // This is harmless if you run it under Valgrind thanks to redzones. | 46 // This is harmless if you run it under Valgrind thanks to redzones. |
47 void WriteValueOutOfArrayBoundsLeft(char *ptr) { | 47 void WriteValueOutOfArrayBoundsLeft(char *ptr) { |
48 ptr[-1] = 42; | 48 ptr[-1] = 42; |
49 } | 49 } |
50 | 50 |
51 // This is harmless if you run it under Valgrind thanks to redzones. | 51 // This is harmless if you run it under Valgrind thanks to redzones. |
52 void WriteValueOutOfArrayBoundsRight(char *ptr, size_t size) { | 52 void WriteValueOutOfArrayBoundsRight(char *ptr, size_t size) { |
53 ptr[size] = 42; | 53 ptr[size] = 42; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 new TOOLS_SANITY_TEST_CONCURRENT_THREAD(&shared); | 127 new TOOLS_SANITY_TEST_CONCURRENT_THREAD(&shared); |
128 | 128 |
129 PlatformThread::Create(0, thread1, &a); | 129 PlatformThread::Create(0, thread1, &a); |
130 PlatformThread::Create(0, thread2, &b); | 130 PlatformThread::Create(0, thread2, &b); |
131 PlatformThread::Join(a); | 131 PlatformThread::Join(a); |
132 PlatformThread::Join(b); | 132 PlatformThread::Join(b); |
133 EXPECT_TRUE(shared); | 133 EXPECT_TRUE(shared); |
134 delete thread1; | 134 delete thread1; |
135 delete thread2; | 135 delete thread2; |
136 } | 136 } |
OLD | NEW |