| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 2797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2808 static_cast<size_t>(2 * kMillisecondsPerFrame * max_mb_uploaded_per_ms); | 2808 static_cast<size_t>(2 * kMillisecondsPerFrame * max_mb_uploaded_per_ms); |
| 2809 static const size_t kBytesPerMegabyte = 1024 * 1024; | 2809 static const size_t kBytesPerMegabyte = 1024 * 1024; |
| 2810 // We keep the MappedMemoryReclaimLimit the same as the upload limit | 2810 // We keep the MappedMemoryReclaimLimit the same as the upload limit |
| 2811 // to avoid unnecessarily stalling the compositor thread. | 2811 // to avoid unnecessarily stalling the compositor thread. |
| 2812 limits.mapped_memory_reclaim_limit = | 2812 limits.mapped_memory_reclaim_limit = |
| 2813 max_transfer_buffer_usage_mb * kBytesPerMegabyte; | 2813 max_transfer_buffer_usage_mb * kBytesPerMegabyte; |
| 2814 #endif | 2814 #endif |
| 2815 | 2815 |
| 2816 base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client; | 2816 base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client; |
| 2817 | 2817 |
| 2818 if (!is_threaded_compositing_enabled_) | 2818 bool use_echo_for_swap_ack = true; |
| 2819 if (!is_threaded_compositing_enabled_) { |
| 2819 swap_client = weak_ptr_factory_.GetWeakPtr(); | 2820 swap_client = weak_ptr_factory_.GetWeakPtr(); |
| 2821 #if (defined(OS_MACOSX) || defined(OS_WIN)) && !defined(USE_AURA) |
| 2822 // ViewMsg_SwapBuffers_ACK is used instead for single-threaded path. |
| 2823 use_echo_for_swap_ack = false; |
| 2824 #endif |
| 2825 } |
| 2820 | 2826 |
| 2821 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 2827 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
| 2822 new WebGraphicsContext3DCommandBufferImpl( | 2828 new WebGraphicsContext3DCommandBufferImpl( |
| 2823 surface_id(), | 2829 surface_id(), |
| 2824 GetURLForGraphicsContext3D(), | 2830 GetURLForGraphicsContext3D(), |
| 2825 gpu_channel_host.get(), | 2831 gpu_channel_host.get(), |
| 2826 swap_client, | 2832 swap_client, |
| 2833 use_echo_for_swap_ack, |
| 2827 attributes, | 2834 attributes, |
| 2828 false /* bind generates resources */, | 2835 false /* bind generates resources */, |
| 2829 limits)); | 2836 limits)); |
| 2830 return context.Pass(); | 2837 return context.Pass(); |
| 2831 } | 2838 } |
| 2832 | 2839 |
| 2833 } // namespace content | 2840 } // namespace content |
| OLD | NEW |