OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 // Runs the loop in two different SEH modes: | 164 // Runs the loop in two different SEH modes: |
165 // enable_SEH_restoration_ = false : any unhandled exception goes to the last | 165 // enable_SEH_restoration_ = false : any unhandled exception goes to the last |
166 // one that calls SetUnhandledExceptionFilter(). | 166 // one that calls SetUnhandledExceptionFilter(). |
167 // enable_SEH_restoration_ = true : any unhandled exception goes to the filter | 167 // enable_SEH_restoration_ = true : any unhandled exception goes to the filter |
168 // that was existed before the loop was run. | 168 // that was existed before the loop was run. |
169 void MessageLoop::RunHandler() { | 169 void MessageLoop::RunHandler() { |
170 #if defined(OS_WIN) | 170 #if defined(OS_WIN) |
171 if (exception_restoration_) { | 171 if (exception_restoration_) { |
172 LPTOP_LEVEL_EXCEPTION_FILTER current_filter = GetTopSEHFilter(); | 172 RunInternalInSEHFrame(); |
173 __try { | |
174 RunInternal(); | |
175 } __except(SEHFilter(current_filter)) { | |
176 } | |
177 return; | 173 return; |
178 } | 174 } |
179 #endif | 175 #endif |
180 | 176 |
181 RunInternal(); | 177 RunInternal(); |
182 } | 178 } |
183 | 179 //------------------------------------------------------------------------------ |
| 180 #if defined(OS_WIN) |
| 181 __declspec(noinline) void MessageLoop::RunInternalInSEHFrame() { |
| 182 LPTOP_LEVEL_EXCEPTION_FILTER current_filter = GetTopSEHFilter(); |
| 183 __try { |
| 184 RunInternal(); |
| 185 } __except(SEHFilter(current_filter)) { |
| 186 } |
| 187 return; |
| 188 } |
| 189 #endif |
184 //------------------------------------------------------------------------------ | 190 //------------------------------------------------------------------------------ |
185 | 191 |
186 void MessageLoop::RunInternal() { | 192 void MessageLoop::RunInternal() { |
187 DCHECK(this == current()); | 193 DCHECK(this == current()); |
188 | 194 |
189 StartHistogrammer(); | 195 StartHistogrammer(); |
190 | 196 |
191 #if defined(OS_WIN) || defined(OS_LINUX) | 197 #if defined(OS_WIN) || defined(OS_LINUX) |
192 if (state_->dispatcher && type() == TYPE_UI) { | 198 if (state_->dispatcher && type() == TYPE_UI) { |
193 static_cast<base::MessagePumpForUI*>(pump_.get())-> | 199 static_cast<base::MessagePumpForUI*>(pump_.get())-> |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 Watcher *delegate) { | 628 Watcher *delegate) { |
623 return pump_libevent()->WatchFileDescriptor( | 629 return pump_libevent()->WatchFileDescriptor( |
624 fd, | 630 fd, |
625 persistent, | 631 persistent, |
626 static_cast<base::MessagePumpLibevent::Mode>(mode), | 632 static_cast<base::MessagePumpLibevent::Mode>(mode), |
627 controller, | 633 controller, |
628 delegate); | 634 delegate); |
629 } | 635 } |
630 | 636 |
631 #endif | 637 #endif |
OLD | NEW |