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

Side by Side Diff: patches/nspr-static.patch

Issue 2078763002: Delete bundled copy of NSS and replace with README. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss@master
Patch Set: Delete bundled copy of NSS and replace with README. 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 | « patches/nspr-remove-io.patch ('k') | patches/nss-remove-fortezza.patch » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 diff --git a/nspr/pr/include/prtypes.h b/nspr/pr/include/prtypes.h
2 index 52b3ab0..d78f580 100644
3 --- a/nspr/pr/include/prtypes.h
4 +++ b/nspr/pr/include/prtypes.h
5 @@ -48,7 +48,23 @@
6 **
7 **
8 ***********************************************************************/
9 -#if defined(WIN32)
10 +#if defined(NSPR_STATIC)
11 +
12 +#define PR_EXPORT(__type) extern __type
13 +#define PR_EXPORT_DATA(__type) extern __type
14 +#define PR_IMPORT(__type) extern __type
15 +#define PR_IMPORT_DATA(__type) extern __type
16 +
17 +#define PR_EXTERN(__type) extern __type
18 +#define PR_IMPLEMENT(__type) __type
19 +#define PR_EXTERN_DATA(__type) extern __type
20 +#define PR_IMPLEMENT_DATA(__type) __type
21 +
22 +#define PR_CALLBACK
23 +#define PR_CALLBACK_DECL
24 +#define PR_STATIC_CALLBACK(__x) static __x
25 +
26 +#elif defined(WIN32)
27
28 #define PR_EXPORT(__type) extern __declspec(dllexport) __type
29 #define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
30 diff --git a/nspr/pr/src/md/windows/w95dllmain.c b/nspr/pr/src/md/windows/w95dll main.c
31 index 73707a6..90957c1 100644
32 --- a/nspr/pr/src/md/windows/w95dllmain.c
33 +++ b/nspr/pr/src/md/windows/w95dllmain.c
34 @@ -3,6 +3,8 @@
35 * License, v. 2.0. If a copy of the MPL was not distributed with this
36 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
37
38 +#ifndef NSPR_STATIC /* See the end of w95thred.c. */
39 +
40 /*
41 * The DLL entry point (DllMain) for NSPR.
42 *
43 @@ -37,3 +39,5 @@ PRThread *me;
44 }
45 return TRUE;
46 }
47 +
48 +#endif
49 diff --git a/nspr/pr/src/md/windows/w95thred.c b/nspr/pr/src/md/windows/w95thred .c
50 index c27d982..52bfb02 100644
51 --- a/nspr/pr/src/md/windows/w95thred.c
52 +++ b/nspr/pr/src/md/windows/w95thred.c
53 @@ -323,3 +323,120 @@ PRThread *thread;
54 PR_ASSERT(thread != NULL);
55 return thread;
56 }
57 +
58 +#ifdef NSPR_STATIC
59 +
60 +// The following code is from Chromium src/base/thread_local_storage_win.cc,
61 +// r11329.
62 +
63 +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
64 +//
65 +// Redistribution and use in source and binary forms, with or without
66 +// modification, are permitted provided that the following conditions are
67 +// met:
68 +//
69 +// * Redistributions of source code must retain the above copyright
70 +// notice, this list of conditions and the following disclaimer.
71 +// * Redistributions in binary form must reproduce the above
72 +// copyright notice, this list of conditions and the following disclaimer
73 +// in the documentation and/or other materials provided with the
74 +// distribution.
75 +// * Neither the name of Google Inc. nor the names of its
76 +// contributors may be used to endorse or promote products derived from
77 +// this software without specific prior written permission.
78 +//
79 +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
80 +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
81 +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
82 +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
83 +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
84 +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
85 +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
86 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
87 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
88 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
89 +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
90 +
91 +// Thread Termination Callbacks.
92 +// Windows doesn't support a per-thread destructor with its
93 +// TLS primitives. So, we build it manually by inserting a
94 +// function to be called on each thread's exit.
95 +// This magic is from http://www.codeproject.com/threads/tls.asp
96 +// and it works for VC++ 7.0 and later.
97 +
98 +// Force a reference to _tls_used to make the linker create the TLS directory
99 +// if it's not already there. (e.g. if __declspec(thread) is not used).
100 +// Force a reference to p_thread_callback_nspr to prevent whole program
101 +// optimization from discarding the variable.
102 +#ifdef _WIN64
103 +
104 +#pragma comment(linker, "/INCLUDE:_tls_used")
105 +#pragma comment(linker, "/INCLUDE:p_thread_callback_nspr")
106 +
107 +#else // _WIN64
108 +
109 +#pragma comment(linker, "/INCLUDE:__tls_used")
110 +#pragma comment(linker, "/INCLUDE:_p_thread_callback_nspr")
111 +
112 +#endif // _WIN64
113 +
114 +// Static callback function to call with each thread termination.
115 +static void NTAPI PR_OnThreadExit(PVOID module, DWORD reason, PVOID reserved)
116 +{
117 +PRThread *me;
118 +
119 + switch (reason) {
120 + case DLL_PROCESS_ATTACH:
121 + break;
122 + case DLL_THREAD_ATTACH:
123 + break;
124 + case DLL_THREAD_DETACH:
125 + if (_pr_initialized) {
126 + me = _MD_GET_ATTACHED_THREAD();
127 + if ((me != NULL) && (me->flags & _PR_ATTACHED))
128 + _PRI_DetachThread();
129 + }
130 + break;
131 + case DLL_PROCESS_DETACH:
132 + break;
133 + }
134 +}
135 +
136 +// .CRT$XLA to .CRT$XLZ is an array of PIMAGE_TLS_CALLBACK pointers that are
137 +// called automatically by the OS loader code (not the CRT) when the module is
138 +// loaded and on thread creation. They are NOT called if the module has been
139 +// loaded by a LoadLibrary() call. It must have implicitly been loaded at
140 +// process startup.
141 +// By implicitly loaded, I mean that it is directly referenced by the main EXE
142 +// or by one of its dependent DLLs. Delay-loaded DLL doesn't count as being
143 +// implicitly loaded.
144 +//
145 +// See VC\crt\src\tlssup.c for reference.
146 +
147 +// The linker must not discard p_thread_callback_nspr. (We force a reference
148 +// to this variable with a linker /INCLUDE:symbol pragma to ensure that.) If
149 +// this variable is discarded, the PR_OnThreadExit function will never be
150 +// called.
151 +#ifdef _WIN64
152 +
153 +// .CRT section is merged with .rdata on x64 so it must be constant data.
154 +#pragma const_seg(".CRT$XLB")
155 +// When defining a const variable, it must have external linkage to be sure the
156 +// linker doesn't discard it.
157 +extern const PIMAGE_TLS_CALLBACK p_thread_callback_nspr;
158 +const PIMAGE_TLS_CALLBACK p_thread_callback_nspr = PR_OnThreadExit;
159 +
160 +// Reset the default section.
161 +#pragma const_seg()
162 +
163 +#else // _WIN64
164 +
165 +#pragma data_seg(".CRT$XLB")
166 +PIMAGE_TLS_CALLBACK p_thread_callback_nspr = PR_OnThreadExit;
167 +
168 +// Reset the default section.
169 +#pragma data_seg()
170 +
171 +#endif // _WIN64
172 +
173 +#endif // NSPR_STATIC
OLDNEW
« no previous file with comments | « patches/nspr-remove-io.patch ('k') | patches/nss-remove-fortezza.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698