summaryrefslogtreecommitdiffstats
path: root/media/tools/shader_bench/window.h
blob: 3de12146593137f0b14349563c28d1f373557061 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (c) 2010 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.

#ifndef MEDIA_TOOLS_SHADER_BENCH_WINDOW_H_
#define MEDIA_TOOLS_SHADER_BENCH_WINDOW_H_

#include "ui/gfx/native_widget_types.h"

class Painter;
class Task;

namespace media {

class Window {
 public:
  Window(int width, int height);

  // Creates and returns a handle to a native window of the given dimensions.
  gfx::NativeWindow CreateNativeWindow(int width, int height);

  // Returns the NPAPI plugin window handle of the window.
  gfx::PluginWindowHandle PluginWindow();

  // Kicks off frame painting with the given limit, painter, and
  // callback to run when painting task is complete.
  void Start(int limit, Task* done_task, Painter* painter);

  // Called when window is expected to paint self.
  void OnPaint();

  // Main loop for window.
  void MainLoop();

 private:
  // Task to run when frame painting is completed. Will be deleted after
  // running.
  Task* done_task_;

  // Reference to painter Window uses to paint frames.
  Painter* painter_;

  // Number of frames to paint before closing the window.
  int limit_;

  // Number of frames currently painted.
  int count_;

  // True if the window is painting video frames to the screen, false otherwise.
  bool running_;

  // This window's native handle.
  gfx::NativeWindow window_handle_;

  DISALLOW_COPY_AND_ASSIGN(Window);
};

}  // namespace media

#endif  // MEDIA_TOOLS_SHADER_BENCH_WINDOW_H_