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

Unified Diff: third_party/psyco_win32/psyco/classes.py

Issue 6778017: Add use of Psyco to GYP on Windows. On my z600 with 12 GB of RAM, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for non-Windows platforms. Created 9 years, 9 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
Index: third_party/psyco_win32/psyco/classes.py
diff --git a/third_party/psyco_win32/psyco/classes.py b/third_party/psyco_win32/psyco/classes.py
new file mode 100644
index 0000000000000000000000000000000000000000..ee173867d283f7140e6e7137d369ca00259f63e0
--- /dev/null
+++ b/third_party/psyco_win32/psyco/classes.py
@@ -0,0 +1,42 @@
+###########################################################################
+#
+# Psyco class support module.
+# Copyright (C) 2001-2002 Armin Rigo et.al.
+
+"""Psyco class support module.
+
+'psyco.classes.psyobj' is an alternate Psyco-optimized root for classes.
+Any class inheriting from it or using the metaclass '__metaclass__' might
+get optimized specifically for Psyco. It is equivalent to call
+psyco.bind() on the class object after its creation.
+
+Importing everything from psyco.classes in a module will import the
+'__metaclass__' name, so all classes defined after a
+
+ from psyco.classes import *
+
+will automatically use the Psyco-optimized metaclass.
+"""
+###########################################################################
+
+__all__ = ['psyobj', 'psymetaclass', '__metaclass__']
+
+
+from _psyco import compacttype
+import core
+from types import FunctionType
+
+class psymetaclass(compacttype):
+ "Psyco-optimized meta-class. Turns all methods into Psyco proxies."
+
+ def __new__(cls, name, bases, dict):
+ bindlist = dict.get('__psyco__bind__')
+ if bindlist is None:
+ bindlist = [key for key, value in dict.items()
+ if isinstance(value, FunctionType)]
+ for attr in bindlist:
+ dict[attr] = core.proxy(dict[attr])
+ return super(psymetaclass, cls).__new__(cls, name, bases, dict)
+
+psyobj = psymetaclass("psyobj", (), {})
+__metaclass__ = psymetaclass

Powered by Google App Engine
This is Rietveld 408576698