| 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/browser/gpu/gpu_process_host.h" | 5 #include "content/browser/gpu/gpu_process_host.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 params.size, | 974 params.size, |
| 975 params.surface_handle, | 975 params.surface_handle, |
| 976 params.latency_info, | 976 params.latency_info, |
| 977 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, | 977 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, |
| 978 host_id_, | 978 host_id_, |
| 979 params.route_id, | 979 params.route_id, |
| 980 params.surface_id)); | 980 params.surface_id)); |
| 981 | 981 |
| 982 FrameSubscriberMap::iterator it = frame_subscribers_.find(params.surface_id); | 982 FrameSubscriberMap::iterator it = frame_subscribers_.find(params.surface_id); |
| 983 if (it != frame_subscribers_.end() && it->second) { | 983 if (it != frame_subscribers_.end() && it->second) { |
| 984 const base::Time present_time = base::Time::Now(); | 984 const base::TimeTicks present_time = base::TimeTicks::Now(); |
| 985 scoped_refptr<media::VideoFrame> target_frame; | 985 scoped_refptr<media::VideoFrame> target_frame; |
| 986 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback copy_callback; | 986 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback copy_callback; |
| 987 if (it->second->ShouldCaptureFrame(present_time, | 987 if (it->second->ShouldCaptureFrame(present_time, |
| 988 &target_frame, ©_callback)) { | 988 &target_frame, ©_callback)) { |
| 989 // It is a potential improvement to do the copy in present, but we use a | 989 // It is a potential improvement to do the copy in present, but we use a |
| 990 // simpler approach for now. | 990 // simpler approach for now. |
| 991 presenter->AsyncCopyToVideoFrame( | 991 presenter->AsyncCopyToVideoFrame( |
| 992 gfx::Rect(params.size), target_frame, | 992 gfx::Rect(params.size), target_frame, |
| 993 base::Bind(copy_callback, present_time)); | 993 base::Bind(copy_callback, present_time)); |
| 994 } | 994 } |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1261 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
| 1262 ClientIdToShaderCacheMap::iterator iter = | 1262 ClientIdToShaderCacheMap::iterator iter = |
| 1263 client_id_to_shader_cache_.find(client_id); | 1263 client_id_to_shader_cache_.find(client_id); |
| 1264 // If the cache doesn't exist then this is an off the record profile. | 1264 // If the cache doesn't exist then this is an off the record profile. |
| 1265 if (iter == client_id_to_shader_cache_.end()) | 1265 if (iter == client_id_to_shader_cache_.end()) |
| 1266 return; | 1266 return; |
| 1267 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1267 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
| 1268 } | 1268 } |
| 1269 | 1269 |
| 1270 } // namespace content | 1270 } // namespace content |
| OLD | NEW |