summaryrefslogtreecommitdiffstats
path: root/android_webview/browser/parent_output_surface.cc
blob: 4a777cb31881a601ee4c5f994158f0d38fea3380 (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
32
33
34
35
36
37
// 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 "android_webview/browser/parent_output_surface.h"

#include "cc/output/output_surface_client.h"
#include "gpu/command_buffer/client/gles2_interface.h"

namespace android_webview {

ParentOutputSurface::ParentOutputSurface(
    scoped_refptr<cc::ContextProvider> context_provider)
    : cc::OutputSurface(context_provider) {
}

ParentOutputSurface::~ParentOutputSurface() {
}

void ParentOutputSurface::DidLoseOutputSurface() {
  // Android WebView does not handle context loss.
  LOG(FATAL) << "Render thread context loss";
}

void ParentOutputSurface::Reshape(const gfx::Size& size,
                                  float scale_factor,
                                  bool has_alpha) {
  DCHECK_EQ(1.f, scale_factor);
  surface_size_ = size;
}

void ParentOutputSurface::SwapBuffers(cc::CompositorFrame* frame) {
  context_provider_->ContextGL()->ShallowFlushCHROMIUM();
  client_->DidSwapBuffers();
}

}  // namespace android_webview