Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/pepper/ppb_graphics_3d_impl.h" | 5 #include "content/renderer/pepper/ppb_graphics_3d_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/feature_list.h" | 9 #include "base/feature_list.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 | 43 |
| 44 namespace content { | 44 namespace content { |
| 45 | 45 |
| 46 PPB_Graphics3D_Impl::PPB_Graphics3D_Impl(PP_Instance instance) | 46 PPB_Graphics3D_Impl::PPB_Graphics3D_Impl(PP_Instance instance) |
| 47 : PPB_Graphics3D_Shared(instance), | 47 : PPB_Graphics3D_Shared(instance), |
| 48 bound_to_instance_(false), | 48 bound_to_instance_(false), |
| 49 commit_pending_(false), | 49 commit_pending_(false), |
| 50 has_alpha_(false), | 50 has_alpha_(false), |
| 51 use_image_chromium_(false), | 51 use_image_chromium_(false), |
| 52 weak_ptr_factory_(this) { | 52 weak_ptr_factory_(this) { |
| 53 #if defined(OS_MACOSX) | 53 #if defined(OS_MACOSX) || defined(OS_CHROMEOS) |
|
Daniele Castagna
2017/01/14 22:55:49
Can you we remove the ifdef here now that the feat
reveman
2017/01/14 23:23:46
Done.
| |
| 54 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 54 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 55 bool use_image_chromium = | 55 bool use_image_chromium = |
| 56 !command_line->HasSwitch(switches::kDisablePepper3DImageChromium); | 56 !command_line->HasSwitch(switches::kDisablePepper3DImageChromium); |
| 57 | 57 |
| 58 if (use_image_chromium) { | 58 if (use_image_chromium) { |
| 59 use_image_chromium = | 59 use_image_chromium = |
| 60 base::FeatureList::IsEnabled(features::kPepper3DImageChromium); | 60 base::FeatureList::IsEnabled(features::kPepper3DImageChromium); |
| 61 } | 61 } |
| 62 use_image_chromium_ = use_image_chromium; | 62 use_image_chromium_ = use_image_chromium; |
| 63 #endif | 63 #endif |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 | 183 |
| 184 if (bound_to_instance_) { | 184 if (bound_to_instance_) { |
| 185 // If we are bound to the instance, we need to ask the compositor | 185 // If we are bound to the instance, we need to ask the compositor |
| 186 // to commit our backing texture so that the graphics appears on the page. | 186 // to commit our backing texture so that the graphics appears on the page. |
| 187 // When the backing texture will be committed we get notified via | 187 // When the backing texture will be committed we get notified via |
| 188 // ViewFlushedPaint(). | 188 // ViewFlushedPaint(). |
| 189 // | 189 // |
| 190 // Don't need to check for NULL from GetPluginInstance since when we're | 190 // Don't need to check for NULL from GetPluginInstance since when we're |
| 191 // bound, we know our instance is valid. | 191 // bound, we know our instance is valid. |
| 192 bool is_overlay_candidate = use_image_chromium_; | 192 bool is_overlay_candidate = use_image_chromium_; |
| 193 GLenum target = | 193 cc::TextureMailbox texture_mailbox( |
| 194 is_overlay_candidate ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D; | 194 taken_front_buffer_, sync_token, |
| 195 cc::TextureMailbox texture_mailbox(taken_front_buffer_, sync_token, target, | 195 #if defined(OS_MACOSX) |
| 196 size, is_overlay_candidate, false); | 196 use_image_chromium_ ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D, |
| 197 #else | |
| 198 use_image_chromium_ ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D, | |
|
Daniele Castagna
2017/01/14 22:55:49
Should this be elif CHROME_OS?
Can we add a todo:
reveman
2017/01/14 23:23:46
Done. Avoiding the CHROMEOS ifdef as TEXTURE_EXTER
| |
| 199 #endif | |
| 200 size, is_overlay_candidate, false); | |
| 197 taken_front_buffer_.SetZero(); | 201 taken_front_buffer_.SetZero(); |
| 198 HostGlobals::Get() | 202 HostGlobals::Get() |
| 199 ->GetInstance(pp_instance()) | 203 ->GetInstance(pp_instance()) |
| 200 ->CommitTextureMailbox(texture_mailbox); | 204 ->CommitTextureMailbox(texture_mailbox); |
| 201 commit_pending_ = true; | 205 commit_pending_ = true; |
| 202 } else { | 206 } else { |
| 203 // Wait for the command to complete on the GPU to allow for throttling. | 207 // Wait for the command to complete on the GPU to allow for throttling. |
| 204 command_buffer_->SignalSyncToken( | 208 command_buffer_->SignalSyncToken( |
| 205 sync_token, base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers, | 209 sync_token, base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers, |
| 206 weak_ptr_factory_.GetWeakPtr())); | 210 weak_ptr_factory_.GetWeakPtr())); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 if (!mailboxes_to_reuse_.empty()) { | 360 if (!mailboxes_to_reuse_.empty()) { |
| 357 gpu::Mailbox mailbox = mailboxes_to_reuse_.back(); | 361 gpu::Mailbox mailbox = mailboxes_to_reuse_.back(); |
| 358 mailboxes_to_reuse_.pop_back(); | 362 mailboxes_to_reuse_.pop_back(); |
| 359 return mailbox; | 363 return mailbox; |
| 360 } | 364 } |
| 361 | 365 |
| 362 return gpu::Mailbox::Generate(); | 366 return gpu::Mailbox::Generate(); |
| 363 } | 367 } |
| 364 | 368 |
| 365 } // namespace content | 369 } // namespace content |
| OLD | NEW |