OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Transport texture is a mechanism to share a texture between renderer process | 5 // Transport texture is a mechanism to share a texture between renderer process |
6 // and GPU process. This is useful when a texture is used in the renderer | 6 // and GPU process. This is useful when a texture is used in the renderer |
7 // process but updated in the GPU process. | 7 // process but updated in the GPU process. |
8 // | 8 // |
9 // BACKGROUND INFORMATION | 9 // BACKGROUND INFORMATION |
10 // | 10 // |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // // Do something with the texture. | 45 // // Do something with the texture. |
46 // } | 46 // } |
47 // } | 47 // } |
48 // | 48 // |
49 // TransportTextureHost factory_host; | 49 // TransportTextureHost factory_host; |
50 // TextureUpdateHandler handler; | 50 // TextureUpdateHandler handler; |
51 // | 51 // |
52 // void MyObjectInitDone() { | 52 // void MyObjectInitDone() { |
53 // std::vector<int> textures; | 53 // std::vector<int> textures; |
54 // factory_host.GetTextures( | 54 // factory_host.GetTextures( |
55 // NewCallback(&handler, &TextureUpdateHandler::OnTextureUpdate), | 55 // base::Bind(&TextureUpdateHandler::OnTextureUpdate, &handler), |
56 // &textures); | 56 // &textures); |
57 // } | 57 // } |
58 // | 58 // |
59 // void InitDone() { | 59 // void InitDone() { |
60 // InitMyObjectInGPUProcess(factory_host.GetPeerId(), | 60 // InitMyObjectInGPUProcess(factory_host.GetPeerId(), |
61 // NewRunnableFunction(&MyObjectInitDone)); | 61 // base::Bind(&MyObjectInitDone)); |
62 // } | 62 // } |
63 // | 63 // |
64 // factory_host.Init(NewRunnableFunction(&InitDone)); | 64 // factory_host.Init(base::Bind(&InitDone)); |
65 // | 65 // |
66 // ---------------------- | 66 // ---------------------- |
67 // | In the GPU process | | 67 // | In the GPU process | |
68 // ---------------------- | 68 // ---------------------- |
69 // | 69 // |
70 // // When the transport texture factory id is known. | 70 // // When the transport texture factory id is known. |
71 // TransportTexture* factory = gpu_channel->GetTransportTexture(id); | 71 // TransportTexture* factory = gpu_channel->GetTransportTexture(id); |
72 // | 72 // |
73 // void TextureCreateDone(vector<int> textures) { | 73 // void TextureCreateDone(vector<int> textures) { |
74 // // Send message to renderer saying init is done. | 74 // // Send message to renderer saying init is done. |
75 // SendInitDone(); | 75 // SendInitDone(); |
76 // | 76 // |
77 // UpdateTextureContent(textures[0]); | 77 // UpdateTextureContent(textures[0]); |
78 // factory->TextureUpdated(textures[0]); | 78 // factory->TextureUpdated(textures[0]); |
79 // } | 79 // } |
80 // | 80 // |
81 // // When init is requested from renderer. | 81 // // When init is requested from renderer. |
82 // vector<int> textures; | 82 // vector<int> textures; |
83 // | 83 // |
84 // void OnInit() { | 84 // void OnInit() { |
85 // factory->CreateTextures(3, 1024, 768, TransportTexture::RGB, &textures, | 85 // factory->CreateTextures(3, 1024, 768, TransportTexture::RGB, &textures, |
86 // NewRunnableFunction(&TextureCreateDone), | 86 // base::Bind(&TextureCreateDone), textures); |
87 // textures); | |
88 // } | 87 // } |
89 | 88 |
90 #ifndef CONTENT_RENDERER_GPU_TRANSPORT_TEXTURE_HOST_H_ | 89 #ifndef CONTENT_RENDERER_GPU_TRANSPORT_TEXTURE_HOST_H_ |
91 #define CONTENT_RENDERER_GPU_TRANSPORT_TEXTURE_HOST_H_ | 90 #define CONTENT_RENDERER_GPU_TRANSPORT_TEXTURE_HOST_H_ |
92 | 91 |
93 #include <vector> | 92 #include <vector> |
94 | 93 |
95 #include "base/basictypes.h" | 94 #include "base/basictypes.h" |
96 #include "base/callback_old.h" | 95 #include "base/callback_old.h" |
97 #include "base/memory/ref_counted.h" | 96 #include "base/memory/ref_counted.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // A list of textures generated. | 187 // A list of textures generated. |
189 std::vector<int> textures_; | 188 std::vector<int> textures_; |
190 | 189 |
191 // Callback when a texture is updated. | 190 // Callback when a texture is updated. |
192 scoped_ptr<TextureUpdateCallback> update_callback_; | 191 scoped_ptr<TextureUpdateCallback> update_callback_; |
193 | 192 |
194 DISALLOW_COPY_AND_ASSIGN(TransportTextureHost); | 193 DISALLOW_COPY_AND_ASSIGN(TransportTextureHost); |
195 }; | 194 }; |
196 | 195 |
197 #endif // CONTENT_RENDERER_GPU_TRANSPORT_TEXTURE_HOST_H_ | 196 #endif // CONTENT_RENDERER_GPU_TRANSPORT_TEXTURE_HOST_H_ |
OLD | NEW |