| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 m_context.set(m_isolate, context); | 68 m_context.set(m_isolate, context); |
| 69 m_preprocessorFunction.set(m_isolate, v8::Handle<v8::Function>::Cast(preproc
essorFunction.v8Value())); | 69 m_preprocessorFunction.set(m_isolate, v8::Handle<v8::Function>::Cast(preproc
essorFunction.v8Value())); |
| 70 } | 70 } |
| 71 | 71 |
| 72 String ScriptPreprocessor::preprocessSourceCode(const String& sourceCode, const
String& sourceName) | 72 String ScriptPreprocessor::preprocessSourceCode(const String& sourceCode, const
String& sourceName) |
| 73 { | 73 { |
| 74 if (!isValid()) | 74 if (!isValid()) |
| 75 return sourceCode; | 75 return sourceCode; |
| 76 | 76 |
| 77 return preprocessSourceCode(sourceCode, sourceName, v8::Undefined()); | 77 return preprocessSourceCode(sourceCode, sourceName, v8::Undefined(m_isolate)
); |
| 78 } | 78 } |
| 79 | 79 |
| 80 String ScriptPreprocessor::preprocessSourceCode(const String& sourceCode, const
String& sourceName, const String& functionName) | 80 String ScriptPreprocessor::preprocessSourceCode(const String& sourceCode, const
String& sourceName, const String& functionName) |
| 81 { | 81 { |
| 82 if (!isValid()) | 82 if (!isValid()) |
| 83 return sourceCode; | 83 return sourceCode; |
| 84 | 84 |
| 85 v8::Handle<v8::String> functionNameString = v8String(functionName, m_isolate
); | 85 v8::Handle<v8::String> functionNameString = v8String(functionName, m_isolate
); |
| 86 return preprocessSourceCode(sourceCode, sourceName, functionNameString); | 86 return preprocessSourceCode(sourceCode, sourceName, functionNameString); |
| 87 } | 87 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 103 TemporaryChange<bool> isPreprocessing(m_isPreprocessing, true); | 103 TemporaryChange<bool> isPreprocessing(m_isPreprocessing, true); |
| 104 v8::Handle<v8::Value> resultValue = V8ScriptRunner::callAsFunction(m_preproc
essorFunction.newLocal(m_isolate), m_context.newLocal(m_isolate)->Global(), WTF_
ARRAY_LENGTH(argv), argv); | 104 v8::Handle<v8::Value> resultValue = V8ScriptRunner::callAsFunction(m_preproc
essorFunction.newLocal(m_isolate), m_context.newLocal(m_isolate)->Global(), WTF_
ARRAY_LENGTH(argv), argv); |
| 105 | 105 |
| 106 if (!resultValue.IsEmpty() && resultValue->IsString()) | 106 if (!resultValue.IsEmpty() && resultValue->IsString()) |
| 107 return toWebCoreStringWithNullCheck(resultValue); | 107 return toWebCoreStringWithNullCheck(resultValue); |
| 108 | 108 |
| 109 return sourceCode; | 109 return sourceCode; |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace WebCore | 112 } // namespace WebCore |
| OLD | NEW |