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

Side by Side Diff: content/renderer/pepper/ppb_graphics_3d_impl.cc

Issue 2632903002: gpu: Pepper3DImageChromium support on ChromeOS. (Closed)
Patch Set: remove ifdef and add todo Created 3 years, 11 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
OLDNEW
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 30 matching lines...) Expand all
41 using blink::WebPluginContainer; 41 using blink::WebPluginContainer;
42 using blink::WebString; 42 using blink::WebString;
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_(
52 weak_ptr_factory_(this) { 52 !base::CommandLine::ForCurrentProcess()->HasSwitch(
53 #if defined(OS_MACOSX) 53 switches::kDisablePepper3DImageChromium) &&
54 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 54 base::FeatureList::IsEnabled(features::kPepper3DImageChromium)),
55 bool use_image_chromium = 55 weak_ptr_factory_(this) {}
56 !command_line->HasSwitch(switches::kDisablePepper3DImageChromium);
57
58 if (use_image_chromium) {
59 use_image_chromium =
60 base::FeatureList::IsEnabled(features::kPepper3DImageChromium);
61 }
62 use_image_chromium_ = use_image_chromium;
63 #endif
64 }
65 56
66 PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { 57 PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() {
67 // Unset the client before the command_buffer_ is destroyed, similar to how 58 // Unset the client before the command_buffer_ is destroyed, similar to how
68 // WeakPtrFactory invalidates before it. 59 // WeakPtrFactory invalidates before it.
69 if (command_buffer_) 60 if (command_buffer_)
70 command_buffer_->SetGpuControlClient(nullptr); 61 command_buffer_->SetGpuControlClient(nullptr);
71 } 62 }
72 63
73 // static 64 // static
74 PP_Resource PPB_Graphics3D_Impl::CreateRaw( 65 PP_Resource PPB_Graphics3D_Impl::CreateRaw(
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 174
184 if (bound_to_instance_) { 175 if (bound_to_instance_) {
185 // If we are bound to the instance, we need to ask the compositor 176 // 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. 177 // 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 178 // When the backing texture will be committed we get notified via
188 // ViewFlushedPaint(). 179 // ViewFlushedPaint().
189 // 180 //
190 // Don't need to check for NULL from GetPluginInstance since when we're 181 // Don't need to check for NULL from GetPluginInstance since when we're
191 // bound, we know our instance is valid. 182 // bound, we know our instance is valid.
192 bool is_overlay_candidate = use_image_chromium_; 183 bool is_overlay_candidate = use_image_chromium_;
193 GLenum target = 184 cc::TextureMailbox texture_mailbox(
194 is_overlay_candidate ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D; 185 taken_front_buffer_, sync_token,
195 cc::TextureMailbox texture_mailbox(taken_front_buffer_, sync_token, target, 186 // TODO(reveman): Get texture target from browser process.
196 size, is_overlay_candidate, false); 187 #if defined(OS_MACOSX)
188 use_image_chromium_ ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D,
189 #else
190 use_image_chromium_ ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D,
191 #endif
192 size, is_overlay_candidate, false);
197 taken_front_buffer_.SetZero(); 193 taken_front_buffer_.SetZero();
198 HostGlobals::Get() 194 HostGlobals::Get()
199 ->GetInstance(pp_instance()) 195 ->GetInstance(pp_instance())
200 ->CommitTextureMailbox(texture_mailbox); 196 ->CommitTextureMailbox(texture_mailbox);
201 commit_pending_ = true; 197 commit_pending_ = true;
202 } else { 198 } else {
203 // Wait for the command to complete on the GPU to allow for throttling. 199 // Wait for the command to complete on the GPU to allow for throttling.
204 command_buffer_->SignalSyncToken( 200 command_buffer_->SignalSyncToken(
205 sync_token, base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers, 201 sync_token, base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers,
206 weak_ptr_factory_.GetWeakPtr())); 202 weak_ptr_factory_.GetWeakPtr()));
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 if (!mailboxes_to_reuse_.empty()) { 352 if (!mailboxes_to_reuse_.empty()) {
357 gpu::Mailbox mailbox = mailboxes_to_reuse_.back(); 353 gpu::Mailbox mailbox = mailboxes_to_reuse_.back();
358 mailboxes_to_reuse_.pop_back(); 354 mailboxes_to_reuse_.pop_back();
359 return mailbox; 355 return mailbox;
360 } 356 }
361 357
362 return gpu::Mailbox::Generate(); 358 return gpu::Mailbox::Generate();
363 } 359 }
364 360
365 } // namespace content 361 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/ppb_graphics_3d_impl.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698