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

Side by Side Diff: Source/heap/Handle.h

Issue 22887044: [oilpan] Make the oilpan branch build on Mac. (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Add FIXME. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGTRefElement.cpp ('k') | Source/heap/Heap.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 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 1343
1344 template<typename T, typename U> 1344 template<typename T, typename U>
1345 static void visitWith(Visitor* visitor, const WTF::KeyValuePair<T, Member<U> >& t, bool needsVisiting) 1345 static void visitWith(Visitor* visitor, const WTF::KeyValuePair<T, Member<U> >& t, bool needsVisiting)
1346 { 1346 {
1347 visitor->visit(t.value); 1347 visitor->visit(t.value);
1348 } 1348 }
1349 1349
1350 template<typename T> 1350 template<typename T>
1351 struct IteratorWitness { 1351 struct IteratorWitness {
1352 typedef HandleWitness<T> Type; 1352 typedef HandleWitness<T> Type;
1353 static void verify(Type witness, const T* collection) { witness.verify(c ollection); } 1353 static void verifyWitness(Type witness, const T* collection) { witness.v erifyWitness(collection); }
1354 }; 1354 };
1355 // This class is intentionally left undefined. The name is intended to 1355 // This class is intentionally left undefined. The name is intended to
1356 // be the error message you get when calling a method that needs to 1356 // be the error message you get when calling a method that needs to
1357 // create iterators, if you forget to give it the address of a handle 1357 // create iterators, if you forget to give it the address of a handle
1358 // that ensures the collection is kept alive while you iterate over it. 1358 // that ensures the collection is kept alive while you iterate over it.
1359 class YouMustProvideAHandleToThatMethod; 1359 class YouMustProvideAHandleToThatMethod;
1360 typedef YouMustProvideAHandleToThatMethod DefaultArgument; 1360 typedef YouMustProvideAHandleToThatMethod DefaultArgument;
1361 1361
1362 template<typename T> friend class Handle; 1362 template<typename T> friend class Handle;
1363 template<typename T> friend class Persistent; 1363 template<typename T> friend class Persistent;
1364 }; 1364 };
1365 1365
1366 // An instance of this class is used when creating iterators to prove that you 1366 // An instance of this class is used when creating iterators to prove that you
1367 // have a handle for the collection, so that it cannot be garbage collected 1367 // have a handle for the collection, so that it cannot be garbage collected
1368 // while the iterator is live. We need this indirection, rather than just using 1368 // while the iterator is live. We need this indirection, rather than just using
1369 // the handle pointer directly, because the Handle<T> and Handle<const T> 1369 // the handle pointer directly, because the Handle<T> and Handle<const T>
1370 // pointers are not related, and we want to be able to pass either. 1370 // pointers are not related, and we want to be able to pass either.
1371 template<typename T> 1371 template<typename T>
1372 class HandleWitness { 1372 class HandleWitness {
1373 public: 1373 public:
1374 HandleWitness(const Handle<const T>* handle) : m_handle(handle) { } 1374 HandleWitness(const Handle<const T>* handle) : m_handle(handle) { }
1375 HandleWitness(const Handle<T>* handle) : m_handle(reinterpret_cast<const Han dle<const T>*>(handle)) { } 1375 HandleWitness(const Handle<T>* handle) : m_handle(reinterpret_cast<const Han dle<const T>*>(handle)) { }
1376 void verify(const T* pointer) { ASSERT((!pointer && !m_handle) || pointer == m_handle->raw()); } 1376 void verifyWitness(const T* pointer) { ASSERT((!pointer && !m_handle) || poi nter == m_handle->raw()); }
1377 template<typename U> 1377 template<typename U>
1378 explicit HandleWitness(const HandleWitness<U>& other) : m_handle(reinterpret _cast<const Handle<const T>*>(other.m_handle)) { } 1378 explicit HandleWitness(const HandleWitness<U>& other) : m_handle(reinterpret _cast<const Handle<const T>*>(other.m_handle)) { }
1379 private: 1379 private:
1380 const Handle<const T>* m_handle; 1380 const Handle<const T>* m_handle;
1381 template<typename U> 1381 template<typename U>
1382 friend class HandleWitness; 1382 friend class HandleWitness;
1383 }; 1383 };
1384 1384
1385 } 1385 }
1386 1386
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 typedef PtrHash<WebCore::Member<T> > Hash; 1436 typedef PtrHash<WebCore::Member<T> > Hash;
1437 }; 1437 };
1438 1438
1439 #define DEFINE_SELF_HANDLE(Type) \ 1439 #define DEFINE_SELF_HANDLE(Type) \
1440 Result<Type> selfHandle() { return adoptRawResult(this); } \ 1440 Result<Type> selfHandle() { return adoptRawResult(this); } \
1441 Result<const Type> selfHandle() const { return adoptRawResult(this); } 1441 Result<const Type> selfHandle() const { return adoptRawResult(this); }
1442 1442
1443 } 1443 }
1444 1444
1445 #endif 1445 #endif
OLDNEW
« no previous file with comments | « Source/core/svg/SVGTRefElement.cpp ('k') | Source/heap/Heap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698