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

Side by Side Diff: sky/engine/platform/graphics/Canvas2DLayerBridge.cpp

Issue 691663002: Unfork Sky's trace events (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 { 53 {
54 if (!gr) 54 if (!gr)
55 return nullptr; 55 return nullptr;
56 gr->resetContext(); 56 gr->resetContext();
57 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); 57 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height());
58 return adoptRef(SkSurface::NewRenderTarget(gr, info, msaaSampleCount)); 58 return adoptRef(SkSurface::NewRenderTarget(gr, info, msaaSampleCount));
59 } 59 }
60 60
61 PassRefPtr<Canvas2DLayerBridge> Canvas2DLayerBridge::create(const IntSize& size, OpacityMode opacityMode, int msaaSampleCount) 61 PassRefPtr<Canvas2DLayerBridge> Canvas2DLayerBridge::create(const IntSize& size, OpacityMode opacityMode, int msaaSampleCount)
62 { 62 {
63 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation"); 63 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_ SCOPE_NAME_PROCESS);
64 OwnPtr<WebGraphicsContext3DProvider> contextProvider = adoptPtr(Platform::cu rrent()->createSharedOffscreenGraphicsContext3DProvider()); 64 OwnPtr<WebGraphicsContext3DProvider> contextProvider = adoptPtr(Platform::cu rrent()->createSharedOffscreenGraphicsContext3DProvider());
65 if (!contextProvider) 65 if (!contextProvider)
66 return nullptr; 66 return nullptr;
67 RefPtr<SkSurface> surface(createSkSurface(contextProvider->grContext(), size , msaaSampleCount)); 67 RefPtr<SkSurface> surface(createSkSurface(contextProvider->grContext(), size , msaaSampleCount));
68 if (!surface) 68 if (!surface)
69 return nullptr; 69 return nullptr;
70 RefPtr<Canvas2DLayerBridge> layerBridge; 70 RefPtr<Canvas2DLayerBridge> layerBridge;
71 OwnPtr<SkDeferredCanvas> canvas = adoptPtr(SkDeferredCanvas::Create(surface. get())); 71 OwnPtr<SkDeferredCanvas> canvas = adoptPtr(SkDeferredCanvas::Create(surface. get()));
72 layerBridge = adoptRef(new Canvas2DLayerBridge(contextProvider.release(), ca nvas.release(), surface.release(), msaaSampleCount, opacityMode)); 72 layerBridge = adoptRef(new Canvas2DLayerBridge(contextProvider.release(), ca nvas.release(), surface.release(), msaaSampleCount, opacityMode));
73 return layerBridge.release(); 73 return layerBridge.release();
(...skipping 15 matching lines...) Expand all
89 , m_isHidden(false) 89 , m_isHidden(false)
90 , m_next(0) 90 , m_next(0)
91 , m_prev(0) 91 , m_prev(0)
92 , m_lastImageId(0) 92 , m_lastImageId(0)
93 , m_releasedMailboxInfoIndex(InvalidMailboxIndex) 93 , m_releasedMailboxInfoIndex(InvalidMailboxIndex)
94 { 94 {
95 ASSERT(m_canvas); 95 ASSERT(m_canvas);
96 ASSERT(m_surface); 96 ASSERT(m_surface);
97 ASSERT(m_contextProvider); 97 ASSERT(m_contextProvider);
98 // Used by browser tests to detect the use of a Canvas2DLayerBridge. 98 // Used by browser tests to detect the use of a Canvas2DLayerBridge.
99 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation"); 99 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_ SCOPE_NAME_PROCESS);
100 m_layer = adoptPtr(Platform::current()->compositorSupport()->createExternalT extureLayer(this)); 100 m_layer = adoptPtr(Platform::current()->compositorSupport()->createExternalT extureLayer(this));
101 m_layer->setOpaque(opacityMode == Opaque); 101 m_layer->setOpaque(opacityMode == Opaque);
102 m_layer->setBlendBackgroundColor(opacityMode != Opaque); 102 m_layer->setBlendBackgroundColor(opacityMode != Opaque);
103 GraphicsLayer::registerContentsLayer(m_layer->layer()); 103 GraphicsLayer::registerContentsLayer(m_layer->layer());
104 m_layer->setRateLimitContext(m_rateLimitingEnabled); 104 m_layer->setRateLimitContext(m_rateLimitingEnabled);
105 m_canvas->setNotificationClient(this); 105 m_canvas->setNotificationClient(this);
106 #ifndef NDEBUG 106 #ifndef NDEBUG
107 canvas2DLayerBridgeInstanceCounter.increment(); 107 canvas2DLayerBridgeInstanceCounter.increment();
108 #endif 108 #endif
109 } 109 }
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 // This copy constructor should only be used for Vector reallocation 567 // This copy constructor should only be used for Vector reallocation
568 // Assuming 'other' is to be destroyed, we transfer m_image and 568 // Assuming 'other' is to be destroyed, we transfer m_image and
569 // m_parentLayerBridge ownership rather than do a refcount dance. 569 // m_parentLayerBridge ownership rather than do a refcount dance.
570 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); 570 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox));
571 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); 571 m_image = const_cast<MailboxInfo*>(&other)->m_image.release();
572 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge. release(); 572 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge. release();
573 m_status = other.m_status; 573 m_status = other.m_status;
574 } 574 }
575 575
576 } // namespace blink 576 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/platform/TraceEvent.h ('k') | sky/engine/platform/graphics/OpaqueRectTrackingContentLayerDelegate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698