Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1674)

Unified Diff: ui/gfx/surface/accelerated_surface_win.h

Issue 8060045: Use shared D3D9 texture to transport the compositor's backing buffer to the browser... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gfx/surface/accelerated_surface_win.h
===================================================================
--- ui/gfx/surface/accelerated_surface_win.h (revision 0)
+++ ui/gfx/surface/accelerated_surface_win.h (revision 0)
@@ -0,0 +1,84 @@
+// Copyright (c) 2011 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 UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_
+#define UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_
+#pragma once
+
+#include <d3d9.h>
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+#include "base/message_loop_proxy.h"
+#include "base/synchronization/lock.h"
+#include "base/win/scoped_comptr.h"
+#include "ui/gfx/native_widget_types.h"
+#include "ui/gfx/size.h"
+#include "ui/gfx/surface/surface_export.h"
+
+class SURFACE_EXPORT AcceleratedSurface
+ : public base::RefCountedThreadSafe<AcceleratedSurface> {
+ public:
+ explicit AcceleratedSurface(gfx::NativeWindow parent);
+ ~AcceleratedSurface();
+
+ void Initialize();
+ void Destroy();
+
+ // Schedule a frame to be presented. The completion callback will be invoked
+ // when it is safe to write to the surface on another thread. The lock for
+ // this surface will be held while the completion callback runs.
+ void AsyncPresentAndAcknowledge(const gfx::Size& size,
+ int64 surface_id,
+ base::Closure completion_task);
+
+ // Synchronously present a frame with no acknowledgement.
+ void Present();
+
+ private:
+ void DoInitialize();
+ void DoDestroy(const scoped_refptr<base::MessageLoopProxy>& ui_message_loop);
+ void DoResize(const gfx::Size& size);
+ void DoPresentAndAcknowledge(const gfx::Size& size,
+ int64 surface_id,
+ base::Closure completion_task);
+
+ // The child window is owned by the UI thread so this function is called on
+ // the UI thread.
+ static LRESULT CALLBACK ChildWndProc(HWND window,
+ unsigned int message,
+ WPARAM wparam,
+ LPARAM lparam);
+
+ // Immutable and accessible from any thread without the lock.
+ const int thread_affinity_;
+ const gfx::NativeWindow window_;
+
+ // The size of the swap chain once any pending resizes have been processed.
+ // Only accessed on the UI thread so the lock is unnecessary.
+ gfx::Size pending_size_;
+
+ // The number of pending resizes. This is accessed with atomic operations so
+ // the lock is not necessary.
+ base::AtomicRefCount num_pending_resizes_;
+
+ // Take the lock before accessing any other state.
+ base::Lock lock_;
+
+ // This device's swap chain is presented to the child window. Copy semantics
+ // are used so it is possible to represent it to quickly validate the window.
+ base::win::ScopedComPtr<IDirect3DDevice9Ex> device_;
+
+ // This query is used to wait until a certain amount of progress has been
+ // made by the GPU and it is safe for the producer to modify its shared
+ // texture again.
+ base::win::ScopedComPtr<IDirect3DQuery9> query_;
+
+ // The current size of the swap chain.
+ gfx::Size size_;
+
+ DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface);
+};
+
+#endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_
Property changes on: ui\gfx\surface\accelerated_surface_win.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698