diff options
author | jbauman <jbauman@chromium.org> | 2015-06-03 16:38:59 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-03 23:39:41 +0000 |
commit | dfb4996ac036faf3318090eef1bf48d02cd4fe07 (patch) | |
tree | f737ee88f3d5ee7f33f86e3814cdfa767aad67a1 /content/browser/compositor | |
parent | 0b08cdaeab9210611012014b9ba7ac93d7efb5c7 (diff) | |
download | chromium_src-dfb4996ac036faf3318090eef1bf48d02cd4fe07.zip chromium_src-dfb4996ac036faf3318090eef1bf48d02cd4fe07.tar.gz chromium_src-dfb4996ac036faf3318090eef1bf48d02cd4fe07.tar.bz2 |
Support out-of-process iframes with Surfaces on Android.
Create a surface_utils.h to abstract out the details of getting a SurfaceManager and SurfaceIdAllocator on android vs. other chrome.
Review URL: https://codereview.chromium.org/1148003006
Cr-Commit-Position: refs/heads/master@{#332725}
Diffstat (limited to 'content/browser/compositor')
-rw-r--r-- | content/browser/compositor/surface_utils.cc | 36 | ||||
-rw-r--r-- | content/browser/compositor/surface_utils.h | 23 |
2 files changed, 59 insertions, 0 deletions
diff --git a/content/browser/compositor/surface_utils.cc b/content/browser/compositor/surface_utils.cc new file mode 100644 index 0000000..78f63a0 --- /dev/null +++ b/content/browser/compositor/surface_utils.cc @@ -0,0 +1,36 @@ +// Copyright 2015 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. + +#include "content/browser/compositor/surface_utils.h" + +#include "cc/surfaces/surface_id_allocator.h" + +#if defined(OS_ANDROID) +#include "content/browser/renderer_host/compositor_impl_android.h" +#else +#include "content/browser/compositor/image_transport_factory.h" +#include "ui/compositor/compositor.h" +#endif + +namespace content { + +scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() { +#if defined(OS_ANDROID) + return CompositorImpl::CreateSurfaceIdAllocator(); +#else + ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); + return factory->GetContextFactory()->CreateSurfaceIdAllocator(); +#endif +} + +cc::SurfaceManager* GetSurfaceManager() { +#if defined(OS_ANDROID) + return CompositorImpl::GetSurfaceManager(); +#else + ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); + return factory->GetSurfaceManager(); +#endif +} + +} // namespace content diff --git a/content/browser/compositor/surface_utils.h b/content/browser/compositor/surface_utils.h new file mode 100644 index 0000000..b56fef2 --- /dev/null +++ b/content/browser/compositor/surface_utils.h @@ -0,0 +1,23 @@ +// Copyright 2015 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_BROWSER_COMPOSITOR_SURFACE_UTILS_H_ +#define CONTENT_BROWSER_COMPOSITOR_SURFACE_UTILS_H_ + +#include "base/memory/scoped_ptr.h" + +namespace cc { +class SurfaceIdAllocator; +class SurfaceManager; +} // namespace cc + +namespace content { + +scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator(); + +cc::SurfaceManager* GetSurfaceManager(); + +} // namespace content + +#endif // CONTENT_BROWSER_COMPOSITOR_SURFACE_UTILS_H_ |