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

Side by Side Diff: chrome/renderer/extensions/scoped_persistent.h

Issue 12091004: POSIX: re-enable strict aliasing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_RENDERER_EXTENSIONS_SCOPED_PERSISTENT_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_SCOPED_PERSISTENT_H_
6 #define CHROME_RENDERER_EXTENSIONS_SCOPED_PERSISTENT_H_ 6 #define CHROME_RENDERER_EXTENSIONS_SCOPED_PERSISTENT_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "v8/include/v8.h" 9 #include "v8/include/v8.h"
10 10
(...skipping 29 matching lines...) Expand all
40 handle_.Clear(); 40 handle_.Clear();
41 } 41 }
42 42
43 v8::Handle<T> operator->() const { 43 v8::Handle<T> operator->() const {
44 return get(); 44 return get();
45 } 45 }
46 46
47 // TODO(dcarney): Remove this function 47 // TODO(dcarney): Remove this function
48 // This is an unsafe access to the underlying handle 48 // This is an unsafe access to the underlying handle
49 v8::Handle<T> get() const { 49 v8::Handle<T> get() const {
50 return *reinterpret_cast<v8::Handle<T>*>( 50 return bit_cast<v8::Handle<T> >(handle_);
51 const_cast<v8::Persistent<T>* >(&handle_));
52 } 51 }
53 52
54 v8::Handle<T> NewHandle() const { 53 v8::Handle<T> NewHandle() const {
55 if (handle_.IsEmpty()) 54 if (handle_.IsEmpty())
56 return v8::Local<T>(); 55 return v8::Local<T>();
57 return v8::Local<T>::New(GetIsolate(handle_), handle_); 56 return v8::Local<T>::New(GetIsolate(handle_), handle_);
58 } 57 }
59 58
60 template<typename P> 59 template<typename P>
61 void MakeWeak(P* parameters, 60 void MakeWeak(P* parameters,
(...skipping 21 matching lines...) Expand all
83 } 82 }
84 83
85 v8::Persistent<T> handle_; 84 v8::Persistent<T> handle_;
86 85
87 DISALLOW_COPY_AND_ASSIGN(ScopedPersistent); 86 DISALLOW_COPY_AND_ASSIGN(ScopedPersistent);
88 }; 87 };
89 88
90 } // namespace extensions 89 } // namespace extensions
91 90
92 #endif // CHROME_RENDERER_EXTENSIONS_SCOPED_PERSISTENT_H_ 91 #endif // CHROME_RENDERER_EXTENSIONS_SCOPED_PERSISTENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698