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

Side by Side Diff: Source/bindings/v8/UnsafePersistent.h

Issue 26792002: Reland: Reland: Implement new Blink IDL attribute [SetReference] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: mark NodeFilter Dependent Created 7 years, 1 month 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/bindings/v8/DOMWrapperMap.h ('k') | Source/bindings/v8/V8DOMWrapper.h » ('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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 // This is incredibly unsafe: the handle is valid only when this 83 // This is incredibly unsafe: the handle is valid only when this
84 // UnsafePersistent is alive and valid (see class level comment). 84 // UnsafePersistent is alive and valid (see class level comment).
85 v8::Persistent<T>* persistent() 85 v8::Persistent<T>* persistent()
86 { 86 {
87 v8::Persistent<T>* handle = reinterpret_cast<v8::Persistent<T>*>(&m_valu e); 87 v8::Persistent<T>* handle = reinterpret_cast<v8::Persistent<T>*>(&m_valu e);
88 return handle; 88 return handle;
89 } 89 }
90 90
91 void setReferenceFrom(const v8::Persistent<v8::Object>& parent, v8::Isolate* isolate)
92 {
93 isolate->SetReference(parent, *persistent());
94 }
95
91 void dispose() 96 void dispose()
92 { 97 {
93 persistent()->Dispose(); 98 persistent()->Dispose();
94 m_value = 0; 99 m_value = 0;
95 } 100 }
96 101
97 void clear() 102 void clear()
98 { 103 {
99 m_value = 0; 104 m_value = 0;
100 } 105 }
(...skipping 14 matching lines...) Expand all
115 v8::Handle<T>* handle = reinterpret_cast<v8::Handle<T>*>(&m_value); 120 v8::Handle<T>* handle = reinterpret_cast<v8::Handle<T>*>(&m_value);
116 return *handle; 121 return *handle;
117 } 122 }
118 123
119 T* m_value; 124 T* m_value;
120 }; 125 };
121 126
122 } // namespace WebCore 127 } // namespace WebCore
123 128
124 #endif // UnsafePersistent_h 129 #endif // UnsafePersistent_h
OLDNEW
« no previous file with comments | « Source/bindings/v8/DOMWrapperMap.h ('k') | Source/bindings/v8/V8DOMWrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698