| 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 "ui/compositor/compositor.h" | 5 #include "ui/compositor/compositor.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <deque> | 10 #include <deque> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "ui/compositor/dip_util.h" | 38 #include "ui/compositor/dip_util.h" |
| 39 #include "ui/compositor/layer.h" | 39 #include "ui/compositor/layer.h" |
| 40 #include "ui/compositor/layer_animator_collection.h" | 40 #include "ui/compositor/layer_animator_collection.h" |
| 41 #include "ui/gl/gl_switches.h" | 41 #include "ui/gl/gl_switches.h" |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 const double kDefaultRefreshRate = 60.0; | 45 const double kDefaultRefreshRate = 60.0; |
| 46 const double kTestRefreshRate = 200.0; | 46 const double kTestRefreshRate = 200.0; |
| 47 | 47 |
| 48 bool IsRunningInMojoShell(base::CommandLine* command_line) { | |
| 49 const char kMojoShellFlag[] = "mojo-platform-channel-handle"; | |
| 50 return command_line->HasSwitch(kMojoShellFlag); | |
| 51 } | |
| 52 | |
| 53 } // namespace | 48 } // namespace |
| 54 | 49 |
| 55 namespace ui { | 50 namespace ui { |
| 56 | 51 |
| 57 CompositorLock::CompositorLock(Compositor* compositor) | 52 CompositorLock::CompositorLock(Compositor* compositor) |
| 58 : compositor_(compositor) { | 53 : compositor_(compositor) { |
| 59 if (compositor_->locks_will_time_out_) { | 54 if (compositor_->locks_will_time_out_) { |
| 60 compositor_->task_runner_->PostDelayedTask( | 55 compositor_->task_runner_->PostDelayedTask( |
| 61 FROM_HERE, | 56 FROM_HERE, |
| 62 base::Bind(&CompositorLock::CancelLock, AsWeakPtr()), | 57 base::Bind(&CompositorLock::CancelLock, AsWeakPtr()), |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 settings.renderer_settings.buffer_to_texture_target_map.insert( | 176 settings.renderer_settings.buffer_to_texture_target_map.insert( |
| 182 cc::BufferToTextureTargetMap::value_type( | 177 cc::BufferToTextureTargetMap::value_type( |
| 183 cc::BufferToTextureTargetKey(usage, format), target)); | 178 cc::BufferToTextureTargetKey(usage, format), target)); |
| 184 } | 179 } |
| 185 } | 180 } |
| 186 | 181 |
| 187 // Note: Only enable image decode tasks if we have more than one worker | 182 // Note: Only enable image decode tasks if we have more than one worker |
| 188 // thread. | 183 // thread. |
| 189 settings.image_decode_tasks_enabled = false; | 184 settings.image_decode_tasks_enabled = false; |
| 190 | 185 |
| 191 // TODO(crbug.com/603600): This should always be turned on once mus tells its | 186 settings.use_output_surface_begin_frame_source = true; |
| 192 // clients about BeginFrame. | |
| 193 settings.use_output_surface_begin_frame_source = | |
| 194 !IsRunningInMojoShell(command_line); | |
| 195 | 187 |
| 196 #if !defined(OS_ANDROID) | 188 #if !defined(OS_ANDROID) |
| 197 // TODO(sohanjg): Revisit this memory usage in tile manager. | 189 // TODO(sohanjg): Revisit this memory usage in tile manager. |
| 198 cc::ManagedMemoryPolicy policy( | 190 cc::ManagedMemoryPolicy policy( |
| 199 512 * 1024 * 1024, gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, | 191 512 * 1024 * 1024, gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, |
| 200 settings.memory_policy_.num_resources_limit); | 192 settings.memory_policy_.num_resources_limit); |
| 201 settings.memory_policy_ = policy; | 193 settings.memory_policy_ = policy; |
| 202 #endif | 194 #endif |
| 203 | 195 |
| 204 base::TimeTicks before_create = base::TimeTicks::Now(); | 196 base::TimeTicks before_create = base::TimeTicks::Now(); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 observer_list_, | 580 observer_list_, |
| 589 OnCompositingLockStateChanged(this)); | 581 OnCompositingLockStateChanged(this)); |
| 590 } | 582 } |
| 591 | 583 |
| 592 void Compositor::CancelCompositorLock() { | 584 void Compositor::CancelCompositorLock() { |
| 593 if (compositor_lock_) | 585 if (compositor_lock_) |
| 594 compositor_lock_->CancelLock(); | 586 compositor_lock_->CancelLock(); |
| 595 } | 587 } |
| 596 | 588 |
| 597 } // namespace ui | 589 } // namespace ui |
| OLD | NEW |