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