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

Side by Side Diff: Source/core/loader/ImageLoader.cpp

Issue 923443004: Oilpan: avoid access to to-be-swept ImageLoader object. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv ed.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 class ImageLoader::Task : public blink::WebThread::Task { 73 class ImageLoader::Task : public blink::WebThread::Task {
74 public: 74 public:
75 static PassOwnPtr<Task> create(ImageLoader* loader, UpdateFromElementBehavio r updateBehavior) 75 static PassOwnPtr<Task> create(ImageLoader* loader, UpdateFromElementBehavio r updateBehavior)
76 { 76 {
77 return adoptPtr(new Task(loader, updateBehavior)); 77 return adoptPtr(new Task(loader, updateBehavior));
78 } 78 }
79 79
80 Task(ImageLoader* loader, UpdateFromElementBehavior updateBehavior) 80 Task(ImageLoader* loader, UpdateFromElementBehavior updateBehavior)
81 : m_loader(loader) 81 : m_loader(loader)
82 , m_shouldBypassMainWorldCSP(shouldBypassMainWorldCSP(loader)) 82 , m_shouldBypassMainWorldCSP(shouldBypassMainWorldCSP(loader))
83 , m_updateBehavior(updateBehavior)
kouhei (in TOK) 2015/02/13 00:25:58 unintended change?
sof 2015/02/13 06:40:48 It helps to be have the weak factory last, and kee
kouhei (in TOK) 2015/02/13 09:00:34 sgtm. It might be helpful to mention about this ch
83 , m_weakFactory(this) 84 , m_weakFactory(this)
84 , m_updateBehavior(updateBehavior)
85 { 85 {
86 } 86 }
87 87
88 virtual void run() override 88 virtual void run() override
89 { 89 {
90 if (m_loader) { 90 if (m_loader) {
91 #if ENABLE(OILPAN)
92 if (Heap::willObjectBeLazilySwept(m_loader))
93 return;
kouhei (in TOK) 2015/02/13 00:25:58 Is this needed for all places where non-Oilpan obj
haraken 2015/02/13 01:41:59 In most cases, no. This hack is needed only when
sof 2015/02/13 06:40:48 I will go through the Microtasks and check if they
94 #endif
91 m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, m_updateBe havior); 95 m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, m_updateBe havior);
92 } 96 }
93 } 97 }
94 98
95 void clearLoader() 99 void clearLoader()
haraken 2015/02/13 01:38:53 Another possible fix would be to call clearLoader(
sof 2015/02/13 06:40:48 Wouldn't that lead to more unavoidable GC work, wo
haraken 2015/02/13 09:20:20 Whether we should use Heap::willObjectBeLazilySwep
sof 2015/02/13 09:38:46 When time, I need to look into what I thought were
96 { 100 {
97 m_loader = 0; 101 m_loader = 0;
98 } 102 }
99 103
100 WeakPtr<Task> createWeakPtr() 104 WeakPtr<Task> createWeakPtr()
101 { 105 {
102 return m_weakFactory.createWeakPtr(); 106 return m_weakFactory.createWeakPtr();
103 } 107 }
104 108
105 private: 109 private:
106 ImageLoader* m_loader; 110 ImageLoader* m_loader;
107 BypassMainWorldBehavior m_shouldBypassMainWorldCSP; 111 BypassMainWorldBehavior m_shouldBypassMainWorldCSP;
112 UpdateFromElementBehavior m_updateBehavior;
kouhei (in TOK) 2015/02/13 00:25:58 Ditto.
108 WeakPtrFactory<Task> m_weakFactory; 113 WeakPtrFactory<Task> m_weakFactory;
109 UpdateFromElementBehavior m_updateBehavior;
110 }; 114 };
111 115
112 ImageLoader::ImageLoader(Element* element) 116 ImageLoader::ImageLoader(Element* element)
113 : m_element(element) 117 : m_element(element)
114 , m_image(0) 118 , m_image(0)
115 , m_derefElementTimer(this, &ImageLoader::timerFired) 119 , m_derefElementTimer(this, &ImageLoader::timerFired)
116 , m_hasPendingLoadEvent(false) 120 , m_hasPendingLoadEvent(false)
117 , m_hasPendingErrorEvent(false) 121 , m_hasPendingErrorEvent(false)
118 , m_imageComplete(true) 122 , m_imageComplete(true)
119 , m_loadingImageDocument(false) 123 , m_loadingImageDocument(false)
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 #endif 593 #endif
590 } 594 }
591 595
592 #if ENABLE(OILPAN) 596 #if ENABLE(OILPAN)
593 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() 597 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover()
594 { 598 {
595 m_loader.willRemoveClient(m_client); 599 m_loader.willRemoveClient(m_client);
596 } 600 }
597 #endif 601 #endif
598 } 602 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698