Chromium Code Reviews| Index: webkit/plugins/npapi/webplugin_delegate_impl_win.cc |
| =================================================================== |
| --- webkit/plugins/npapi/webplugin_delegate_impl_win.cc (revision 122838) |
| +++ webkit/plugins/npapi/webplugin_delegate_impl_win.cc (working copy) |
| @@ -148,7 +148,7 @@ |
| SIZE_T size, |
| DWORD free_type); |
| -const size_t kMaxPluginExecMemSize = 64 * 1024 * 1024; // 64mb. |
| +const size_t kMaxPluginExecMemSize = 16 * 1024 * 1024; // 16mb. |
| const DWORD kExecPageMask = PAGE_EXECUTE | PAGE_EXECUTE_READ | |
| PAGE_EXECUTE_READWRITE; |
| static volatile intptr_t g_max_exec_mem_size; |
| @@ -167,6 +167,13 @@ |
| return g_exec_mem_size; |
| } |
| +// Throw a unique exception when the JIT limit is hit. |
| +inline void RaiseJITException() { |
| + static const ULONG parameters[] = {1, 0xabad1dea /* 2880249322 */ }; |
| + ::RaiseException(EXCEPTION_ACCESS_VIOLATION, EXCEPTION_NONCONTINUABLE, |
| + 2, parameters); |
|
cpu_(ooo_6.6-7.5)
2012/02/23 01:06:10
instead of 2 use arraysize of whatever it is calle
|
| +} |
| + |
| // http://crbug.com/16114 |
| // Enforces providing a valid device context in NPWindow, so that NPP_SetWindow |
| // is never called with NPNWindoTypeDrawable and NPWindow set to NULL. |
| @@ -357,10 +364,8 @@ |
| if (size && p && (protect & kExecPageMask)) { |
| bool limit_exceeded = UpdateExecMemSize(static_cast<intptr_t>(size)) > |
| kMaxPluginExecMemSize; |
| -#ifndef NDEBUG // TODO(jschuh): Do this in release after we get numbers. |
| if (limit_exceeded) |
| - ::DebugBreak(); |
| -#endif |
| + RaiseJITException(); |
| } |
| return p; |
| } |
| @@ -375,10 +380,8 @@ |
| if (is_exec && !was_exec) { |
| bool limit_exceeded = UpdateExecMemSize(static_cast<intptr_t>(size)) > |
| kMaxPluginExecMemSize; |
| -#ifndef NDEBUG // TODO(jschuh): Do this in release after we get numbers. |
| if (limit_exceeded) |
| - ::DebugBreak(); |
| -#endif |
| + RaiseJITException(); |
| } else if (!is_exec && was_exec) { |
| UpdateExecMemSize(-(static_cast<intptr_t>(size))); |
| } |