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

Side by Side Diff: webkit/extensions/v8/playback_extension.cc

Issue 40132: Refactor v8 extensions to make registration avoid having to use ChromiumBridg... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "config.h" 5 #include "webkit/extensions/v8/playback_extension.h"
6 #include "Playback.h"
7 6
8 namespace WebCore { 7 namespace extensions_v8 {
9 8
10 const char* kPlaybackExtensionName = "v8/PlaybackMode"; 9 const char* kPlaybackExtensionName = "v8/PlaybackMode";
11 10
12 v8::Extension* PlaybackExtension::Get() { 11 v8::Extension* PlaybackExtension::Get() {
13 v8::Extension* extension = new v8::Extension( 12 v8::Extension* extension = new v8::Extension(
14 kPlaybackExtensionName, 13 kPlaybackExtensionName,
15 "(function () {" 14 "(function () {"
16 " var orig_date = Date;" 15 " var orig_date = Date;"
17 " Math.random = function() {" 16 " Math.random = function() {"
18 " return 0.5;" 17 " return 0.5;"
19 " };" 18 " };"
20 " Date.__proto__.now = function() {" 19 " Date.__proto__.now = function() {"
21 " return new orig_date(1204251968254);" 20 " return new orig_date(1204251968254);"
22 " };" 21 " };"
23 " Date = function() {" 22 " Date = function() {"
24 " return Date.now();" 23 " return Date.now();"
25 " };" 24 " };"
26 "})()"); 25 "})()");
27 return extension; 26 return extension;
28 } 27 }
29 28
30 } 29 } // namespace extensions_v8
31 30
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698