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

Unified Diff: Source/bindings/v8/ScriptPreprocessor.h

Issue 13575004: Apply script preprocessor to Web page scripts only. (Closed) Base URL: https://chromium.googlesource.com/external/WebKit_trimmed.git@master
Patch Set: move clearScriptPreprocessor() to ScriptController::clearWindowShell Created 7 years, 5 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: Source/bindings/v8/ScriptPreprocessor.h
diff --git a/Source/bindings/v8/ScriptInstance.h b/Source/bindings/v8/ScriptPreprocessor.h
similarity index 71%
copy from Source/bindings/v8/ScriptInstance.h
copy to Source/bindings/v8/ScriptPreprocessor.h
index 2fee44cae5cd5ae8e16dd144bedb40b829c6e55d..597af6b7704ed96e43fedf3df38043792b984eea 100644
--- a/Source/bindings/v8/ScriptInstance.h
+++ b/Source/bindings/v8/ScriptPreprocessor.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2008, 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -14,7 +15,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -28,32 +29,32 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ScriptInstance_h
-#define ScriptInstance_h
-
-#include "bindings/v8/ScopedPersistent.h"
-#include <v8.h>
-#include "wtf/PassRefPtr.h"
+#include "bindings/v8/V8Binding.h"
#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
+#include "wtf/text/WTFString.h"
+#include <v8.h>
namespace WebCore {
-class V8ScriptInstance : public RefCounted<V8ScriptInstance> {
+class ScriptController;
+class PageConsole;
+
+class ScriptPreprocessor {
+ WTF_MAKE_NONCOPYABLE(ScriptPreprocessor);
public:
- static PassRefPtr<V8ScriptInstance> create(v8::Handle<v8::Object> instance) { return adoptRef(new V8ScriptInstance(instance)); }
+ ScriptPreprocessor(const String& preprocessorScript, ScriptController*, PageConsole*);
+ String preprocessSourceCode(const String& sourceCode, const String& sourceName);
- v8::Local<v8::Object> newLocal(v8::Isolate* isolate) { return m_instance.newLocal(isolate); }
+ bool hasPreprocessorFunction();
+ bool isPreprocessing();
private:
- explicit V8ScriptInstance(v8::Handle<v8::Object>);
+ v8::Local<v8::Context> isolatedWorldContext();
- ScopedPersistent<v8::Object> m_instance;
+ String m_preprocessorBody;
+ ScopedPersistent<v8::Function> m_preprocessorFunction;
+ ScriptController* m_controller;
+ bool m_isPreprocessing;
};
-typedef RefPtr<V8ScriptInstance> ScriptInstance;
-typedef PassRefPtr<V8ScriptInstance> PassScriptInstance;
-
} // namespace WebCore
-
-#endif // ScriptInstance_h

Powered by Google App Engine
This is Rietveld 408576698