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

Side by Side Diff: Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp

Issue 61773005: Rename WebKit namespace to blink (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 21 matching lines...) Expand all
32 #include "SkSurface.h" 32 #include "SkSurface.h"
33 #include "core/platform/graphics/GraphicsContext3D.h" 33 #include "core/platform/graphics/GraphicsContext3D.h"
34 #include "core/platform/graphics/GraphicsLayer.h" 34 #include "core/platform/graphics/GraphicsLayer.h"
35 #include "core/platform/graphics/chromium/Canvas2DLayerManager.h" 35 #include "core/platform/graphics/chromium/Canvas2DLayerManager.h"
36 #include "core/platform/graphics/gpu/SharedGraphicsContext3D.h" 36 #include "core/platform/graphics/gpu/SharedGraphicsContext3D.h"
37 #include "platform/TraceEvent.h" 37 #include "platform/TraceEvent.h"
38 #include "public/platform/Platform.h" 38 #include "public/platform/Platform.h"
39 #include "public/platform/WebCompositorSupport.h" 39 #include "public/platform/WebCompositorSupport.h"
40 #include "public/platform/WebGraphicsContext3D.h" 40 #include "public/platform/WebGraphicsContext3D.h"
41 41
42 using WebKit::WebExternalTextureLayer; 42 using blink::WebExternalTextureLayer;
43 using WebKit::WebGraphicsContext3D; 43 using blink::WebGraphicsContext3D;
44 44
45 namespace WebCore { 45 namespace WebCore {
46 46
47 void Canvas2DLayerBridgePtr::clear() 47 void Canvas2DLayerBridgePtr::clear()
48 { 48 {
49 if (m_ptr) { 49 if (m_ptr) {
50 m_ptr->destroy(); 50 m_ptr->destroy();
51 m_ptr.clear(); 51 m_ptr.clear();
52 } 52 }
53 } 53 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 , m_framesPending(0) 96 , m_framesPending(0)
97 , m_destructionInProgress(false) 97 , m_destructionInProgress(false)
98 , m_rateLimitingEnabled(false) 98 , m_rateLimitingEnabled(false)
99 , m_next(0) 99 , m_next(0)
100 , m_prev(0) 100 , m_prev(0)
101 , m_lastImageId(0) 101 , m_lastImageId(0)
102 { 102 {
103 ASSERT(m_canvas); 103 ASSERT(m_canvas);
104 // Used by browser tests to detect the use of a Canvas2DLayerBridge. 104 // Used by browser tests to detect the use of a Canvas2DLayerBridge.
105 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation"); 105 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation");
106 m_layer = adoptPtr(WebKit::Platform::current()->compositorSupport()->createE xternalTextureLayer(this)); 106 m_layer = adoptPtr(blink::Platform::current()->compositorSupport()->createEx ternalTextureLayer(this));
107 m_layer->setOpaque(opacityMode == Opaque); 107 m_layer->setOpaque(opacityMode == Opaque);
108 m_layer->setBlendBackgroundColor(opacityMode != Opaque); 108 m_layer->setBlendBackgroundColor(opacityMode != Opaque);
109 GraphicsLayer::registerContentsLayer(m_layer->layer()); 109 GraphicsLayer::registerContentsLayer(m_layer->layer());
110 m_layer->setRateLimitContext(m_rateLimitingEnabled); 110 m_layer->setRateLimitContext(m_rateLimitingEnabled);
111 m_canvas->setNotificationClient(this); 111 m_canvas->setNotificationClient(this);
112 } 112 }
113 113
114 Canvas2DLayerBridge::~Canvas2DLayerBridge() 114 Canvas2DLayerBridge::~Canvas2DLayerBridge()
115 { 115 {
116 ASSERT(m_destructionInProgress); 116 ASSERT(m_destructionInProgress);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // trigger subsequent retry. 268 // trigger subsequent retry.
269 m_surfaceIsValid = false; 269 m_surfaceIsValid = false;
270 } 270 }
271 } 271 }
272 } 272 }
273 if (!m_surfaceIsValid) 273 if (!m_surfaceIsValid)
274 setRateLimitingEnabled(false); 274 setRateLimitingEnabled(false);
275 return m_surfaceIsValid; 275 return m_surfaceIsValid;
276 } 276 }
277 277
278 bool Canvas2DLayerBridge::prepareMailbox(WebKit::WebExternalTextureMailbox* outM ailbox, WebKit::WebExternalBitmap* bitmap) 278 bool Canvas2DLayerBridge::prepareMailbox(blink::WebExternalTextureMailbox* outMa ilbox, blink::WebExternalBitmap* bitmap)
279 { 279 {
280 if (bitmap) { 280 if (bitmap) {
281 // Using accelerated 2d canvas with software renderer, which 281 // Using accelerated 2d canvas with software renderer, which
282 // should only happen in tests that use fake graphics contexts. 282 // should only happen in tests that use fake graphics contexts.
283 // In this case, we do not care about producing any results for 283 // In this case, we do not care about producing any results for
284 // compositing. 284 // compositing.
285 m_canvas->silentFlush(); 285 m_canvas->silentFlush();
286 return false; 286 return false;
287 } 287 }
288 if (!isValid()) 288 if (!isValid())
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // means there is a problem. 361 // means there is a problem.
362 // For the single-threaded case, this value needs to be at least 362 // For the single-threaded case, this value needs to be at least
363 // kMaxSwapBuffersPending+1 (in render_widget.h). 363 // kMaxSwapBuffersPending+1 (in render_widget.h).
364 // Because of crbug.com/247874, it needs to be kMaxSwapBuffersPending+2. 364 // Because of crbug.com/247874, it needs to be kMaxSwapBuffersPending+2.
365 // TODO(piman): fix this. 365 // TODO(piman): fix this.
366 ASSERT(m_mailboxes.size() <= 4); 366 ASSERT(m_mailboxes.size() <= 4);
367 ASSERT(mailboxInfo < m_mailboxes.end()); 367 ASSERT(mailboxInfo < m_mailboxes.end());
368 return mailboxInfo; 368 return mailboxInfo;
369 } 369 }
370 370
371 void Canvas2DLayerBridge::mailboxReleased(const WebKit::WebExternalTextureMailbo x& mailbox) 371 void Canvas2DLayerBridge::mailboxReleased(const blink::WebExternalTextureMailbox & mailbox)
372 { 372 {
373 Vector<MailboxInfo>::iterator mailboxInfo; 373 Vector<MailboxInfo>::iterator mailboxInfo;
374 for (mailboxInfo = m_mailboxes.begin(); mailboxInfo < m_mailboxes.end(); mai lboxInfo++) { 374 for (mailboxInfo = m_mailboxes.begin(); mailboxInfo < m_mailboxes.end(); mai lboxInfo++) {
375 if (!memcmp(mailboxInfo->m_mailbox.name, mailbox.name, sizeof(mailbox.na me))) { 375 if (!memcmp(mailboxInfo->m_mailbox.name, mailbox.name, sizeof(mailbox.na me))) {
376 mailboxInfo->m_mailbox.syncPoint = mailbox.syncPoint; 376 mailboxInfo->m_mailbox.syncPoint = mailbox.syncPoint;
377 ASSERT(mailboxInfo->m_status == MailboxInUse); 377 ASSERT(mailboxInfo->m_status == MailboxInUse);
378 mailboxInfo->m_status = MailboxReleased; 378 mailboxInfo->m_status = MailboxReleased;
379 // Trigger Canvas2DLayerBridge self-destruction if this is the 379 // Trigger Canvas2DLayerBridge self-destruction if this is the
380 // last live mailbox and the layer bridge is not externally 380 // last live mailbox and the layer bridge is not externally
381 // referenced. 381 // referenced.
382 ASSERT(mailboxInfo->m_parentLayerBridge.get() == this); 382 ASSERT(mailboxInfo->m_parentLayerBridge.get() == this);
383 mailboxInfo->m_parentLayerBridge.clear(); 383 mailboxInfo->m_parentLayerBridge.clear();
384 return; 384 return;
385 } 385 }
386 } 386 }
387 } 387 }
388 388
389 WebKit::WebLayer* Canvas2DLayerBridge::layer() 389 blink::WebLayer* Canvas2DLayerBridge::layer()
390 { 390 {
391 ASSERT(m_layer); 391 ASSERT(m_layer);
392 return m_layer->layer(); 392 return m_layer->layer();
393 } 393 }
394 394
395 void Canvas2DLayerBridge::contextAcquired() 395 void Canvas2DLayerBridge::contextAcquired()
396 { 396 {
397 ASSERT(!m_destructionInProgress); 397 ASSERT(!m_destructionInProgress);
398 Canvas2DLayerManager::get().layerDidDraw(this); 398 Canvas2DLayerManager::get().layerDidDraw(this);
399 m_didRecordDrawCommand = true; 399 m_didRecordDrawCommand = true;
(...skipping 17 matching lines...) Expand all
417 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { 417 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) {
418 // This copy constructor should only be used for Vector reallocation 418 // This copy constructor should only be used for Vector reallocation
419 // Assuming 'other' is to be destroyed, we swap m_image ownership 419 // Assuming 'other' is to be destroyed, we swap m_image ownership
420 // rather than do a refcount dance. 420 // rather than do a refcount dance.
421 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); 421 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox));
422 m_image.swap(const_cast<SkAutoTUnref<SkImage>*>(&other.m_image)); 422 m_image.swap(const_cast<SkAutoTUnref<SkImage>*>(&other.m_image));
423 m_status = other.m_status; 423 m_status = other.m_status;
424 } 424 }
425 425
426 } 426 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698