Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 22 matching lines...) Expand all Loading... | |
| 33 | 33 |
| 34 #include <memory> | 34 #include <memory> |
| 35 | 35 |
| 36 #include "platform/bindings/ScriptWrappableVisitor.h" | 36 #include "platform/bindings/ScriptWrappableVisitor.h" |
| 37 #include "platform/wtf/Allocator.h" | 37 #include "platform/wtf/Allocator.h" |
| 38 #include "platform/wtf/Noncopyable.h" | 38 #include "platform/wtf/Noncopyable.h" |
| 39 #include "v8/include/v8.h" | 39 #include "v8/include/v8.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 // A wrapper class around v8::Persistent, use this class to hold a persistent | |
|
jbroman
2017/04/28 19:07:03
super-nit: comma splice. Maybe just "Holds a persi
adithyas
2017/04/28 20:19:43
Much better :)
| |
| 44 // handle for a v8 type. | |
| 43 template <typename T> | 45 template <typename T> |
| 44 class ScopedPersistent { | 46 class ScopedPersistent { |
| 45 USING_FAST_MALLOC(ScopedPersistent); | 47 USING_FAST_MALLOC(ScopedPersistent); |
| 46 WTF_MAKE_NONCOPYABLE(ScopedPersistent); | 48 WTF_MAKE_NONCOPYABLE(ScopedPersistent); |
| 47 | 49 |
| 48 public: | 50 public: |
| 49 ScopedPersistent() {} | 51 ScopedPersistent() {} |
| 50 | 52 |
| 51 ScopedPersistent(v8::Isolate* isolate, v8::Local<T> handle) | 53 ScopedPersistent(v8::Isolate* isolate, v8::Local<T> handle) |
| 52 : handle_(isolate, handle) {} | 54 : handle_(isolate, handle) {} |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 | 101 |
| 100 ALWAYS_INLINE v8::Persistent<T>& Get() { return handle_; } | 102 ALWAYS_INLINE v8::Persistent<T>& Get() { return handle_; } |
| 101 | 103 |
| 102 private: | 104 private: |
| 103 v8::Persistent<T> handle_; | 105 v8::Persistent<T> handle_; |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 } // namespace blink | 108 } // namespace blink |
| 107 | 109 |
| 108 #endif // ScopedPersistent_h | 110 #endif // ScopedPersistent_h |
| OLD | NEW |