Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 23514018: Add Reset to ScopedClosureRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android fix 2 Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bind.h" 10 #include "base/bind.h"
10 #include "base/bind_helpers.h" 11 #include "base/callback_helpers.h"
11 #include "base/command_line.h" 12 #include "base/command_line.h"
12 #include "base/debug/trace_event.h" 13 #include "base/debug/trace_event.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
16 #include "base/sha1.h" 17 #include "base/sha1.h"
17 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
18 #include "content/browser/browser_child_process_host_impl.h" 19 #include "content/browser/browser_child_process_host_impl.h"
19 #include "content/browser/gpu/gpu_data_manager_impl.h" 20 #include "content/browser/gpu/gpu_data_manager_impl.h"
20 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 21 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 } 894 }
894 RenderWidgetHelper* helper = 895 RenderWidgetHelper* helper =
895 RenderWidgetHelper::FromProcessHostID(render_process_id); 896 RenderWidgetHelper::FromProcessHostID(render_process_id);
896 if (!helper) 897 if (!helper)
897 return; 898 return;
898 899
899 // Pass the SwapBuffers on to the RenderWidgetHelper to wake up the UI thread 900 // Pass the SwapBuffers on to the RenderWidgetHelper to wake up the UI thread
900 // if the browser is waiting for a new frame. Otherwise the RenderWidgetHelper 901 // if the browser is waiting for a new frame. Otherwise the RenderWidgetHelper
901 // will forward to the RenderWidgetHostView via RenderProcessHostImpl and 902 // will forward to the RenderWidgetHostView via RenderProcessHostImpl and
902 // RenderWidgetHostImpl. 903 // RenderWidgetHostImpl.
903 scoped_completion_runner.Release(); 904 ignore_result(scoped_completion_runner.Release());
904 905
905 ViewHostMsg_CompositorSurfaceBuffersSwapped_Params view_params; 906 ViewHostMsg_CompositorSurfaceBuffersSwapped_Params view_params;
906 view_params.surface_id = params.surface_id; 907 view_params.surface_id = params.surface_id;
907 view_params.surface_handle = params.surface_handle; 908 view_params.surface_handle = params.surface_handle;
908 view_params.route_id = params.route_id; 909 view_params.route_id = params.route_id;
909 view_params.size = params.size; 910 view_params.size = params.size;
910 view_params.scale_factor = params.scale_factor; 911 view_params.scale_factor = params.scale_factor;
911 view_params.gpu_process_host_id = host_id_; 912 view_params.gpu_process_host_id = host_id_;
912 view_params.latency_info = params.latency_info; 913 view_params.latency_info = params.latency_info;
913 helper->DidReceiveBackingStoreMsg(ViewHostMsg_CompositorSurfaceBuffersSwapped( 914 helper->DidReceiveBackingStoreMsg(ViewHostMsg_CompositorSurfaceBuffersSwapped(
(...skipping 15 matching lines...) Expand all
929 gfx::GLSurfaceHandle handle = 930 gfx::GLSurfaceHandle handle =
930 GpuSurfaceTracker::Get()->GetSurfaceHandle(params.surface_id); 931 GpuSurfaceTracker::Get()->GetSurfaceHandle(params.surface_id);
931 932
932 if (handle.is_null()) 933 if (handle.is_null())
933 return; 934 return;
934 935
935 if (handle.transport_type == gfx::TEXTURE_TRANSPORT) { 936 if (handle.transport_type == gfx::TEXTURE_TRANSPORT) {
936 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI", 937 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI",
937 "surface_id", params.surface_id); 938 "surface_id", params.surface_id);
938 // This is a content area swap, send it on to the UI thread. 939 // This is a content area swap, send it on to the UI thread.
939 scoped_completion_runner.Release(); 940 ignore_result(scoped_completion_runner.Release());
940 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); 941 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
941 return; 942 return;
942 } 943 }
943 944
944 // Otherwise it's the UI swap. 945 // Otherwise it's the UI swap.
945 946
946 scoped_refptr<AcceleratedPresenter> presenter( 947 scoped_refptr<AcceleratedPresenter> presenter(
947 AcceleratedPresenter::GetForWindow(handle.handle)); 948 AcceleratedPresenter::GetForWindow(handle.handle));
948 if (!presenter) { 949 if (!presenter) {
949 TRACE_EVENT1("gpu", 950 TRACE_EVENT1("gpu",
950 "EarlyOut_NativeWindowNotFound", 951 "EarlyOut_NativeWindowNotFound",
951 "handle", 952 "handle",
952 handle.handle); 953 handle.handle);
953 scoped_completion_runner.Release(); 954 ignore_result(scoped_completion_runner.Release());
954 AcceleratedSurfaceBuffersSwappedCompleted(host_id_, 955 AcceleratedSurfaceBuffersSwappedCompleted(host_id_,
955 params.route_id, 956 params.route_id,
956 params.surface_id, 957 params.surface_id,
957 true, 958 true,
958 base::TimeTicks(), 959 base::TimeTicks(),
959 base::TimeDelta(), 960 base::TimeDelta(),
960 params.latency_info); 961 params.latency_info);
961 return; 962 return;
962 } 963 }
963 964
964 scoped_completion_runner.Release(); 965 ignore_result(scoped_completion_runner.Release());
965 presenter->AsyncPresentAndAcknowledge( 966 presenter->AsyncPresentAndAcknowledge(
966 params.size, 967 params.size,
967 params.surface_handle, 968 params.surface_handle,
968 params.latency_info, 969 params.latency_info,
969 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, 970 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted,
970 host_id_, 971 host_id_,
971 params.route_id, 972 params.route_id,
972 params.surface_id)); 973 params.surface_id));
973 974
974 FrameSubscriberMap::iterator it = frame_subscribers_.find(params.surface_id); 975 FrameSubscriberMap::iterator it = frame_subscribers_.find(params.surface_id);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1244 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1244 ClientIdToShaderCacheMap::iterator iter = 1245 ClientIdToShaderCacheMap::iterator iter =
1245 client_id_to_shader_cache_.find(client_id); 1246 client_id_to_shader_cache_.find(client_id);
1246 // If the cache doesn't exist then this is an off the record profile. 1247 // If the cache doesn't exist then this is an off the record profile.
1247 if (iter == client_id_to_shader_cache_.end()) 1248 if (iter == client_id_to_shader_cache_.end())
1248 return; 1249 return;
1249 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1250 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1250 } 1251 }
1251 1252
1252 } // namespace content 1253 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698