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

Side by Side Diff: include/v8.h

Issue 24356002: move CopyablePersistentTraits to v8.h (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 Uncompilable<Object>(); 473 Uncompilable<Object>();
474 } 474 }
475 // TODO(dcarney): come up with a good compile error here. 475 // TODO(dcarney): come up with a good compile error here.
476 template<class O> V8_INLINE static void Uncompilable() { 476 template<class O> V8_INLINE static void Uncompilable() {
477 TYPE_CHECK(O, Primitive); 477 TYPE_CHECK(O, Primitive);
478 } 478 }
479 }; 479 };
480 480
481 481
482 /** 482 /**
483 * Helper class traits to allow copying and assignment of Persistent.
484 * This will clone the contents of storage cell, but not any of the flags, etc.
485 */
486 template<class T>
487 struct CopyablePersistentTraits {
488 typedef Persistent<T, CopyablePersistentTraits<T> > CopyablePersistent;
489 static const bool kResetInDestructor = true;
490 template<class S, class M>
491 static V8_INLINE void Copy(const Persistent<S, M>& source,
492 CopyablePersistent* dest) {
493 // do nothing, just allow copy
494 }
495 };
496
497
498 /**
483 * An object reference that is independent of any handle scope. Where 499 * An object reference that is independent of any handle scope. Where
484 * a Local handle only lives as long as the HandleScope in which it was 500 * a Local handle only lives as long as the HandleScope in which it was
485 * allocated, a Persistent handle remains valid until it is explicitly 501 * allocated, a Persistent handle remains valid until it is explicitly
486 * disposed. 502 * disposed.
487 * 503 *
488 * A persistent handle contains a reference to a storage cell within 504 * A persistent handle contains a reference to a storage cell within
489 * the v8 engine which holds an object value and which is updated by 505 * the v8 engine which holds an object value and which is updated by
490 * the garbage collector whenever the object is moved. A new storage 506 * the garbage collector whenever the object is moved. A new storage
491 * cell can be created using the constructor or Persistent::Reset and 507 * cell can be created using the constructor or Persistent::Reset and
492 * existing handles can be disposed using Persistent::Reset. 508 * existing handles can be disposed using Persistent::Reset.
(...skipping 5962 matching lines...) Expand 10 before | Expand all | Expand 10 after
6455 */ 6471 */
6456 6472
6457 6473
6458 } // namespace v8 6474 } // namespace v8
6459 6475
6460 6476
6461 #undef TYPE_CHECK 6477 #undef TYPE_CHECK
6462 6478
6463 6479
6464 #endif // V8_H_ 6480 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698