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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 case WM_MBUTTONDOWN: | 174 case WM_MBUTTONDOWN: |
175 ::SendMessage(GetParent(window), message, wparam, lparam); | 175 ::SendMessage(GetParent(window), message, wparam, lparam); |
176 return 0; | 176 return 0; |
177 default: | 177 default: |
178 break; | 178 break; |
179 } | 179 } |
180 } | 180 } |
181 return ::DefWindowProc(window, message, wparam, lparam); | 181 return ::DefWindowProc(window, message, wparam, lparam); |
182 } | 182 } |
183 | 183 |
184 void SendToGpuProcessHost(int gpu_host_id, IPC::Message* m) { | 184 void SendToGpuProcessHost(int gpu_host_id, scoped_ptr<IPC::Message> message) { |
185 // TODO(ajwong): Switch back to Passed() when it becomes available again. | |
186 scoped_ptr<IPC::Message> message(m); | |
187 | |
188 GpuProcessHost* gpu_process_host = GpuProcessHost::FromID(gpu_host_id); | 185 GpuProcessHost* gpu_process_host = GpuProcessHost::FromID(gpu_host_id); |
189 if (!gpu_process_host) | 186 if (!gpu_process_host) |
190 return; | 187 return; |
191 | 188 |
192 gpu_process_host->Send(message.release()); | 189 gpu_process_host->Send(message.release()); |
193 } | 190 } |
194 | 191 |
195 void PostTaskOnIOThread(const tracked_objects::Location& from_here, | 192 void PostTaskOnIOThread(const tracked_objects::Location& from_here, |
196 base::Closure task) { | 193 base::Closure task) { |
197 BrowserThread::PostTask(BrowserThread::IO, from_here, task); | 194 BrowserThread::PostTask(BrowserThread::IO, from_here, task); |
(...skipping 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2041 | 2038 |
2042 void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped( | 2039 void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped( |
2043 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 2040 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
2044 int gpu_host_id) { | 2041 int gpu_host_id) { |
2045 if (params.surface_id) { | 2042 if (params.surface_id) { |
2046 if (!accelerated_surface_.get() && compositor_host_window_) { | 2043 if (!accelerated_surface_.get() && compositor_host_window_) { |
2047 accelerated_surface_ = new AcceleratedSurface(compositor_host_window_); | 2044 accelerated_surface_ = new AcceleratedSurface(compositor_host_window_); |
2048 accelerated_surface_->Initialize(); | 2045 accelerated_surface_->Initialize(); |
2049 } | 2046 } |
2050 | 2047 |
| 2048 scoped_ptr<IPC::Message> message( |
| 2049 new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id)); |
2051 base::Closure acknowledge_task = base::Bind( | 2050 base::Closure acknowledge_task = base::Bind( |
2052 SendToGpuProcessHost, | 2051 SendToGpuProcessHost, |
2053 gpu_host_id, | 2052 gpu_host_id, |
2054 new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id)); | 2053 base::Passed(&message)); |
2055 | 2054 |
2056 accelerated_surface_->AsyncPresentAndAcknowledge( | 2055 accelerated_surface_->AsyncPresentAndAcknowledge( |
2057 params.size, | 2056 params.size, |
2058 params.surface_id, | 2057 params.surface_id, |
2059 base::Bind(PostTaskOnIOThread, | 2058 base::Bind(PostTaskOnIOThread, |
2060 FROM_HERE, | 2059 FROM_HERE, |
2061 acknowledge_task)); | 2060 acknowledge_task)); |
2062 } else { | 2061 } else { |
2063 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id); | 2062 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id); |
2064 } | 2063 } |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2490 | 2489 |
2491 size_t offset = selection_range_.GetMin() - selection_text_offset_; | 2490 size_t offset = selection_range_.GetMin() - selection_text_offset_; |
2492 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), | 2491 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), |
2493 selection_text_.c_str() + offset, len * sizeof(WCHAR)); | 2492 selection_text_.c_str() + offset, len * sizeof(WCHAR)); |
2494 | 2493 |
2495 // According to Microsft API document, IMR_RECONVERTSTRING and | 2494 // According to Microsft API document, IMR_RECONVERTSTRING and |
2496 // IMR_DOCUMENTFEED should return reconv, but some applications return | 2495 // IMR_DOCUMENTFEED should return reconv, but some applications return |
2497 // need_size. | 2496 // need_size. |
2498 return reinterpret_cast<LRESULT>(reconv); | 2497 return reinterpret_cast<LRESULT>(reconv); |
2499 } | 2498 } |
OLD | NEW |