OLD | NEW |
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 using ResourceType = R; | 47 using ResourceType = R; |
48 ~ResourceOwner() override {} | 48 ~ResourceOwner() override {} |
49 ResourceType* resource() const { return m_resource; } | 49 ResourceType* resource() const { return m_resource; } |
50 | 50 |
51 DEFINE_INLINE_TRACE() { | 51 DEFINE_INLINE_TRACE() { |
52 visitor->trace(m_resource); | 52 visitor->trace(m_resource); |
53 C::trace(visitor); | 53 C::trace(visitor); |
54 } | 54 } |
55 | 55 |
56 protected: | 56 protected: |
57 ResourceOwner() { ThreadState::current()->registerPreFinalizer(this); } | 57 ResourceOwner() {} |
58 | 58 |
59 void setResource( | 59 void setResource( |
60 ResourceType*, | 60 ResourceType*, |
61 Resource::PreloadReferencePolicy = Resource::MarkAsReferenced); | 61 Resource::PreloadReferencePolicy = Resource::MarkAsReferenced); |
62 void clearResource() { setResource(nullptr); } | 62 void clearResource() { setResource(nullptr); } |
63 | 63 |
64 private: | 64 private: |
65 Member<ResourceType> m_resource; | 65 Member<ResourceType> m_resource; |
66 }; | 66 }; |
67 | 67 |
(...skipping 11 matching lines...) Expand all Loading... |
79 | 79 |
80 if (newResource) { | 80 if (newResource) { |
81 m_resource = newResource; | 81 m_resource = newResource; |
82 m_resource->addClient(this, preloadReferencePolicy); | 82 m_resource->addClient(this, preloadReferencePolicy); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 } // namespace blink | 86 } // namespace blink |
87 | 87 |
88 #endif | 88 #endif |
OLD | NEW |