Home | History | Annotate | Download | only in shader_bench
      1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef MEDIA_TOOLS_SHADER_BENCH_WINDOW_H_
      6 #define MEDIA_TOOLS_SHADER_BENCH_WINDOW_H_
      7 
      8 #include "base/callback.h"
      9 #include "ui/gfx/native_widget_types.h"
     10 
     11 class Painter;
     12 
     13 namespace media {
     14 
     15 class Window {
     16  public:
     17   Window(int width, int height);
     18   ~Window();
     19 
     20   // Creates and returns a handle to a native window of the given dimensions.
     21   gfx::NativeWindow CreateNativeWindow(int width, int height);
     22 
     23   // Returns the NPAPI plugin window handle of the window.
     24   gfx::PluginWindowHandle PluginWindow();
     25 
     26   // Kicks off frame painting with the given limit, painter, and
     27   // callback to run when painting task is complete.
     28   void Start(int limit, const base::Closure& callback, Painter* painter);
     29 
     30   // Called when window is expected to paint self.
     31   void OnPaint();
     32 
     33   // Main loop for window.
     34   void MainLoop();
     35 
     36  private:
     37   // Closure to run when frame painting is completed. Will be reset after
     38   // running.
     39   base::Closure callback_;
     40 
     41   // Reference to painter Window uses to paint frames.
     42   Painter* painter_;
     43 
     44   // Number of frames to paint before closing the window.
     45   int limit_;
     46 
     47   // Number of frames currently painted.
     48   int count_;
     49 
     50   // True if the window is painting video frames to the screen, false otherwise.
     51   bool running_;
     52 
     53   // This window's native handle.
     54   gfx::NativeWindow window_handle_;
     55 
     56   DISALLOW_COPY_AND_ASSIGN(Window);
     57 };
     58 
     59 }  // namespace media
     60 
     61 #endif  // MEDIA_TOOLS_SHADER_BENCH_WINDOW_H_
     62