diff options
Diffstat (limited to 'content/public/browser/android')
4 files changed, 61 insertions, 21 deletions
diff --git a/content/public/browser/android/compositor.h b/content/public/browser/android/compositor.h index 2d8126b..a8f734c 100644 --- a/content/public/browser/android/compositor.h +++ b/content/public/browser/android/compositor.h @@ -7,8 +7,8 @@ #include "base/callback.h" #include "cc/resources/ui_resource_bitmap.h" -#include "cc/resources/ui_resource_client.h" #include "content/common/content_export.h" +#include "content/public/browser/android/ui_resource_provider.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/rect.h" #include "ui/gfx/size.h" @@ -25,6 +25,7 @@ class JavaBitmap; namespace content { class CompositorClient; +class UIResourceProvider; // An interface to the browser-side compositor. class CONTENT_EXPORT Compositor { @@ -68,20 +69,8 @@ class CONTENT_EXPORT Compositor { // Composite *without* having modified the layer tree. virtual void SetNeedsComposite() = 0; - // Generates a UIResource and returns a UIResourceId. |is_transient| - // indicates whether or not to release the resource once the bitmap - // has been uploaded. May return 0. - virtual cc::UIResourceId GenerateUIResource(const SkBitmap& bitmap, - bool is_transient) = 0; - - // Generates an ETC1 compressed UIResource. See above for |is_transient|. - // May return 0. - virtual cc::UIResourceId GenerateCompressedUIResource(const gfx::Size& size, - void* pixels, - bool is_transient) = 0; - - // Deletes a UIResource. - virtual void DeleteUIResource(cc::UIResourceId resource_id) = 0; + // Returns the UI resource provider associated with the compositor. + virtual UIResourceProvider& GetUIResourceProvider() = 0; protected: Compositor() {} diff --git a/content/public/browser/android/compositor_client.h b/content/public/browser/android/compositor_client.h index 09a12e5..84a263e 100644 --- a/content/public/browser/android/compositor_client.h +++ b/content/public/browser/android/compositor_client.h @@ -20,12 +20,6 @@ class CONTENT_EXPORT CompositorClient { // Tells the client that GL resources were lost and need to be reinitialized. virtual void DidLoseResources() {} - // Tells the client that UI resources were lost and need to be reinitialized. - virtual void DidLoseUIResources() {} - - // Mark the UI Resources as being invalid for use. - virtual void UIResourcesAreInvalid() {} - protected: CompositorClient() {} virtual ~CompositorClient() {} diff --git a/content/public/browser/android/ui_resource_client_android.h b/content/public/browser/android/ui_resource_client_android.h new file mode 100644 index 0000000..83228bd --- /dev/null +++ b/content/public/browser/android/ui_resource_client_android.h @@ -0,0 +1,30 @@ +// Copyright 2014 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_UI_RESOURCE_CLIENT_ANDROID_H_ +#define CONTENT_PUBLIC_BROWSER_ANDROID_UI_RESOURCE_CLIENT_ANDROID_H_ + +#include "cc/resources/ui_resource_client.h" +#include "content/common/content_export.h" + +namespace content { + +class UIResourceProvider; + +// Android's UIResourceClient has one extra callback (UIResourceIsInvalid). +// This signal is intended for the case when the LayerTreeHost is cleared and +// the user needs to recreate their resources. +// TODO(powei): This interface can be removed once crbug.com/374906 has been +// addressed. +class CONTENT_EXPORT UIResourceClientAndroid : public cc::UIResourceClient { + public: + // This method indicates that the UI resource the user holds is no longer + // valid. The user should not call DeleteUIResource on any resource generated + // before this signal. + virtual void UIResourceIsInvalid() = 0; +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_ANDROID_UI_RESOURCE_CLIENT_ANDROID_H_ diff --git a/content/public/browser/android/ui_resource_provider.h b/content/public/browser/android/ui_resource_provider.h new file mode 100644 index 0000000..38511e1 --- /dev/null +++ b/content/public/browser/android/ui_resource_provider.h @@ -0,0 +1,27 @@ +// Copyright 2014 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_UI_RESOURCE_PROVIDER_H_ +#define CONTENT_PUBLIC_BROWSER_ANDROID_UI_RESOURCE_PROVIDER_H_ + +#include "cc/resources/ui_resource_client.h" +#include "content/common/content_export.h" + +namespace content { + +class UIResourceClientAndroid; + +class CONTENT_EXPORT UIResourceProvider { + public: + virtual ~UIResourceProvider() {} + + virtual cc::UIResourceId CreateUIResource( + UIResourceClientAndroid* client) = 0; + + virtual void DeleteUIResource(cc::UIResourceId resource_id) = 0; +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_ANDROID_UI_RESOURCE_PROVIDER_H_ |