summaryrefslogtreecommitdiffstats
path: root/cc/surfaces/surface.cc
blob: 82a13222f261376c45378c859f3f3c2a879fa57a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/surfaces/surface.h"

#include "cc/output/compositor_frame.h"
#include "cc/surfaces/surface_manager.h"

namespace cc {

Surface::Surface(SurfaceManager* manager,
                 SurfaceClient* client,
                 const gfx::Size& size)
    : manager_(manager),
      client_(client),
      size_(size) {
  surface_id_ = manager_->RegisterAndAllocateIDForSurface(this);
}

Surface::~Surface() {
  manager_->DeregisterSurface(surface_id_);
}

void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame) {
  current_frame_ = frame.Pass();
}

CompositorFrame* Surface::GetEligibleFrame() { return current_frame_.get(); }

}  // namespace cc