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

Side by Side Diff: base/win/scoped_handle_test_dll.cc

Issue 1977833003: Add a buildflag to use the handle verifier in a per module mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the GN config. Created 4 years, 6 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 | « base/win/scoped_handle.cc ('k') | build/common.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <windows.h> 5 #include <windows.h>
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/win/base_features.h"
9 #include "base/win/current_module.h" 10 #include "base/win/current_module.h"
10 #include "base/win/scoped_handle.h" 11 #include "base/win/scoped_handle.h"
11 12
12 namespace base { 13 namespace base {
13 namespace win { 14 namespace win {
14 namespace testing { 15 namespace testing {
15 16
16 extern "C" bool __declspec(dllexport) RunTest(); 17 extern "C" bool __declspec(dllexport) RunTest();
17 18
18 namespace { 19 namespace {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 if (!verifier_module) 93 if (!verifier_module)
93 return false; 94 return false;
94 95
95 // Get my module 96 // Get my module
96 HMODULE my_module = CURRENT_MODULE(); 97 HMODULE my_module = CURRENT_MODULE();
97 if (!my_module) 98 if (!my_module)
98 return false; 99 return false;
99 100
100 HMODULE main_module = ::GetModuleHandle(NULL); 101 HMODULE main_module = ::GetModuleHandle(NULL);
101 102
102 #if defined(COMPONENT_BUILD) 103 #if BUILDFLAG(SINGLE_MODULE_MODE_HANDLE_VERIFIER)
103 // In a component build ActiveVerifier will always be created inside base.dll 104 // In a component build ActiveVerifier will always be created inside base.dll
104 // as the code always lives there. 105 // as the code always lives there.
105 if (verifier_module == my_module || verifier_module == main_module) 106 if (verifier_module == my_module || verifier_module == main_module)
106 return false; 107 return false;
107 #else 108 #else
108 // In a non-component build, ActiveVerifier should always be created in the 109 // In a non-component build, ActiveVerifier should always be created in the
109 // version of base linked with the main executable. 110 // version of base linked with the main executable.
110 if (verifier_module == my_module || verifier_module != main_module) 111 if (verifier_module == my_module || verifier_module != main_module)
111 return false; 112 return false;
112 #endif 113 #endif
113 return true; 114 return true;
114 } 115 }
115 116
116 } // namespace 117 } // namespace
117 118
118 bool RunTest() { 119 bool RunTest() {
119 return InternalRunThreadTest() && InternalRunLocationTest(); 120 return InternalRunThreadTest() && InternalRunLocationTest();
120 } 121 }
121 122
122 } // testing 123 } // testing
123 } // win 124 } // win
124 } // base 125 } // base
OLDNEW
« no previous file with comments | « base/win/scoped_handle.cc ('k') | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698