Home | History | Annotate | Download | only in renderer_host
      1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_IMAGE_TRANSPORT_FACTORY_ANDROID_H_
      6 #define CONTENT_BROWSER_RENDERER_HOST_IMAGE_TRANSPORT_FACTORY_ANDROID_H_
      7 
      8 #include "base/memory/scoped_ptr.h"
      9 #include "ui/gfx/native_widget_types.h"
     10 
     11 namespace gfx {
     12 class GLShareGroup;
     13 }
     14 
     15 namespace WebKit {
     16 class WebGraphicsContext3D;
     17 }
     18 
     19 namespace content {
     20 class GLHelper;
     21 class GLContextLostListener;
     22 
     23 class ImageTransportFactoryAndroidObserver {
     24  public:
     25   virtual ~ImageTransportFactoryAndroidObserver() {}
     26   virtual void OnLostResources() = 0;
     27 };
     28 
     29 class ImageTransportFactoryAndroid {
     30  public:
     31   virtual ~ImageTransportFactoryAndroid();
     32 
     33   static ImageTransportFactoryAndroid* GetInstance();
     34 
     35   virtual uint32_t InsertSyncPoint() = 0;
     36   virtual void WaitSyncPoint(uint32_t sync_point) = 0;
     37   virtual uint32_t CreateTexture() = 0;
     38   virtual void DeleteTexture(uint32_t id) = 0;
     39   virtual void AcquireTexture(
     40       uint32 texture_id, const signed char* mailbox_name) = 0;
     41 
     42   virtual WebKit::WebGraphicsContext3D* GetContext3D() = 0;
     43   virtual GLHelper* GetGLHelper() = 0;
     44 
     45   static void AddObserver(ImageTransportFactoryAndroidObserver* observer);
     46   static void RemoveObserver(ImageTransportFactoryAndroidObserver* observer);
     47 
     48 protected:
     49   ImageTransportFactoryAndroid();
     50 
     51   scoped_ptr<GLContextLostListener> context_lost_listener_;
     52 };
     53 
     54 }  // namespace content
     55 
     56 #endif  // CONTENT_BROWSER_RENDERER_HOST_IMAGE_TRANSPORT_FACTORY_ANDROID_H_
     57