OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 6316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6327 void WebGLRenderingContextBase::preserveObjectWrapper(ScriptState* scriptState,
ScriptWrappable* sourceObject, v8::Local<v8::String> hiddenValueName, ScopedPers
istent<v8::Array>* persistentCache, uint32_t index, ScriptWrappable* targetObjec
t) | 6327 void WebGLRenderingContextBase::preserveObjectWrapper(ScriptState* scriptState,
ScriptWrappable* sourceObject, v8::Local<v8::String> hiddenValueName, ScopedPers
istent<v8::Array>* persistentCache, uint32_t index, ScriptWrappable* targetObjec
t) |
6328 { | 6328 { |
6329 v8::Isolate* isolate = scriptState->isolate(); | 6329 v8::Isolate* isolate = scriptState->isolate(); |
6330 if (persistentCache->isEmpty()) { | 6330 if (persistentCache->isEmpty()) { |
6331 // TODO(kbr): eliminate the persistent caches and just use | 6331 // TODO(kbr): eliminate the persistent caches and just use |
6332 // V8HiddenValue::getHiddenValue. Unfortunately, it's | 6332 // V8HiddenValue::getHiddenValue. Unfortunately, it's |
6333 // currently too slow to use. crbug.com/611864 | 6333 // currently too slow to use. crbug.com/611864 |
6334 persistentCache->set(isolate, v8::Array::New(isolate)); | 6334 persistentCache->set(isolate, v8::Array::New(isolate)); |
6335 V8HiddenValue::setHiddenValue( | 6335 V8HiddenValue::setHiddenValue( |
6336 scriptState, | 6336 scriptState, |
6337 sourceObject->newLocalWrapper(isolate), | 6337 sourceObject->mainWorldWrapper(isolate), |
6338 hiddenValueName, | 6338 hiddenValueName, |
6339 persistentCache->newLocal(isolate)); | 6339 persistentCache->newLocal(isolate)); |
6340 // It is important to mark the persistent cache as weak | 6340 // It is important to mark the persistent cache as weak |
6341 // (phantom, actually). Otherwise there will be a reference | 6341 // (phantom, actually). Otherwise there will be a reference |
6342 // cycle between it and its JavaScript wrapper, and currently | 6342 // cycle between it and its JavaScript wrapper, and currently |
6343 // there are problems collecting such cycles. | 6343 // there are problems collecting such cycles. |
6344 persistentCache->setPhantom(); | 6344 persistentCache->setPhantom(); |
6345 } | 6345 } |
6346 | 6346 |
6347 v8::Local<v8::Array> localCache = persistentCache->newLocal(isolate); | 6347 v8::Local<v8::Array> localCache = persistentCache->newLocal(isolate); |
6348 if (targetObject) { | 6348 if (targetObject) { |
6349 v8CallOrCrash(localCache->Set(scriptState->context(), index, targetObjec
t->newLocalWrapper(isolate))); | 6349 v8CallOrCrash(localCache->Set(scriptState->context(), index, targetObjec
t->mainWorldWrapper(isolate))); |
6350 } else { | 6350 } else { |
6351 v8CallOrCrash(localCache->Set(scriptState->context(), index, v8::Null(is
olate))); | 6351 v8CallOrCrash(localCache->Set(scriptState->context(), index, v8::Null(is
olate))); |
6352 } | 6352 } |
6353 } | 6353 } |
6354 | 6354 |
6355 void WebGLRenderingContextBase::maybePreserveDefaultVAOObjectWrapper(ScriptState
* scriptState) | 6355 void WebGLRenderingContextBase::maybePreserveDefaultVAOObjectWrapper(ScriptState
* scriptState) |
6356 { | 6356 { |
6357 ASSERT(scriptState); | 6357 ASSERT(scriptState); |
6358 | 6358 |
6359 if (!m_preservedDefaultVAOObjectWrapper) { | 6359 if (!m_preservedDefaultVAOObjectWrapper) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6424 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6424 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
6425 } | 6425 } |
6426 | 6426 |
6427 void WebGLRenderingContextBase::restoreUnpackParameters() | 6427 void WebGLRenderingContextBase::restoreUnpackParameters() |
6428 { | 6428 { |
6429 if (m_unpackAlignment != 1) | 6429 if (m_unpackAlignment != 1) |
6430 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6430 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
6431 } | 6431 } |
6432 | 6432 |
6433 } // namespace blink | 6433 } // namespace blink |
OLD | NEW |