| Index: chrome/app/chrome_exe_main_win.cc
|
| ===================================================================
|
| --- chrome/app/chrome_exe_main_win.cc (revision 157020)
|
| +++ chrome/app/chrome_exe_main_win.cc (working copy)
|
| @@ -21,8 +21,10 @@
|
| public:
|
| static void NTAPI UpdateCount(PVOID module, DWORD reason, PVOID reserved) {
|
| if (reason == DLL_THREAD_ATTACH) {
|
| + // We hit the threshold, but the loader would eat an exception fired now.
|
| + // So schedule an APC to fire the exception once loading is done.
|
| if (::InterlockedIncrement(&count_) > cap_)
|
| - __debugbreak();
|
| + ::QueueUserAPC(CrashProcessCallback, ::GetCurrentThread(), NULL);
|
| } else if (reason == DLL_THREAD_DETACH) {
|
| ::InterlockedDecrement(&count_);
|
| }
|
| @@ -31,8 +33,10 @@
|
| static void SetCap(LONG cap) { cap_ = cap; }
|
|
|
| private:
|
| - static LONG volatile count_;
|
| - static LONG volatile cap_;
|
| + static void CALLBACK CrashProcessCallback(ULONG_PTR) { __debugbreak(); }
|
| +
|
| + static volatile LONG count_;
|
| + static volatile LONG cap_;
|
| };
|
|
|
| LONG volatile ThreadTracker::count_ = 1;
|
|
|