Chromium Code Reviews| Index: content/public/browser/android/draw_delegate.h |
| diff --git a/content/public/browser/android/draw_delegate.h b/content/public/browser/android/draw_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ab6542ce3d290d5e19f197c9c34d585334ca3c1c |
| --- /dev/null |
| +++ b/content/public/browser/android/draw_delegate.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_ANDROID_DRAW_DELEGATE_H_ |
| +#define CONTENT_PUBLIC_BROWSER_ANDROID_DRAW_DELEGATE_H_ |
| + |
| +#include "base/callback.h" |
| +#include "ui/gfx/native_widget_types.h" |
| + |
| +namespace content { |
| + |
| +class RenderWidgetHostView; |
| + |
| +// This interface facilitates the communication between compositor and |
| +// UI with respect to new frames arriving and acknowledging when they |
| +// have been presented. |
| +class DrawDelegate { |
|
jam
2012/07/27 20:46:29
this isn't really an interface. why is all this in
no sievers
2012/07/31 01:28:44
I split this into DrawDelegate and DrawDelegateImp
|
| + public: |
| + static DrawDelegate* GetInstance(); |
| + DrawDelegate(); |
| + ~DrawDelegate(); |
| + |
| + // Callback to be run after the frame has been drawn. It passes back |
| + // a synchronization point identifier. |
| + typedef base::Callback<void(uint32)> SurfacePresentedCallback; |
| + |
| + // Notification to the UI that the surface identified by the texture id |
| + // has been updated. |
| + typedef base::Callback<void( |
| + uint64, |
| + RenderWidgetHostView*, |
| + const SurfacePresentedCallback&)> SurfaceUpdatedCallback; |
| + |
| + void SetUpdateCallback(const SurfaceUpdatedCallback& callback); |
| + |
| + void OnSurfaceUpdated(uint64 texture, RenderWidgetHostView* view, |
| + const SurfacePresentedCallback& present_callback); |
| + |
| + // TODO(sievers): This should be private |
| + // This surface handle is used by the compositor. There currently |
| + // are some dependencies between compositor and UI context for |
| + // TextureImageTransportSurface, and that's why it depends on the |
| + // UI surface creation here. |
| + void SetDrawSurface(gfx::GLSurfaceHandle handle) { handle_ = handle; } |
| + gfx::GLSurfaceHandle GetDrawSurface() { return handle_; } |
| + |
| + protected: |
| + SurfaceUpdatedCallback draw_callback_; |
| + gfx::GLSurfaceHandle handle_; |
| +}; |
| + |
| +}; // namespace content |
|
Ted C
2012/07/27 20:31:15
no semi-colon
no sievers
2012/07/31 01:28:44
Done.
|
| + |
| +#endif // CONTENT_PUBLIC_BROWSER_ANDROID_DRAW_DELEGATE_H_ |