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

Side by Side Diff: content/renderer/pepper/pepper_compositor_host.cc

Issue 601293003: [Pepper][Compositor] Fix the compositor stops updating texture issue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review issues Created 6 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer/pepper/pepper_compositor_host.h" 5 #include "content/renderer/pepper/pepper_compositor_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "cc/layers/layer.h" 9 #include "cc/layers/layer.h"
10 #include "cc/layers/solid_color_layer.h" 10 #include "cc/layers/solid_color_layer.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 static_cast<cc::TextureLayer*>(layer.get())); 251 static_cast<cc::TextureLayer*>(layer.get()));
252 if (!old_layer || 252 if (!old_layer ||
253 new_layer->common.resource_id != old_layer->common.resource_id) { 253 new_layer->common.resource_id != old_layer->common.resource_id) {
254 cc::TextureMailbox mailbox(new_layer->texture->mailbox, 254 cc::TextureMailbox mailbox(new_layer->texture->mailbox,
255 new_layer->texture->target, 255 new_layer->texture->target,
256 new_layer->texture->sync_point); 256 new_layer->texture->sync_point);
257 texture_layer->SetTextureMailbox(mailbox, 257 texture_layer->SetTextureMailbox(mailbox,
258 cc::SingleReleaseCallback::Create( 258 cc::SingleReleaseCallback::Create(
259 base::Bind(&PepperCompositorHost::ResourceReleased, 259 base::Bind(&PepperCompositorHost::ResourceReleased,
260 weak_factory_.GetWeakPtr(), 260 weak_factory_.GetWeakPtr(),
261 new_layer->common.resource_id)));; 261 new_layer->common.resource_id)));
262 // TODO(penghuang): get a damage region from the application and
263 // pass it to SetNeedsDisplayRect().
264 texture_layer->SetNeedsDisplay();
262 } 265 }
263 texture_layer->SetPremultipliedAlpha(new_layer->texture->premult_alpha); 266 texture_layer->SetPremultipliedAlpha(new_layer->texture->premult_alpha);
264 gfx::RectF rect = PP_ToGfxRectF(new_layer->texture->source_rect); 267 gfx::RectF rect = PP_ToGfxRectF(new_layer->texture->source_rect);
265 texture_layer->SetUV(rect.origin(), rect.bottom_right()); 268 texture_layer->SetUV(rect.origin(), rect.bottom_right());
266 return; 269 return;
267 } 270 }
268 271
269 if (new_layer->image) { 272 if (new_layer->image) {
270 if (!old_layer || 273 if (!old_layer ||
271 new_layer->common.resource_id != old_layer->common.resource_id) { 274 new_layer->common.resource_id != old_layer->common.resource_id) {
(...skipping 11 matching lines...) Expand all
283 DCHECK_EQ(desc.format, PP_IMAGEDATAFORMAT_RGBA_PREMUL); 286 DCHECK_EQ(desc.format, PP_IMAGEDATAFORMAT_RGBA_PREMUL);
284 287
285 cc::TextureMailbox mailbox(image_shm.get(), 288 cc::TextureMailbox mailbox(image_shm.get(),
286 PP_ToGfxSize(desc.size)); 289 PP_ToGfxSize(desc.size));
287 image_layer->SetTextureMailbox(mailbox, 290 image_layer->SetTextureMailbox(mailbox,
288 cc::SingleReleaseCallback::Create( 291 cc::SingleReleaseCallback::Create(
289 base::Bind(&PepperCompositorHost::ImageReleased, 292 base::Bind(&PepperCompositorHost::ImageReleased,
290 weak_factory_.GetWeakPtr(), 293 weak_factory_.GetWeakPtr(),
291 new_layer->common.resource_id, 294 new_layer->common.resource_id,
292 base::Passed(&image_shm)))); 295 base::Passed(&image_shm))));
296 // TODO(penghuang): get a damage region from the application and
297 // pass it to SetNeedsDisplayRect().
298 image_layer->SetNeedsDisplay();
293 299
294 // ImageData is always premultiplied alpha. 300 // ImageData is always premultiplied alpha.
295 image_layer->SetPremultipliedAlpha(true); 301 image_layer->SetPremultipliedAlpha(true);
296 } 302 }
297 return; 303 return;
298 } 304 }
299 // Should not be reached. 305 // Should not be reached.
300 NOTREACHED(); 306 NOTREACHED();
301 } 307 }
302 308
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 382
377 // If the host is not bound to the instance, return PP_OK immediately. 383 // If the host is not bound to the instance, return PP_OK immediately.
378 if (!bound_instance_) 384 if (!bound_instance_)
379 return PP_OK; 385 return PP_OK;
380 386
381 commit_layers_reply_context_ = context->MakeReplyMessageContext(); 387 commit_layers_reply_context_ = context->MakeReplyMessageContext();
382 return PP_OK_COMPLETIONPENDING; 388 return PP_OK_COMPLETIONPENDING;
383 } 389 }
384 390
385 } // namespace content 391 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698