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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_win.cc

Issue 8498036: Delay UpdateRect until the SwapBuffers callback when accelerated compositing is on. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: allow multiple update messages in flight Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer_host/render_widget_host_view_win.h" 5 #include "content/browser/renderer_host/render_widget_host_view_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 case WM_MBUTTONDOWN: 175 case WM_MBUTTONDOWN:
176 ::SendMessage(GetParent(window), message, wparam, lparam); 176 ::SendMessage(GetParent(window), message, wparam, lparam);
177 return 0; 177 return 0;
178 default: 178 default:
179 break; 179 break;
180 } 180 }
181 } 181 }
182 return ::DefWindowProc(window, message, wparam, lparam); 182 return ::DefWindowProc(window, message, wparam, lparam);
183 } 183 }
184 184
185 void SendToGpuProcessHost(int gpu_host_id, IPC::Message* message) {
186 GpuProcessHost* gpu_process_host = GpuProcessHost::FromID(gpu_host_id);
187 if (!gpu_process_host) {
188 delete message;
189 return;
190 }
191
192 gpu_process_host->Send(message);
193 }
194
195 void PostTaskOnIOThread(const tracked_objects::Location& from_here,
196 base::Closure task) {
197 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, task);
198 }
199
200 bool DecodeZoomGesture(HWND hwnd, const GESTUREINFO& gi, 185 bool DecodeZoomGesture(HWND hwnd, const GESTUREINFO& gi,
201 content::PageZoom* zoom, 186 content::PageZoom* zoom,
202 POINT* zoom_center) { 187 POINT* zoom_center) {
203 static long start = 0; 188 static long start = 0;
204 static POINT zoom_first; 189 static POINT zoom_first;
205 190
206 if (gi.dwFlags == GF_BEGIN) { 191 if (gi.dwFlags == GF_BEGIN) {
207 start = gi.ullArguments; 192 start = gi.ullArguments;
208 zoom_first.x = gi.ptsLocation.x; 193 zoom_first.x = gi.ptsLocation.x;
209 zoom_first.y = gi.ptsLocation.y; 194 zoom_first.y = gi.ptsLocation.y;
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); 2022 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
2038 } 2023 }
2039 } else { 2024 } else {
2040 hide_compositor_window_at_next_paint_ = true; 2025 hide_compositor_window_at_next_paint_ = true;
2041 } 2026 }
2042 } 2027 }
2043 2028
2044 void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped( 2029 void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped(
2045 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, 2030 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
2046 int gpu_host_id) { 2031 int gpu_host_id) {
2047 if (!accelerated_surface_.get() && compositor_host_window_) { 2032 if (params.surface_id) {
2048 accelerated_surface_ = new AcceleratedSurface(compositor_host_window_); 2033 if (!accelerated_surface_.get() && compositor_host_window_) {
2049 accelerated_surface_->Initialize(); 2034 accelerated_surface_ = new AcceleratedSurface(compositor_host_window_);
2035 accelerated_surface_->Initialize();
2036 }
2037
2038 accelerated_surface_->AsyncPresentAndAcknowledge(
2039 params.size,
2040 params.surface_id,
2041 base::Bind(&RenderWidgetHost::AcknowledgeSwapBuffers,
2042 gpu_host_id,
2043 params.route_id));
2044 } else {
2045 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id);
2050 } 2046 }
2051
2052 base::Closure acknowledge_task =
2053 base::Bind(SendToGpuProcessHost,
2054 gpu_host_id,
2055 new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id));
2056
2057 accelerated_surface_->AsyncPresentAndAcknowledge(
2058 params.size,
2059 params.surface_id,
2060 base::Bind(PostTaskOnIOThread,
2061 FROM_HERE,
2062 acknowledge_task));
2063 } 2047 }
2064 2048
2065 void RenderWidgetHostViewWin::AcceleratedSurfacePostSubBuffer( 2049 void RenderWidgetHostViewWin::AcceleratedSurfacePostSubBuffer(
2066 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, 2050 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
2067 int gpu_host_id) { 2051 int gpu_host_id) {
2068 NOTREACHED(); 2052 RenderWidgetHost::AcknowledgePostSubBuffer(params.route_id, gpu_host_id);
2069 } 2053 }
2070 2054
2071 void RenderWidgetHostViewWin::SetAccessibilityFocus(int acc_obj_id) { 2055 void RenderWidgetHostViewWin::SetAccessibilityFocus(int acc_obj_id) {
2072 if (!render_widget_host_) 2056 if (!render_widget_host_)
2073 return; 2057 return;
2074 2058
2075 render_widget_host_->AccessibilitySetFocus(acc_obj_id); 2059 render_widget_host_->AccessibilitySetFocus(acc_obj_id);
2076 } 2060 }
2077 2061
2078 void RenderWidgetHostViewWin::AccessibilityDoDefaultAction(int acc_obj_id) { 2062 void RenderWidgetHostViewWin::AccessibilityDoDefaultAction(int acc_obj_id) {
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
2487 2471
2488 size_t offset = selection_range_.GetMin() - selection_text_offset_; 2472 size_t offset = selection_range_.GetMin() - selection_text_offset_;
2489 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), 2473 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING),
2490 selection_text_.c_str() + offset, len * sizeof(WCHAR)); 2474 selection_text_.c_str() + offset, len * sizeof(WCHAR));
2491 2475
2492 // According to Microsft API document, IMR_RECONVERTSTRING and 2476 // According to Microsft API document, IMR_RECONVERTSTRING and
2493 // IMR_DOCUMENTFEED should return reconv, but some applications return 2477 // IMR_DOCUMENTFEED should return reconv, but some applications return
2494 // need_size. 2478 // need_size.
2495 return reinterpret_cast<LRESULT>(reconv); 2479 return reinterpret_cast<LRESULT>(reconv);
2496 } 2480 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_gtk.cc ('k') | content/common/gpu/image_transport_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698