diff options
Diffstat (limited to 'chromium/ui/compositor/context_provider_from_context_factory.h')
-rw-r--r-- | chromium/ui/compositor/context_provider_from_context_factory.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/chromium/ui/compositor/context_provider_from_context_factory.h b/chromium/ui/compositor/context_provider_from_context_factory.h new file mode 100644 index 00000000000..57be7f47efd --- /dev/null +++ b/chromium/ui/compositor/context_provider_from_context_factory.h @@ -0,0 +1,45 @@ +// Copyright (c) 2013 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_COMPOSITOR_CONTEXT_PROVIDER_FROM_CONTEXT_FACTORY_H_ +#define UI_COMPOSITOR_CONTEXT_PROVIDER_FROM_CONTEXT_FACTORY_H_ + +#include "base/synchronization/lock.h" +#include "cc/output/context_provider.h" +#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" +#include "ui/compositor/compositor.h" +#include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" + +namespace ui { + +class ContextProviderFromContextFactory + : public cc::ContextProvider { + public: + static scoped_refptr<ContextProviderFromContextFactory> CreateForOffscreen( + ContextFactory* factory); + + virtual bool BindToCurrentThread() OVERRIDE; + virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; + virtual class GrContext* GrContext() OVERRIDE; + virtual void VerifyContexts() OVERRIDE; + virtual bool DestroyedOnMainThread() OVERRIDE; + virtual void SetLostContextCallback(const LostContextCallback& cb) OVERRIDE; + + protected: + ContextProviderFromContextFactory(ContextFactory* factory); + virtual ~ContextProviderFromContextFactory(); + + bool InitializeOnMainThread(); + + private: + ContextFactory* factory_; + base::Lock destroyed_lock_; + bool destroyed_; + scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; + scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_; +}; + +} // namespace ui + +#endif // UI_COMPOSITOR_CONTEXT_PROVIDER_FROM_CONTEXT_FACTORY_H_ |