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

Unified Diff: webkit/plugins/npapi/webplugin_delegate_impl_win.cc

Issue 9442002: Add a hard limit for Flash JIT pages (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698