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 2834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2845 // fill rate like most notebooks, and the Mac implementation would need to | 2845 // fill rate like most notebooks, and the Mac implementation would need to |
2846 // be optimized to resolve directly into the IOSurface shared between the | 2846 // be optimized to resolve directly into the IOSurface shared between the |
2847 // GPU and browser processes. For these reasons and to avoid platform | 2847 // GPU and browser processes. For these reasons and to avoid platform |
2848 // disparities we explicitly disable antialiasing. | 2848 // disparities we explicitly disable antialiasing. |
2849 blink::WebGraphicsContext3D::Attributes attributes; | 2849 blink::WebGraphicsContext3D::Attributes attributes; |
2850 attributes.antialias = false; | 2850 attributes.antialias = false; |
2851 attributes.shareResources = true; | 2851 attributes.shareResources = true; |
2852 attributes.noAutomaticFlushes = true; | 2852 attributes.noAutomaticFlushes = true; |
2853 attributes.depth = false; | 2853 attributes.depth = false; |
2854 attributes.stencil = false; | 2854 attributes.stencil = false; |
| 2855 #if !defined(OS_CHROMEOS) |
2855 bool bind_generates_resources = false; | 2856 bool bind_generates_resources = false; |
| 2857 #endif |
2856 bool lose_context_when_out_of_memory = true; | 2858 bool lose_context_when_out_of_memory = true; |
2857 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; | 2859 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; |
2858 #if defined(OS_ANDROID) | 2860 #if defined(OS_ANDROID) |
2859 // If we raster too fast we become upload bound, and pending | 2861 // If we raster too fast we become upload bound, and pending |
2860 // uploads consume memory. For maximum upload throughput, we would | 2862 // uploads consume memory. For maximum upload throughput, we would |
2861 // want to allow for upload_throughput * pipeline_time of pending | 2863 // want to allow for upload_throughput * pipeline_time of pending |
2862 // uploads, after which we are just wasting memory. Since we don't | 2864 // uploads, after which we are just wasting memory. Since we don't |
2863 // know our upload throughput yet, this just caps our memory usage. | 2865 // know our upload throughput yet, this just caps our memory usage. |
2864 size_t divider = 1; | 2866 size_t divider = 1; |
2865 if (base::android::SysUtils::IsLowEndDevice()) | 2867 if (base::android::SysUtils::IsLowEndDevice()) |
(...skipping 10 matching lines...) Expand all Loading... |
2876 // to avoid unnecessarily stalling the compositor thread. | 2878 // to avoid unnecessarily stalling the compositor thread. |
2877 limits.mapped_memory_reclaim_limit = | 2879 limits.mapped_memory_reclaim_limit = |
2878 max_transfer_buffer_usage_mb * kBytesPerMegabyte; | 2880 max_transfer_buffer_usage_mb * kBytesPerMegabyte; |
2879 #endif | 2881 #endif |
2880 | 2882 |
2881 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 2883 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
2882 new WebGraphicsContext3DCommandBufferImpl(surface_id(), | 2884 new WebGraphicsContext3DCommandBufferImpl(surface_id(), |
2883 GetURLForGraphicsContext3D(), | 2885 GetURLForGraphicsContext3D(), |
2884 gpu_channel_host.get(), | 2886 gpu_channel_host.get(), |
2885 attributes, | 2887 attributes, |
| 2888 #if !defined(OS_CHROMEOS) |
2886 bind_generates_resources, | 2889 bind_generates_resources, |
| 2890 #endif |
2887 lose_context_when_out_of_memory, | 2891 lose_context_when_out_of_memory, |
2888 limits, | 2892 limits, |
2889 NULL)); | 2893 NULL)); |
2890 return context.Pass(); | 2894 return context.Pass(); |
2891 } | 2895 } |
2892 | 2896 |
2893 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2897 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
2894 swapped_out_frames_.AddObserver(frame); | 2898 swapped_out_frames_.AddObserver(frame); |
2895 } | 2899 } |
2896 | 2900 |
2897 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2901 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
2898 swapped_out_frames_.RemoveObserver(frame); | 2902 swapped_out_frames_.RemoveObserver(frame); |
2899 } | 2903 } |
2900 | 2904 |
2901 } // namespace content | 2905 } // namespace content |
OLD | NEW |