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

Side by Side Diff: public/platform/WebPrivatePtr.h

Issue 313173009: WebPrivatePtr: avoid creating temporary Persistent<> on assignment. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use a transition type Created 6 years, 6 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 m_handle = 0; 125 m_handle = 0;
126 } 126 }
127 127
128 private: 128 private:
129 WebCore::Persistent<T>* m_handle; 129 WebCore::Persistent<T>* m_handle;
130 }; 130 };
131 131
132 template<typename T> 132 template<typename T>
133 class PtrStorageImpl<T, RefCountedGarbageCollectedLifetime> : public PtrStorageI mpl<T, GarbageCollectedLifetime> { 133 class PtrStorageImpl<T, RefCountedGarbageCollectedLifetime> : public PtrStorageI mpl<T, GarbageCollectedLifetime> {
134 public: 134 public:
135 void assign(const PassRefPtr<T>& val) { PtrStorageImpl<T, GarbageCollectedLi fetime>::assign(val.get()); } 135 void assign(const PassRefPtrWillBeRawPtr<T>& val) { PtrStorageImpl<T, Garbag eCollectedLifetime>::assign(val.get()); }
136 136
137 void assign(const PtrStorageImpl& other) { PtrStorageImpl<T, GarbageCollecte dLifetime>::assign(other.get()); } 137 void assign(const PtrStorageImpl& other) { PtrStorageImpl<T, GarbageCollecte dLifetime>::assign(other.get()); }
138 }; 138 };
139 139
140 template<typename T> 140 template<typename T>
141 class PtrStorage : public PtrStorageImpl<T, LifetimeOf<T>::value> { 141 class PtrStorage : public PtrStorageImpl<T, LifetimeOf<T>::value> {
142 public: 142 public:
143 static PtrStorage& fromSlot(void** slot) 143 static PtrStorage& fromSlot(void** slot)
144 { 144 {
145 COMPILE_ASSERT(sizeof(PtrStorage) == sizeof(void*), PtrStorage_must_be_p ointer_size); 145 COMPILE_ASSERT(sizeof(PtrStorage) == sizeof(void*), PtrStorage_must_be_p ointer_size);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // Disable the copy constructor; classes that contain a WebPrivatePtr 265 // Disable the copy constructor; classes that contain a WebPrivatePtr
266 // should implement their copy constructor using assign(). 266 // should implement their copy constructor using assign().
267 WebPrivatePtr(const WebPrivatePtr<T>&); 267 WebPrivatePtr(const WebPrivatePtr<T>&);
268 268
269 void* m_storage; 269 void* m_storage;
270 }; 270 };
271 271
272 } // namespace blink 272 } // namespace blink
273 273
274 #endif 274 #endif
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