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

Side by Side Diff: cc/blink/web_external_texture_layer_impl.cc

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 5 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
« no previous file with comments | « cc/blink/web_external_texture_layer_impl.h ('k') | cc/layers/texture_layer.h » ('j') | 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 "cc/blink/web_external_texture_layer_impl.h" 5 #include "cc/blink/web_external_texture_layer_impl.h"
6 6
7 #include "cc/blink/web_external_bitmap_impl.h" 7 #include "cc/blink/web_external_bitmap_impl.h"
8 #include "cc/blink/web_layer_impl.h" 8 #include "cc/blink/web_layer_impl.h"
9 #include "cc/layers/texture_layer.h" 9 #include "cc/layers/texture_layer.h"
10 #include "cc/resources/single_release_callback.h" 10 #include "cc/resources/single_release_callback.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 if (!client_->prepareMailbox(&client_mailbox, bitmap)) { 74 if (!client_->prepareMailbox(&client_mailbox, bitmap)) {
75 if (bitmap) 75 if (bitmap)
76 free_bitmaps_.push_back(bitmap); 76 free_bitmaps_.push_back(bitmap);
77 return false; 77 return false;
78 } 78 }
79 gpu::Mailbox name; 79 gpu::Mailbox name;
80 name.SetName(client_mailbox.name); 80 name.SetName(client_mailbox.name);
81 if (bitmap) { 81 if (bitmap) {
82 *mailbox = cc::TextureMailbox(bitmap->shared_bitmap(), bitmap->size()); 82 *mailbox = cc::TextureMailbox(bitmap->shared_bitmap(), bitmap->size());
83 } else { 83 } else {
84 gpu::SyncToken sync_token;
85 static_assert(sizeof(sync_token) <= sizeof(client_mailbox.syncToken),
86 "Size of web external sync token too small.");
87 if (client_mailbox.validSyncToken)
88 memcpy(&sync_token, client_mailbox.syncToken, sizeof(sync_token));
89
84 // TODO(achaulk): pass a valid size here if allowOverlay is set. 90 // TODO(achaulk): pass a valid size here if allowOverlay is set.
85 *mailbox = cc::TextureMailbox(name, GL_TEXTURE_2D, client_mailbox.syncPoint, 91 *mailbox = cc::TextureMailbox(name, sync_token, GL_TEXTURE_2D, gfx::Size(),
86 gfx::Size(), client_mailbox.allowOverlay); 92 client_mailbox.allowOverlay);
87 } 93 }
88 mailbox->set_nearest_neighbor(client_mailbox.nearestNeighbor); 94 mailbox->set_nearest_neighbor(client_mailbox.nearestNeighbor);
89 95
90 if (mailbox->IsValid()) { 96 if (mailbox->IsValid()) {
91 *release_callback = cc::SingleReleaseCallback::Create( 97 *release_callback = cc::SingleReleaseCallback::Create(
92 base::Bind(&WebExternalTextureLayerImpl::DidReleaseMailbox, 98 base::Bind(&WebExternalTextureLayerImpl::DidReleaseMailbox,
93 this->AsWeakPtr(), 99 this->AsWeakPtr(),
94 client_mailbox, 100 client_mailbox,
95 bitmap)); 101 bitmap));
96 } 102 }
97 103
98 return true; 104 return true;
99 } 105 }
100 106
101 WebExternalBitmapImpl* WebExternalTextureLayerImpl::AllocateBitmap() { 107 WebExternalBitmapImpl* WebExternalTextureLayerImpl::AllocateBitmap() {
102 if (!free_bitmaps_.empty()) { 108 if (!free_bitmaps_.empty()) {
103 WebExternalBitmapImpl* result = free_bitmaps_.back(); 109 WebExternalBitmapImpl* result = free_bitmaps_.back();
104 free_bitmaps_.weak_erase(free_bitmaps_.end() - 1); 110 free_bitmaps_.weak_erase(free_bitmaps_.end() - 1);
105 return result; 111 return result;
106 } 112 }
107 return new WebExternalBitmapImpl; 113 return new WebExternalBitmapImpl;
108 } 114 }
109 115
110 // static 116 // static
111 void WebExternalTextureLayerImpl::DidReleaseMailbox( 117 void WebExternalTextureLayerImpl::DidReleaseMailbox(
112 base::WeakPtr<WebExternalTextureLayerImpl> layer, 118 base::WeakPtr<WebExternalTextureLayerImpl> layer,
113 const blink::WebExternalTextureMailbox& mailbox, 119 const blink::WebExternalTextureMailbox& mailbox,
114 WebExternalBitmapImpl* bitmap, 120 WebExternalBitmapImpl* bitmap,
115 unsigned sync_point, 121 const gpu::SyncToken& sync_token,
116 bool lost_resource) { 122 bool lost_resource) {
117 DCHECK(layer); 123 DCHECK(layer);
118 blink::WebExternalTextureMailbox available_mailbox; 124 blink::WebExternalTextureMailbox available_mailbox;
125 static_assert(sizeof(sync_token) <= sizeof(available_mailbox.syncToken),
126 "Size of web external sync token too small.");
119 memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name)); 127 memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name));
120 available_mailbox.syncPoint = sync_point; 128 memcpy(available_mailbox.syncToken, sync_token.GetConstData(),
129 sizeof(sync_token));
130 available_mailbox.validSyncToken = sync_token.HasData();
121 if (bitmap) 131 if (bitmap)
122 layer->free_bitmaps_.push_back(bitmap); 132 layer->free_bitmaps_.push_back(bitmap);
123 layer->client_->mailboxReleased(available_mailbox, lost_resource); 133 layer->client_->mailboxReleased(available_mailbox, lost_resource);
124 } 134 }
125 135
126 } // namespace cc_blink 136 } // namespace cc_blink
OLDNEW
« no previous file with comments | « cc/blink/web_external_texture_layer_impl.h ('k') | cc/layers/texture_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698