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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.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/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
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/logging.h" 13 #include "base/logging.h"
13 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "base/threading/worker_pool.h" 16 #include "base/threading/worker_pool.h"
16 #include "cc/layers/delegated_renderer_layer.h" 17 #include "cc/layers/delegated_renderer_layer.h"
17 #include "cc/layers/layer.h" 18 #include "cc/layers/layer.h"
18 #include "cc/layers/texture_layer.h" 19 #include "cc/layers/texture_layer.h"
19 #include "cc/output/compositor_frame.h" 20 #include "cc/output/compositor_frame.h"
20 #include "cc/output/compositor_frame_ack.h" 21 #include "cc/output/compositor_frame_ack.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 414
414 int RenderWidgetHostViewAndroid::GetNativeImeAdapter() { 415 int RenderWidgetHostViewAndroid::GetNativeImeAdapter() {
415 return reinterpret_cast<int>(&ime_adapter_android_); 416 return reinterpret_cast<int>(&ime_adapter_android_);
416 } 417 }
417 418
418 void RenderWidgetHostViewAndroid::OnTextInputStateChanged( 419 void RenderWidgetHostViewAndroid::OnTextInputStateChanged(
419 const ViewHostMsg_TextInputState_Params& params) { 420 const ViewHostMsg_TextInputState_Params& params) {
420 // If an acknowledgement is required for this event, regardless of how we exit 421 // If an acknowledgement is required for this event, regardless of how we exit
421 // from this method, we must acknowledge that we processed the input state 422 // from this method, we must acknowledge that we processed the input state
422 // change. 423 // change.
423 base::ScopedClosureRunner ack_caller(base::Bind(&SendImeEventAck, host_)); 424 base::ScopedClosureRunner ack_caller;
424 if (!params.require_ack) 425 if (params.require_ack)
425 ack_caller.Release(); 426 ack_caller.Reset(base::Bind(&SendImeEventAck, host_));
426 427
427 if (!IsShowing()) 428 if (!IsShowing())
428 return; 429 return;
429 430
430 content_view_core_->UpdateImeAdapter( 431 content_view_core_->UpdateImeAdapter(
431 GetNativeImeAdapter(), 432 GetNativeImeAdapter(),
432 static_cast<int>(params.type), 433 static_cast<int>(params.type),
433 params.value, params.selection_start, params.selection_end, 434 params.value, params.selection_start, params.selection_end,
434 params.composition_start, params.composition_end, 435 params.composition_start, params.composition_end,
435 params.show_ime_if_needed); 436 params.show_ime_if_needed);
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 1222
1222 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock( 1223 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock(
1223 new SkAutoLockPixels(*bitmap)); 1224 new SkAutoLockPixels(*bitmap));
1224 uint8* pixels = static_cast<uint8*>(bitmap->getPixels()); 1225 uint8* pixels = static_cast<uint8*>(bitmap->getPixels());
1225 1226
1226 scoped_ptr<cc::TextureMailbox> texture_mailbox = result->TakeTexture(); 1227 scoped_ptr<cc::TextureMailbox> texture_mailbox = result->TakeTexture();
1227 DCHECK(texture_mailbox->IsTexture()); 1228 DCHECK(texture_mailbox->IsTexture());
1228 if (!texture_mailbox->IsTexture()) 1229 if (!texture_mailbox->IsTexture())
1229 return; 1230 return;
1230 1231
1231 scoped_callback_runner.Release(); 1232 ignore_result(scoped_callback_runner.Release());
1232 1233
1233 gl_helper->CropScaleReadbackAndCleanMailbox( 1234 gl_helper->CropScaleReadbackAndCleanMailbox(
1234 texture_mailbox->name(), 1235 texture_mailbox->name(),
1235 texture_mailbox->sync_point(), 1236 texture_mailbox->sync_point(),
1236 result->size(), 1237 result->size(),
1237 gfx::Rect(result->size()), 1238 gfx::Rect(result->size()),
1238 dst_size_in_pixel, 1239 dst_size_in_pixel,
1239 pixels, 1240 pixels,
1240 base::Bind(&CopyFromCompositingSurfaceFinished, 1241 base::Bind(&CopyFromCompositingSurfaceFinished,
1241 callback, 1242 callback,
(...skipping 15 matching lines...) Expand all
1257 return; 1258 return;
1258 1259
1259 scoped_ptr<SkBitmap> source = result->TakeBitmap(); 1260 scoped_ptr<SkBitmap> source = result->TakeBitmap();
1260 DCHECK(source); 1261 DCHECK(source);
1261 if (!source) 1262 if (!source)
1262 return; 1263 return;
1263 1264
1264 DCHECK_EQ(source->width(), dst_size_in_pixel.width()); 1265 DCHECK_EQ(source->width(), dst_size_in_pixel.width());
1265 DCHECK_EQ(source->height(), dst_size_in_pixel.height()); 1266 DCHECK_EQ(source->height(), dst_size_in_pixel.height());
1266 1267
1267 scoped_callback_runner.Release(); 1268 ignore_result(scoped_callback_runner.Release());
1268 callback.Run(true, *source); 1269 callback.Run(true, *source);
1269 } 1270 }
1270 1271
1271 // static 1272 // static
1272 void RenderWidgetHostViewPort::GetDefaultScreenInfo( 1273 void RenderWidgetHostViewPort::GetDefaultScreenInfo(
1273 WebKit::WebScreenInfo* results) { 1274 WebKit::WebScreenInfo* results) {
1274 const gfx::Display& display = 1275 const gfx::Display& display =
1275 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); 1276 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
1276 results->rect = display.bounds(); 1277 results->rect = display.bounds();
1277 // TODO(husky): Remove any system controls from availableRect. 1278 // TODO(husky): Remove any system controls from availableRect.
1278 results->availableRect = display.work_area(); 1279 results->availableRect = display.work_area();
1279 results->deviceScaleFactor = display.device_scale_factor(); 1280 results->deviceScaleFactor = display.device_scale_factor();
1280 gfx::DeviceDisplayInfo info; 1281 gfx::DeviceDisplayInfo info;
1281 results->depth = info.GetBitsPerPixel(); 1282 results->depth = info.GetBitsPerPixel();
1282 results->depthPerComponent = info.GetBitsPerComponent(); 1283 results->depthPerComponent = info.GetBitsPerComponent();
1283 results->isMonochrome = (results->depthPerComponent == 0); 1284 results->isMonochrome = (results->depthPerComponent == 0);
1284 } 1285 }
1285 1286
1286 //////////////////////////////////////////////////////////////////////////////// 1287 ////////////////////////////////////////////////////////////////////////////////
1287 // RenderWidgetHostView, public: 1288 // RenderWidgetHostView, public:
1288 1289
1289 // static 1290 // static
1290 RenderWidgetHostView* 1291 RenderWidgetHostView*
1291 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { 1292 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) {
1292 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); 1293 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget);
1293 return new RenderWidgetHostViewAndroid(rwhi, NULL); 1294 return new RenderWidgetHostViewAndroid(rwhi, NULL);
1294 } 1295 }
1295 1296
1296 } // namespace content 1297 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698