| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "core/fetch/DocumentResource.h" | 29 #include "core/fetch/DocumentResource.h" |
| 30 #include "platform/heap/Handle.h" | 30 #include "platform/heap/Handle.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 class DocumentResourceReference final : public GarbageCollectedFinalized<Documen
tResourceReference>, public DocumentResourceClient { | 34 class DocumentResourceReference final : public GarbageCollectedFinalized<Documen
tResourceReference>, public DocumentResourceClient { |
| 35 USING_GARBAGE_COLLECTED_MIXIN(DocumentResourceReference); | 35 USING_GARBAGE_COLLECTED_MIXIN(DocumentResourceReference); |
| 36 USING_PRE_FINALIZER(DocumentResourceReference, removeSelf); | 36 USING_PRE_FINALIZER(DocumentResourceReference, removeSelf); |
| 37 public: | 37 public: |
| 38 DocumentResourceReference(DocumentResource* document) | 38 explicit DocumentResourceReference(DocumentResource* document) |
| 39 : m_document(document) | 39 : m_document(document) |
| 40 { | 40 { |
| 41 ThreadState::current()->registerPreFinalizer(this); | 41 ThreadState::current()->registerPreFinalizer(this); |
| 42 m_document->addClient(this); | 42 m_document->addClient(this); |
| 43 } | 43 } |
| 44 ~DocumentResourceReference() override {} | 44 ~DocumentResourceReference() override {} |
| 45 DocumentResource* document() { return m_document.get(); } | 45 DocumentResource* document() { return m_document.get(); } |
| 46 DEFINE_INLINE_TRACE() | 46 DEFINE_INLINE_TRACE() |
| 47 { | 47 { |
| 48 visitor->trace(m_document); | 48 visitor->trace(m_document); |
| 49 DocumentResourceClient::trace(visitor); | 49 DocumentResourceClient::trace(visitor); |
| 50 } | 50 } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 void removeSelf() { m_document->removeClient(this); } | 53 void removeSelf() { m_document->removeClient(this); } |
| 54 | 54 |
| 55 String debugName() const override { return "DocumentResourceReference"; } | 55 String debugName() const override { return "DocumentResourceReference"; } |
| 56 Member<DocumentResource> m_document; | 56 Member<DocumentResource> m_document; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace blink | 59 } // namespace blink |
| 60 | 60 |
| 61 #endif | 61 #endif |
| OLD | NEW |