| OLD | NEW |
| 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 298 |
| 299 template <typename U> | 299 template <typename U> |
| 300 WebPrivatePtr& operator=(const U& ptr) { | 300 WebPrivatePtr& operator=(const U& ptr) { |
| 301 Storage().Assign(ptr); | 301 Storage().Assign(ptr); |
| 302 return *this; | 302 return *this; |
| 303 } | 303 } |
| 304 | 304 |
| 305 T* Get() const { return Storage().Get(); } | 305 T* Get() const { return Storage().Get(); } |
| 306 | 306 |
| 307 T& operator*() const { | 307 T& operator*() const { |
| 308 ASSERT(storage_); | 308 DCHECK(storage_); |
| 309 return *Get(); | 309 return *Get(); |
| 310 } | 310 } |
| 311 | 311 |
| 312 T* operator->() const { | 312 T* operator->() const { |
| 313 ASSERT(storage_); | 313 DCHECK(storage_); |
| 314 return Get(); | 314 return Get(); |
| 315 } | 315 } |
| 316 #endif | 316 #endif |
| 317 | 317 |
| 318 private: | 318 private: |
| 319 #if INSIDE_BLINK | 319 #if INSIDE_BLINK |
| 320 using PtrStorageType = PtrStorage<T, crossThreadDestruction, strongOrWeak>; | 320 using PtrStorageType = PtrStorage<T, crossThreadDestruction, strongOrWeak>; |
| 321 | 321 |
| 322 PtrStorageType& Storage() { return PtrStorageType::FromSlot(&storage_); } | 322 PtrStorageType& Storage() { return PtrStorageType::FromSlot(&storage_); } |
| 323 const PtrStorageType& Storage() const { | 323 const PtrStorageType& Storage() const { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 335 // Disable the copy constructor; classes that contain a WebPrivatePtr | 335 // Disable the copy constructor; classes that contain a WebPrivatePtr |
| 336 // should implement their copy constructor using assign(). | 336 // should implement their copy constructor using assign(). |
| 337 WebPrivatePtr(const WebPrivatePtr&) = delete; | 337 WebPrivatePtr(const WebPrivatePtr&) = delete; |
| 338 | 338 |
| 339 void* storage_; | 339 void* storage_; |
| 340 }; | 340 }; |
| 341 | 341 |
| 342 } // namespace blink | 342 } // namespace blink |
| 343 | 343 |
| 344 #endif // WebPrivatePtr_h | 344 #endif // WebPrivatePtr_h |
| OLD | NEW |