Skip to content

Commit

Permalink
cc: Make picture pile base thread safe.
Browse files Browse the repository at this point in the history
This patch ensures that picture pile base is thread safe, since it is
not guaranteed that the ref is always adjusted on the same thread. In
particular, the worker thread (which refs picture pile on the cc thread)
might deref it (and delete it) on the worker thread.

R=reveman

Review URL: https://codereview.chromium.org/683543002

Cr-Commit-Position: refs/heads/master@{#301434}
  • Loading branch information
vmpstr authored and Commit bot committed Oct 27, 2014
1 parent 2b6d4cb commit e160161
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cc/resources/picture_pile_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class Value;

namespace cc {

class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> {
class CC_EXPORT PicturePileBase
: public base::RefCountedThreadSafe<PicturePileBase> {
public:
PicturePileBase();
explicit PicturePileBase(const PicturePileBase* other);
Expand Down Expand Up @@ -136,7 +137,7 @@ class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> {
private:
void SetBufferPixels(int buffer_pixels);

friend class base::RefCounted<PicturePileBase>;
friend class base::RefCountedThreadSafe<PicturePileBase>;
DISALLOW_COPY_AND_ASSIGN(PicturePileBase);
};

Expand Down

0 comments on commit e160161

Please sign in to comment.