| 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/layer.h" | 38 #include "ui/compositor/layer.h" |
| 39 #include "ui/compositor/layer_animator_collection.h" | 39 #include "ui/compositor/layer_animator_collection.h" |
| 40 #include "ui/gl/gl_context.h" | 40 #include "ui/gl/gl_context.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 |
| 48 } // namespace | 53 } // namespace |
| 49 | 54 |
| 50 namespace ui { | 55 namespace ui { |
| 51 | 56 |
| 52 CompositorLock::CompositorLock(Compositor* compositor) | 57 CompositorLock::CompositorLock(Compositor* compositor) |
| 53 : compositor_(compositor) { | 58 : compositor_(compositor) { |
| 54 if (compositor_->locks_will_time_out_) { | 59 if (compositor_->locks_will_time_out_) { |
| 55 compositor_->task_runner_->PostDelayedTask( | 60 compositor_->task_runner_->PostDelayedTask( |
| 56 FROM_HERE, | 61 FROM_HERE, |
| 57 base::Bind(&CompositorLock::CancelLock, AsWeakPtr()), | 62 base::Bind(&CompositorLock::CancelLock, AsWeakPtr()), |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 DCHECK_GT(settings.use_image_texture_targets.size(), format); | 173 DCHECK_GT(settings.use_image_texture_targets.size(), format); |
| 169 settings.use_image_texture_targets[format] = | 174 settings.use_image_texture_targets[format] = |
| 170 context_factory_->GetImageTextureTarget( | 175 context_factory_->GetImageTextureTarget( |
| 171 static_cast<gfx::BufferFormat>(format), usage); | 176 static_cast<gfx::BufferFormat>(format), usage); |
| 172 } | 177 } |
| 173 | 178 |
| 174 // Note: Only enable image decode tasks if we have more than one worker | 179 // Note: Only enable image decode tasks if we have more than one worker |
| 175 // thread. | 180 // thread. |
| 176 settings.image_decode_tasks_enabled = false; | 181 settings.image_decode_tasks_enabled = false; |
| 177 | 182 |
| 178 settings.use_output_surface_begin_frame_source = true; | 183 // TODO(crbug.com/603600): This should always be turned on once mus tells its |
| 184 // clients about BeginFrame. |
| 185 settings.use_output_surface_begin_frame_source = |
| 186 !IsRunningInMojoShell(command_line); |
| 179 | 187 |
| 180 #if !defined(OS_ANDROID) | 188 #if !defined(OS_ANDROID) |
| 181 // TODO(sohanjg): Revisit this memory usage in tile manager. | 189 // TODO(sohanjg): Revisit this memory usage in tile manager. |
| 182 cc::ManagedMemoryPolicy policy( | 190 cc::ManagedMemoryPolicy policy( |
| 183 512 * 1024 * 1024, gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, | 191 512 * 1024 * 1024, gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, |
| 184 settings.memory_policy_.num_resources_limit); | 192 settings.memory_policy_.num_resources_limit); |
| 185 settings.memory_policy_ = policy; | 193 settings.memory_policy_ = policy; |
| 186 #endif | 194 #endif |
| 187 | 195 |
| 188 base::TimeTicks before_create = base::TimeTicks::Now(); | 196 base::TimeTicks before_create = base::TimeTicks::Now(); |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 observer_list_, | 536 observer_list_, |
| 529 OnCompositingLockStateChanged(this)); | 537 OnCompositingLockStateChanged(this)); |
| 530 } | 538 } |
| 531 | 539 |
| 532 void Compositor::CancelCompositorLock() { | 540 void Compositor::CancelCompositorLock() { |
| 533 if (compositor_lock_) | 541 if (compositor_lock_) |
| 534 compositor_lock_->CancelLock(); | 542 compositor_lock_->CancelLock(); |
| 535 } | 543 } |
| 536 | 544 |
| 537 } // namespace ui | 545 } // namespace ui |
| OLD | NEW |