Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 22900018: cc: Set the mapped memory reclaim limit for the renderer compositor on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move max_transfer_buffer_usage_bytes to OutputSurface::Capabilities Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/compositor_impl_android.h" 5 #include "content/browser/renderer_host/compositor_impl_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 #include <map> 9 #include <map>
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 class JavaBitmap; 45 class JavaBitmap;
46 } 46 }
47 47
48 namespace { 48 namespace {
49 49
50 // Used for drawing directly to the screen. Bypasses resizing and swaps. 50 // Used for drawing directly to the screen. Bypasses resizing and swaps.
51 class DirectOutputSurface : public cc::OutputSurface { 51 class DirectOutputSurface : public cc::OutputSurface {
52 public: 52 public:
53 DirectOutputSurface( 53 DirectOutputSurface(
54 const scoped_refptr<cc::ContextProvider>& context_provider) 54 const scoped_refptr<cc::ContextProvider>& context_provider)
55 : cc::OutputSurface(context_provider) { 55 : cc::OutputSurface(context_provider,
56 OutputSurface::kDefaultMaxTransferBufferUsageBytes) {
56 capabilities_.adjust_deadline_for_parent = false; 57 capabilities_.adjust_deadline_for_parent = false;
57 } 58 }
58 59
59 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE { 60 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE {
60 surface_size_ = size; 61 surface_size_ = size;
61 } 62 }
62 virtual void SwapBuffers(cc::CompositorFrame*) OVERRIDE { 63 virtual void SwapBuffers(cc::CompositorFrame*) OVERRIDE {
63 context_provider_->Context3d()->shallowFlushCHROMIUM(); 64 context_provider_->Context3d()->shallowFlushCHROMIUM();
64 } 65 }
65 }; 66 };
66 67
67 // Used to override capabilities_.adjust_deadline_for_parent to false 68 // Used to override capabilities_.adjust_deadline_for_parent to false
68 class OutputSurfaceWithoutParent : public cc::OutputSurface { 69 class OutputSurfaceWithoutParent : public cc::OutputSurface {
69 public: 70 public:
70 OutputSurfaceWithoutParent( 71 OutputSurfaceWithoutParent(
71 const scoped_refptr< 72 const scoped_refptr<
72 content::ContextProviderCommandBuffer>& context_provider) 73 content::ContextProviderCommandBuffer>& context_provider)
73 : cc::OutputSurface(context_provider) { 74 : cc::OutputSurface(context_provider,
75 OutputSurface::kDefaultMaxTransferBufferUsageBytes) {
74 capabilities_.adjust_deadline_for_parent = false; 76 capabilities_.adjust_deadline_for_parent = false;
75 } 77 }
76 78
77 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE { 79 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE {
78 content::WebGraphicsContext3DCommandBufferImpl* command_buffer_context = 80 content::WebGraphicsContext3DCommandBufferImpl* command_buffer_context =
79 static_cast<content::WebGraphicsContext3DCommandBufferImpl*>( 81 static_cast<content::WebGraphicsContext3DCommandBufferImpl*>(
80 context_provider_->Context3d()); 82 context_provider_->Context3d());
81 content::CommandBufferProxyImpl* command_buffer_proxy = 83 content::CommandBufferProxyImpl* command_buffer_proxy =
82 command_buffer_context->GetCommandBufferProxy(); 84 command_buffer_context->GetCommandBufferProxy();
83 DCHECK(command_buffer_proxy); 85 DCHECK(command_buffer_proxy);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d = 412 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d =
411 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( 413 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
412 attrs, window_); 414 attrs, window_);
413 scoped_refptr<webkit::gpu::ContextProviderInProcess> context_provider = 415 scoped_refptr<webkit::gpu::ContextProviderInProcess> context_provider =
414 webkit::gpu::ContextProviderInProcess::Create(context3d.Pass()); 416 webkit::gpu::ContextProviderInProcess::Create(context3d.Pass());
415 417
416 scoped_ptr<cc::OutputSurface> output_surface; 418 scoped_ptr<cc::OutputSurface> output_surface;
417 if (!window_) 419 if (!window_)
418 output_surface.reset(new DirectOutputSurface(context_provider)); 420 output_surface.reset(new DirectOutputSurface(context_provider));
419 else 421 else
420 output_surface.reset(new cc::OutputSurface(context_provider)); 422 output_surface.reset(
423 new cc::OutputSurface(
424 context_provider,
425 cc::OutputSurface::kDefaultMaxTransferBufferUsageBytes));
421 return output_surface.Pass(); 426 return output_surface.Pass();
422 } 427 }
423 428
424 DCHECK(window_); 429 DCHECK(window_);
425 DCHECK(surface_id_); 430 DCHECK(surface_id_);
426 431
427 scoped_refptr<ContextProviderCommandBuffer> context_provider = 432 scoped_refptr<ContextProviderCommandBuffer> context_provider =
428 ContextProviderCommandBuffer::Create(CreateGpuProcessViewContext( 433 ContextProviderCommandBuffer::Create(CreateGpuProcessViewContext(
429 attrs, surface_id_, weak_factory_.GetWeakPtr())); 434 attrs, surface_id_, weak_factory_.GetWeakPtr()));
430 if (!context_provider.get()) { 435 if (!context_provider.get()) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 case ANDROID_BITMAP_FORMAT_RGBA_8888: 529 case ANDROID_BITMAP_FORMAT_RGBA_8888:
525 return GL_UNSIGNED_BYTE; 530 return GL_UNSIGNED_BYTE;
526 break; 531 break;
527 case ANDROID_BITMAP_FORMAT_RGB_565: 532 case ANDROID_BITMAP_FORMAT_RGB_565:
528 default: 533 default:
529 return GL_UNSIGNED_SHORT_5_6_5; 534 return GL_UNSIGNED_SHORT_5_6_5;
530 } 535 }
531 } 536 }
532 537
533 } // namespace content 538 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698