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

Side by Side Diff: gpu/command_buffer/service/async_pixel_transfer_manager.cc

Issue 16325018: GPU: Factory produces APTManagers instead of APTDelegates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "gpu/command_buffer/service/async_pixel_transfer_manager.h" 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager.h"
6 6
7 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" 7 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h"
8 8
9 namespace gpu { 9 namespace gpu {
10 10
11 AsyncPixelTransferManager::AsyncPixelTransferManager( 11 AsyncPixelTransferManager::AsyncPixelTransferManager() {}
12 gles2::TextureManager* manager,
13 gfx::GLContext* context)
14 : manager_(manager),
15 delegate_(AsyncPixelTransferDelegate::Create(context)) {
16 manager_->AddObserver(this);
17 }
18 12
19 AsyncPixelTransferManager::~AsyncPixelTransferManager() { 13 AsyncPixelTransferManager::~AsyncPixelTransferManager() {
20 if (manager_) 14 if (manager_)
21 manager_->RemoveObserver(this); 15 manager_->RemoveObserver(this);
22 } 16 }
23 17
18 void AsyncPixelTransferManager::Initialize(gles2::TextureManager* manager) {
19 manager_ = manager;
20 manager_->AddObserver(this);
21 }
22
24 AsyncPixelTransferState* AsyncPixelTransferManager::CreatePixelTransferState( 23 AsyncPixelTransferState* AsyncPixelTransferManager::CreatePixelTransferState(
25 gles2::TextureRef* ref, 24 gles2::TextureRef* ref,
26 const AsyncTexImage2DParams& define_params) { 25 const AsyncTexImage2DParams& define_params) {
27 DCHECK(!GetPixelTransferState(ref)); 26 DCHECK(!GetPixelTransferState(ref));
28 AsyncPixelTransferState* state = delegate_->CreatePixelTransferState( 27 AsyncPixelTransferState* state =
29 ref->texture()->service_id(), define_params); 28 GetAsyncPixelTransferDelegate()->CreatePixelTransferState(
29 ref->texture()->service_id(), define_params);
30 state_map_[ref] = state; 30 state_map_[ref] = state;
31 return state; 31 return state;
32 } 32 }
33 33
34 AsyncPixelTransferState* 34 AsyncPixelTransferState*
35 AsyncPixelTransferManager::GetPixelTransferState( 35 AsyncPixelTransferManager::GetPixelTransferState(
36 gles2::TextureRef* ref) { 36 gles2::TextureRef* ref) {
37 TextureToStateMap::iterator it = state_map_.find(ref); 37 TextureToStateMap::iterator it = state_map_.find(ref);
38 if (it == state_map_.end()) { 38 if (it == state_map_.end()) {
39 return NULL; 39 return NULL;
(...skipping 23 matching lines...) Expand all
63 } 63 }
64 64
65 void AsyncPixelTransferManager::OnTextureRefDestroying( 65 void AsyncPixelTransferManager::OnTextureRefDestroying(
66 gles2::TextureRef* texture) { 66 gles2::TextureRef* texture) {
67 TextureToStateMap::iterator it = state_map_.find(texture); 67 TextureToStateMap::iterator it = state_map_.find(texture);
68 if (it != state_map_.end()) 68 if (it != state_map_.end())
69 state_map_.erase(it); 69 state_map_.erase(it);
70 } 70 }
71 71
72 } // namespace gpu 72 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698