Skip to content

Commit

Permalink
Revert "[Android] Fix a set of rendering issues introduced by single …
Browse files Browse the repository at this point in the history
…process mode."

This reverts commit 508c5aa.
  • Loading branch information
sqliu committed Oct 8, 2013
1 parent 1ebfe40 commit 302318b
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 4,840 deletions.
39 changes: 2 additions & 37 deletions content/browser/renderer_host/compositor_impl_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@
#include "cc/trees/layer_tree_host.h"
#include "content/browser/gpu/browser_gpu_channel_host_factory.h"
#include "content/browser/gpu/gpu_surface_tracker.h"
#include "content/browser/renderer_host/image_transport_factory_android.h"
#include "content/common/gpu/client/command_buffer_proxy_impl.h"
#include "content/common/gpu/client/context_provider_command_buffer.h"
#include "content/common/gpu/client/gl_helper.h"
#include "content/common/gpu/client/gl_helper_browser.h"
#include "content/common/gpu/client/gpu_channel_host.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_browser_impl.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
#include "content/public/browser/android/compositor_client.h"
#include "content/public/common/content_switches.h"
Expand Down Expand Up @@ -382,8 +380,7 @@ bool CompositorImpl::CopyTextureToBitmap(WebKit::WebGLId texture_id,
DCHECK(bitmap.size() == sub_rect.size());
if (bitmap.size() != sub_rect.size() || texture_id == 0) return false;

GLHelperBrowser* helper =
ImageTransportFactoryAndroid::GetInstance()->GetGLHelperBrowser();
GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper();
helper->ReadbackTextureSync(texture_id,
sub_rect,
static_cast<unsigned char*> (bitmap.pixels()));
Expand Down Expand Up @@ -457,38 +454,6 @@ scoped_ptr<cc::OutputSurface> CompositorImpl::CreateOutputSurface(
if (!context_provider.get()) {
LOG(ERROR) << "Failed to create 3D context for compositor.";
return scoped_ptr<cc::OutputSurface>();
} else {
DCHECK(window_ && surface_id_);
GpuChannelHostFactory* factory = BrowserGpuChannelHostFactory::instance();
GURL url("chrome://gpu/Compositor::createContext3D");
scoped_ptr<WebGraphicsContext3DCommandBufferBrowserImpl> context(
new WebGraphicsContext3DCommandBufferBrowserImpl(
surface_id_,
url,
factory,
weak_factory_.GetWeakPtr()));
static const size_t kBytesPerPixel = 4;
gfx::DeviceDisplayInfo display_info;
size_t full_screen_texture_size_in_bytes =
display_info.GetDisplayHeight() *
display_info.GetDisplayWidth() *
kBytesPerPixel;
if (!context->Initialize(
attrs,
false,
CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE,
64 * 1024, // command buffer size
std::min(full_screen_texture_size_in_bytes,
kDefaultStartTransferBufferSize),
kDefaultMinTransferBufferSize,
std::min(3 * full_screen_texture_size_in_bytes,
kDefaultMaxTransferBufferSize))) {
LOG(ERROR) << "Failed to create 3D context for compositor.";
return scoped_ptr<cc::OutputSurface>();
}
return scoped_ptr<cc::OutputSurface>(
new OutputSurfaceWithoutParent(
context.PassAs<WebKit::WebGraphicsContext3D>()));
}

return scoped_ptr<cc::OutputSurface>(
Expand Down
25 changes: 12 additions & 13 deletions content/browser/renderer_host/image_transport_factory_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include "base/strings/stringprintf.h"
#include "content/browser/gpu/browser_gpu_channel_host_factory.h"
#include "content/browser/renderer_host/compositor_impl_android.h"
#include "content/common/gpu/client/gl_helper_browser.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_browser_impl.h"
#include "content/common/gpu/client/gl_helper.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/khronos/GLES2/gl2.h"
Expand Down Expand Up @@ -55,7 +55,7 @@ class DirectGLImageTransportFactory : public ImageTransportFactoryAndroid {
virtual WebKit::WebGraphicsContext3D* GetContext3D() OVERRIDE {
return context_.get();
}
virtual GLHelperBrowser* GetGLHelperBrowser() OVERRIDE { return NULL; }
virtual GLHelper* GetGLHelper() OVERRIDE { return NULL; }

private:
scoped_ptr<WebKit::WebGraphicsContext3D> context_;
Expand Down Expand Up @@ -94,11 +94,11 @@ class CmdBufferImageTransportFactory : public ImageTransportFactoryAndroid {
virtual WebKit::WebGraphicsContext3D* GetContext3D() OVERRIDE {
return context_.get();
}
virtual GLHelperBrowser* GetGLHelperBrowser() OVERRIDE;
virtual GLHelper* GetGLHelper() OVERRIDE;

private:
scoped_ptr<WebGraphicsContext3DCommandBufferBrowserImpl> context_;
scoped_ptr<GLHelperBrowser> gl_helper_;
scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context_;
scoped_ptr<GLHelper> gl_helper_;

DISALLOW_COPY_AND_ASSIGN(CmdBufferImageTransportFactory);
};
Expand All @@ -109,11 +109,10 @@ CmdBufferImageTransportFactory::CmdBufferImageTransportFactory() {
GpuChannelHostFactory* factory = BrowserGpuChannelHostFactory::instance();
GURL url("chrome://gpu/ImageTransportFactoryAndroid");
base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client;
context_.reset(
new WebGraphicsContext3DCommandBufferBrowserImpl(0, // offscreen
url,
factory,
swap_client));
context_.reset(new WebGraphicsContext3DCommandBufferImpl(0, // offscreen
url,
factory,
swap_client));
static const size_t kBytesPerPixel = 4;
gfx::DeviceDisplayInfo display_info;
size_t full_screen_texture_size_in_bytes =
Expand Down Expand Up @@ -186,9 +185,9 @@ void CmdBufferImageTransportFactory::AcquireTexture(
context_->flush();
}

GLHelperBrowser* CmdBufferImageTransportFactory::GetGLHelperBrowser() {
GLHelper* CmdBufferImageTransportFactory::GetGLHelper() {
if (!gl_helper_)
gl_helper_.reset(new GLHelperBrowser(context_.get()));
gl_helper_.reset(new GLHelper(context_.get()));

return gl_helper_.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class WebGraphicsContext3D;

namespace content {
class GLHelper;
class GLHelperBrowser;
class GLContextLostListener;

class ImageTransportFactoryAndroidObserver {
Expand All @@ -41,7 +40,7 @@ class ImageTransportFactoryAndroid {
uint32 texture_id, const signed char* mailbox_name) = 0;

virtual WebKit::WebGraphicsContext3D* GetContext3D() = 0;
virtual GLHelperBrowser* GetGLHelperBrowser() = 0;
virtual GLHelper* GetGLHelper() = 0;

static void AddObserver(ImageTransportFactoryAndroidObserver* observer);
static void RemoveObserver(ImageTransportFactoryAndroidObserver* observer);
Expand Down
12 changes: 4 additions & 8 deletions content/browser/renderer_host/render_widget_host_view_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
#include "content/browser/renderer_host/image_transport_factory_android.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/surface_texture_transport_client_android.h"
#include "content/browser/renderer_host/touch_smooth_scroll_gesture_android.h"
#include "content/common/gpu/client/gl_helper.h"
#include "content/common/gpu/client/gl_helper_browser.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/common/input_messages.h"
#include "content/common/view_messages.h"
Expand Down Expand Up @@ -255,13 +253,12 @@ WebKit::WebGLId RenderWidgetHostViewAndroid::GetScaledContentTexture(
if (out_size)
*out_size = size;

GLHelperBrowser* helper =
ImageTransportFactoryAndroid::GetInstance()->GetGLHelperBrowser();
GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper();
return helper->CopyAndScaleTexture(texture_id_in_layer_,
texture_size_in_layer_,
size,
true,
GLHelperBrowser::SCALER_QUALITY_FAST);
GLHelper::SCALER_QUALITY_FAST);
}

bool RenderWidgetHostViewAndroid::PopulateBitmapWithContents(jobject jbitmap) {
Expand All @@ -275,15 +272,14 @@ bool RenderWidgetHostViewAndroid::PopulateBitmapWithContents(jobject jbitmap) {
// TODO(dtrainor): Eventually add support for multiple formats here.
DCHECK(bitmap.format() == ANDROID_BITMAP_FORMAT_RGBA_8888);

GLHelperBrowser* helper =
ImageTransportFactoryAndroid::GetInstance()->GetGLHelperBrowser();
GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper();

WebKit::WebGLId texture = helper->CopyAndScaleTexture(
texture_id_in_layer_,
texture_size_in_layer_,
bitmap.size(),
true,
GLHelperBrowser::SCALER_QUALITY_FAST);
GLHelper::SCALER_QUALITY_FAST);
if (texture == 0)
return false;

Expand Down
Loading

0 comments on commit 302318b

Please sign in to comment.