OLD | NEW |
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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/debug/trace_event_synthetic_delay.h" | 10 #include "base/debug/trace_event_synthetic_delay.h" |
(...skipping 2814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2825 // fill rate like most notebooks, and the Mac implementation would need to | 2825 // fill rate like most notebooks, and the Mac implementation would need to |
2826 // be optimized to resolve directly into the IOSurface shared between the | 2826 // be optimized to resolve directly into the IOSurface shared between the |
2827 // GPU and browser processes. For these reasons and to avoid platform | 2827 // GPU and browser processes. For these reasons and to avoid platform |
2828 // disparities we explicitly disable antialiasing. | 2828 // disparities we explicitly disable antialiasing. |
2829 blink::WebGraphicsContext3D::Attributes attributes; | 2829 blink::WebGraphicsContext3D::Attributes attributes; |
2830 attributes.antialias = false; | 2830 attributes.antialias = false; |
2831 attributes.shareResources = true; | 2831 attributes.shareResources = true; |
2832 attributes.noAutomaticFlushes = true; | 2832 attributes.noAutomaticFlushes = true; |
2833 attributes.depth = false; | 2833 attributes.depth = false; |
2834 attributes.stencil = false; | 2834 attributes.stencil = false; |
2835 bool bind_generates_resources = false; | |
2836 bool lose_context_when_out_of_memory = true; | 2835 bool lose_context_when_out_of_memory = true; |
2837 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; | 2836 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; |
2838 #if defined(OS_ANDROID) | 2837 #if defined(OS_ANDROID) |
2839 // If we raster too fast we become upload bound, and pending | 2838 // If we raster too fast we become upload bound, and pending |
2840 // uploads consume memory. For maximum upload throughput, we would | 2839 // uploads consume memory. For maximum upload throughput, we would |
2841 // want to allow for upload_throughput * pipeline_time of pending | 2840 // want to allow for upload_throughput * pipeline_time of pending |
2842 // uploads, after which we are just wasting memory. Since we don't | 2841 // uploads, after which we are just wasting memory. Since we don't |
2843 // know our upload throughput yet, this just caps our memory usage. | 2842 // know our upload throughput yet, this just caps our memory usage. |
2844 size_t divider = 1; | 2843 size_t divider = 1; |
2845 if (base::android::SysUtils::IsLowEndDevice()) | 2844 if (base::android::SysUtils::IsLowEndDevice()) |
(...skipping 10 matching lines...) Expand all Loading... |
2856 // to avoid unnecessarily stalling the compositor thread. | 2855 // to avoid unnecessarily stalling the compositor thread. |
2857 limits.mapped_memory_reclaim_limit = | 2856 limits.mapped_memory_reclaim_limit = |
2858 max_transfer_buffer_usage_mb * kBytesPerMegabyte; | 2857 max_transfer_buffer_usage_mb * kBytesPerMegabyte; |
2859 #endif | 2858 #endif |
2860 | 2859 |
2861 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 2860 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
2862 new WebGraphicsContext3DCommandBufferImpl(surface_id(), | 2861 new WebGraphicsContext3DCommandBufferImpl(surface_id(), |
2863 GetURLForGraphicsContext3D(), | 2862 GetURLForGraphicsContext3D(), |
2864 gpu_channel_host.get(), | 2863 gpu_channel_host.get(), |
2865 attributes, | 2864 attributes, |
2866 bind_generates_resources, | |
2867 lose_context_when_out_of_memory, | 2865 lose_context_when_out_of_memory, |
2868 limits, | 2866 limits, |
2869 NULL)); | 2867 NULL)); |
2870 return context.Pass(); | 2868 return context.Pass(); |
2871 } | 2869 } |
2872 | 2870 |
2873 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2871 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
2874 swapped_out_frames_.AddObserver(frame); | 2872 swapped_out_frames_.AddObserver(frame); |
2875 } | 2873 } |
2876 | 2874 |
2877 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2875 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
2878 swapped_out_frames_.RemoveObserver(frame); | 2876 swapped_out_frames_.RemoveObserver(frame); |
2879 } | 2877 } |
2880 | 2878 |
2881 } // namespace content | 2879 } // namespace content |
OLD | NEW |