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

Side by Side Diff: bindings/v8/V8DOMWrapper.cpp

Issue 160259: - Bind CanvasPixelArray wrappers to the backing store directly without... (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/WebCore/
Patch Set: Created 11 years, 4 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
« no previous file with comments | « no previous file | no next file » | 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 descriptor->InstanceTemplate()->SetCallAsFunctionHandler(USE_CALLBACK(HT MLPlugInElement)); 285 descriptor->InstanceTemplate()->SetCallAsFunctionHandler(USE_CALLBACK(HT MLPlugInElement));
286 break; 286 break;
287 case V8ClassIndex::HTMLFRAMESETELEMENT: 287 case V8ClassIndex::HTMLFRAMESETELEMENT:
288 descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPER TY_GETTER(HTMLFrameSetElement)); 288 descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPER TY_GETTER(HTMLFrameSetElement));
289 break; 289 break;
290 case V8ClassIndex::HTMLFORMELEMENT: 290 case V8ClassIndex::HTMLFORMELEMENT:
291 descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPER TY_GETTER(HTMLFormElement)); 291 descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPER TY_GETTER(HTMLFormElement));
292 descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PR OPERTY_GETTER(HTMLFormElement), 0, 0, 0, nodeCollectionIndexedPropertyEnumerator <HTMLFormElement>, v8::Integer::New(V8ClassIndex::NODE)); 292 descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PR OPERTY_GETTER(HTMLFormElement), 0, 0, 0, nodeCollectionIndexedPropertyEnumerator <HTMLFormElement>, v8::Integer::New(V8ClassIndex::NODE));
293 break; 293 break;
294 case V8ClassIndex::CANVASPIXELARRAY: 294 case V8ClassIndex::CANVASPIXELARRAY:
295 descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PR OPERTY_GETTER(CanvasPixelArray), USE_INDEXED_PROPERTY_SETTER(CanvasPixelArray)); 295 //descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_ PROPERTY_GETTER(CanvasPixelArray), USE_INDEXED_PROPERTY_SETTER(CanvasPixelArray) );
iposva 2009/07/28 03:41:58 This will be removed before commit, but it helps b
296 break; 296 break;
297 case V8ClassIndex::STYLESHEET: // fall through 297 case V8ClassIndex::STYLESHEET: // fall through
298 case V8ClassIndex::CSSSTYLESHEET: { 298 case V8ClassIndex::CSSSTYLESHEET: {
299 // We add an extra internal field to hold a reference to 299 // We add an extra internal field to hold a reference to
300 // the owner node. 300 // the owner node.
301 v8::Local<v8::ObjectTemplate> instanceTemplate = descriptor->InstanceTem plate(); 301 v8::Local<v8::ObjectTemplate> instanceTemplate = descriptor->InstanceTem plate();
302 ASSERT(instanceTemplate->InternalFieldCount() == V8Custom::kDefaultWrapp erInternalFieldCount); 302 ASSERT(instanceTemplate->InternalFieldCount() == V8Custom::kDefaultWrapp erInternalFieldCount);
303 instanceTemplate->SetInternalFieldCount(V8Custom::kStyleSheetInternalFie ldCount); 303 instanceTemplate->SetInternalFieldCount(V8Custom::kStyleSheetInternalFie ldCount);
304 break; 304 break;
305 } 305 }
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 DOM_OBJECT_TYPES(MAKE_CASE) 552 DOM_OBJECT_TYPES(MAKE_CASE)
553 #undef MAKE_CASE 553 #undef MAKE_CASE
554 default: 554 default:
555 ASSERT_NOT_REACHED(); 555 ASSERT_NOT_REACHED();
556 } 556 }
557 result = v8::Persistent<v8::Object>::New(v8Object); 557 result = v8::Persistent<v8::Object>::New(v8Object);
558 if (isActiveDomObject) 558 if (isActiveDomObject)
559 setJSWrapperForActiveDOMObject(impl, result); 559 setJSWrapperForActiveDOMObject(impl, result);
560 else 560 else
561 setJSWrapperForDOMObject(impl, result); 561 setJSWrapperForDOMObject(impl, result);
562
563 if (type == V8ClassIndex::CANVASPIXELARRAY) {
564 CanvasPixelArray* pixels = reinterpret_cast<CanvasPixelArray*>(imp l);
565 result->SetElementsToPixelData(pixels->data()->data(), pixels->len gth());
iposva 2009/07/28 03:41:58 I will change the API call in V8 to SetIndexedProp
566 }
562 567
563 // Special case for non-node objects associated with a 568 // Special case for non-node objects associated with a
564 // DOMWindow. Both Safari and FF let the JS wrappers for these 569 // DOMWindow. Both Safari and FF let the JS wrappers for these
565 // objects survive GC. To mimic their behavior, V8 creates 570 // objects survive GC. To mimic their behavior, V8 creates
566 // hidden references from the DOMWindow to these wrapper 571 // hidden references from the DOMWindow to these wrapper
567 // objects. These references get cleared when the DOMWindow is 572 // objects. These references get cleared when the DOMWindow is
568 // reused by a new page. 573 // reused by a new page.
569 switch (type) { 574 switch (type) {
570 case V8ClassIndex::CONSOLE: 575 case V8ClassIndex::CONSOLE:
571 setHiddenWindowReference(static_cast<Console*>(impl)->frame(), V 8Custom::kDOMWindowConsoleIndex, result); 576 setHiddenWindowReference(static_cast<Console*>(impl)->frame(), V 8Custom::kDOMWindowConsoleIndex, result);
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 if (V8IsolatedWorld* world = V8IsolatedWorld::getEntered()) { 1415 if (V8IsolatedWorld* world = V8IsolatedWorld::getEntered()) {
1411 context = world->context(); 1416 context = world->context();
1412 if (frame != V8Proxy::retrieveFrame(context)) 1417 if (frame != V8Proxy::retrieveFrame(context))
1413 return v8::Handle<v8::Context>(); 1418 return v8::Handle<v8::Context>();
1414 } 1419 }
1415 1420
1416 return context; 1421 return context;
1417 } 1422 }
1418 1423
1419 } // namespace WebCore 1424 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698