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

Side by Side Diff: Source/bindings/v8/ScriptPreprocessor.cpp

Issue 209713003: Make DOMWrapperWorld::current() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
« no previous file with comments | « Source/bindings/v8/ScriptController.cpp ('k') | Source/bindings/v8/SerializedScriptValue.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return; 60 return;
61 } 61 }
62 62
63 ScriptValue preprocessorFunction = scriptResults[0]; 63 ScriptValue preprocessorFunction = scriptResults[0];
64 if (!preprocessorFunction.isFunction()) { 64 if (!preprocessorFunction.isFunction()) {
65 frame->host()->console().addMessage(JSMessageSource, ErrorMessageLevel, "The preprocessor must compile to a function."); 65 frame->host()->console().addMessage(JSMessageSource, ErrorMessageLevel, "The preprocessor must compile to a function.");
66 return; 66 return;
67 } 67 }
68 68
69 m_world = DOMWrapperWorld::ensureIsolatedWorld(ScriptPreprocessorIsolatedWor ldId, DOMWrapperWorld::mainWorldExtensionGroup); 69 m_world = DOMWrapperWorld::ensureIsolatedWorld(ScriptPreprocessorIsolatedWor ldId, DOMWrapperWorld::mainWorldExtensionGroup);
70 v8::Local<v8::Context> context = toV8Context(m_isolate, frame, m_world.get() ); 70 v8::Local<v8::Context> context = toV8Context(m_isolate, frame, *m_world);
71 71
72 m_context.set(m_isolate, context); 72 m_context.set(m_isolate, context);
73 m_preprocessorFunction.set(m_isolate, v8::Handle<v8::Function>::Cast(preproc essorFunction.v8Value())); 73 m_preprocessorFunction.set(m_isolate, v8::Handle<v8::Function>::Cast(preproc essorFunction.v8Value()));
74 } 74 }
75 75
76 String ScriptPreprocessor::preprocessSourceCode(const String& sourceCode, const String& sourceName) 76 String ScriptPreprocessor::preprocessSourceCode(const String& sourceCode, const String& sourceName)
77 { 77 {
78 if (!isValid()) 78 if (!isValid())
79 return sourceCode; 79 return sourceCode;
80 80
(...skipping 26 matching lines...) Expand all
107 TemporaryChange<bool> isPreprocessing(m_isPreprocessing, true); 107 TemporaryChange<bool> isPreprocessing(m_isPreprocessing, true);
108 v8::Handle<v8::Value> resultValue = V8ScriptRunner::callAsFunction(m_preproc essorFunction.newLocal(m_isolate), m_context.newLocal(m_isolate)->Global(), WTF_ ARRAY_LENGTH(argv), argv); 108 v8::Handle<v8::Value> resultValue = V8ScriptRunner::callAsFunction(m_preproc essorFunction.newLocal(m_isolate), m_context.newLocal(m_isolate)->Global(), WTF_ ARRAY_LENGTH(argv), argv);
109 109
110 if (!resultValue.IsEmpty() && resultValue->IsString()) 110 if (!resultValue.IsEmpty() && resultValue->IsString())
111 return toCoreStringWithNullCheck(resultValue.As<v8::String>()); 111 return toCoreStringWithNullCheck(resultValue.As<v8::String>());
112 112
113 return sourceCode; 113 return sourceCode;
114 } 114 }
115 115
116 } // namespace WebCore 116 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptController.cpp ('k') | Source/bindings/v8/SerializedScriptValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698