OLD | NEW |
---|---|
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 Loading... | |
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); | |
darin (slow to review)
2011/12/12 23:54:32
perhaps you meant to forward |from_here|?
piman
2011/12/13 00:35:41
Probably... I was just reverting part of the CL, s
| |
198 } | |
199 | |
185 bool DecodeZoomGesture(HWND hwnd, const GESTUREINFO& gi, | 200 bool DecodeZoomGesture(HWND hwnd, const GESTUREINFO& gi, |
186 content::PageZoom* zoom, | 201 content::PageZoom* zoom, |
187 POINT* zoom_center) { | 202 POINT* zoom_center) { |
188 static long start = 0; | 203 static long start = 0; |
189 static POINT zoom_first; | 204 static POINT zoom_first; |
190 | 205 |
191 if (gi.dwFlags == GF_BEGIN) { | 206 if (gi.dwFlags == GF_BEGIN) { |
192 start = gi.ullArguments; | 207 start = gi.ullArguments; |
193 zoom_first.x = gi.ptsLocation.x; | 208 zoom_first.x = gi.ptsLocation.x; |
194 zoom_first.y = gi.ptsLocation.y; | 209 zoom_first.y = gi.ptsLocation.y; |
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2028 | 2043 |
2029 void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped( | 2044 void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped( |
2030 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 2045 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
2031 int gpu_host_id) { | 2046 int gpu_host_id) { |
2032 if (params.surface_id) { | 2047 if (params.surface_id) { |
2033 if (!accelerated_surface_.get() && compositor_host_window_) { | 2048 if (!accelerated_surface_.get() && compositor_host_window_) { |
2034 accelerated_surface_ = new AcceleratedSurface(compositor_host_window_); | 2049 accelerated_surface_ = new AcceleratedSurface(compositor_host_window_); |
2035 accelerated_surface_->Initialize(); | 2050 accelerated_surface_->Initialize(); |
2036 } | 2051 } |
2037 | 2052 |
2053 base::Closure acknowledge_task = base::Bind( | |
2054 SendToGpuProcessHost, | |
2055 gpu_host_id, | |
2056 new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id)); | |
darin (slow to review)
2011/12/12 23:54:32
it seems like you should be using the new Passed()
piman
2011/12/13 00:35:41
Done.
| |
2057 | |
2038 accelerated_surface_->AsyncPresentAndAcknowledge( | 2058 accelerated_surface_->AsyncPresentAndAcknowledge( |
2039 params.size, | 2059 params.size, |
2040 params.surface_id, | 2060 params.surface_id, |
2041 base::Bind(&RenderWidgetHost::AcknowledgeSwapBuffers, | 2061 base::Bind(PostTaskOnIOThread, FROM_HERE, acknowledge_task)); |
darin (slow to review)
2011/12/12 23:54:32
hmm, seems like it might be nice to add PostTaskOn
piman
2011/12/13 00:35:41
I removed that function.
We could argue whether or
piman
2011/12/13 01:04:50
Turns out, it's actually needed for overload resol
| |
2042 gpu_host_id, | |
2043 params.route_id)); | |
2044 } else { | 2062 } else { |
2045 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id); | 2063 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id); |
2046 } | 2064 } |
2047 } | 2065 } |
2048 | 2066 |
2049 void RenderWidgetHostViewWin::AcceleratedSurfacePostSubBuffer( | 2067 void RenderWidgetHostViewWin::AcceleratedSurfacePostSubBuffer( |
2050 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | 2068 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
2051 int gpu_host_id) { | 2069 int gpu_host_id) { |
2052 RenderWidgetHost::AcknowledgePostSubBuffer(params.route_id, gpu_host_id); | 2070 RenderWidgetHost::AcknowledgePostSubBuffer(params.route_id, gpu_host_id); |
2053 } | 2071 } |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2471 | 2489 |
2472 size_t offset = selection_range_.GetMin() - selection_text_offset_; | 2490 size_t offset = selection_range_.GetMin() - selection_text_offset_; |
2473 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), | 2491 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), |
2474 selection_text_.c_str() + offset, len * sizeof(WCHAR)); | 2492 selection_text_.c_str() + offset, len * sizeof(WCHAR)); |
2475 | 2493 |
2476 // According to Microsft API document, IMR_RECONVERTSTRING and | 2494 // According to Microsft API document, IMR_RECONVERTSTRING and |
2477 // IMR_DOCUMENTFEED should return reconv, but some applications return | 2495 // IMR_DOCUMENTFEED should return reconv, but some applications return |
2478 // need_size. | 2496 // need_size. |
2479 return reinterpret_cast<LRESULT>(reconv); | 2497 return reinterpret_cast<LRESULT>(reconv); |
2480 } | 2498 } |
OLD | NEW |