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 "ui/gl/async_pixel_transfer_delegate_android.h" | 5 #include "ui/gl/async_pixel_transfer_delegate_android.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/process_util.h" | 14 #include "base/process_util.h" |
| 15 #include "base/shared_memory.h" | 15 #include "base/shared_memory.h" |
| 16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "third_party/angle/include/EGL/egl.h" | 18 #include "third_party/angle/include/EGL/egl.h" |
| 19 #include "third_party/angle/include/EGL/eglext.h" | 19 #include "third_party/angle/include/EGL/eglext.h" |
| 20 #include "ui/gl/async_pixel_transfer_delegate.h" | 20 #include "ui/gl/async_pixel_transfer_delegate.h" |
| 21 #include "ui/gl/async_pixel_transfer_delegate_stub.h" | 21 #include "ui/gl/async_pixel_transfer_delegate_stub.h" |
| 22 #include "ui/gl/egl_util.h" | 22 #include "ui/gl/egl_util.h" |
| 23 #include "ui/gl/gl_bindings.h" | 23 #include "ui/gl/gl_bindings.h" |
| 24 #include "ui/gl/gl_context.h" | 24 #include "ui/gl/gl_context.h" |
| 25 #include "ui/gl/gl_surface_egl.h" | 25 #include "ui/gl/gl_surface_egl.h" |
| 26 | 26 |
| 27 #if defined(OS_ANDROID) | |
|
apatrick_chromium
2013/01/22 21:49:18
You don't need the ifdef here right? This is an An
epenner
2013/01/23 00:28:46
Thanks. I just left the comment and removed #ifdef
| |
| 28 // TODO(epenner): Move thread priorities to base. (crbug.com/170549) | |
| 29 #include <sys/resource.h> | |
| 30 #endif | |
| 31 | |
| 27 using base::SharedMemory; | 32 using base::SharedMemory; |
| 28 using base::SharedMemoryHandle; | 33 using base::SharedMemoryHandle; |
| 29 | 34 |
| 30 namespace gfx { | 35 namespace gfx { |
| 31 | 36 |
| 32 namespace { | 37 namespace { |
| 33 | 38 |
| 34 const char kAsyncTransferThreadName[] = "AsyncTransferThread"; | 39 const char kAsyncTransferThreadName[] = "AsyncTransferThread"; |
| 35 | 40 |
| 36 bool CheckErrors(const char* file, int line) { | 41 bool CheckErrors(const char* file, int line) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 virtual void Init() OVERRIDE { | 95 virtual void Init() OVERRIDE { |
| 91 GLShareGroup* share_group = NULL; | 96 GLShareGroup* share_group = NULL; |
| 92 bool software = false; | 97 bool software = false; |
| 93 surface_ = new gfx::PbufferGLSurfaceEGL(software, gfx::Size(1,1)); | 98 surface_ = new gfx::PbufferGLSurfaceEGL(software, gfx::Size(1,1)); |
| 94 surface_->Initialize(); | 99 surface_->Initialize(); |
| 95 context_ = gfx::GLContext::CreateGLContext(share_group, | 100 context_ = gfx::GLContext::CreateGLContext(share_group, |
| 96 surface_, | 101 surface_, |
| 97 gfx::PreferDiscreteGpu); | 102 gfx::PreferDiscreteGpu); |
| 98 bool is_current = context_->MakeCurrent(surface_); | 103 bool is_current = context_->MakeCurrent(surface_); |
| 99 DCHECK(is_current); | 104 DCHECK(is_current); |
| 105 | |
| 106 #if defined(OS_ANDROID) | |
|
apatrick_chromium
2013/01/22 21:49:18
or here?
epenner
2013/01/23 00:28:46
Done.
| |
| 107 // TODO(epenner): Move thread priorities to base. (crbug.com/170549) | |
| 108 int nice_value = 10; // Idle priority. | |
| 109 setpriority(PRIO_PROCESS, base::PlatformThread::CurrentId(), nice_value); | |
| 110 #endif | |
| 100 } | 111 } |
| 101 | 112 |
| 102 virtual void CleanUp() OVERRIDE { | 113 virtual void CleanUp() OVERRIDE { |
| 103 surface_ = NULL; | 114 surface_ = NULL; |
| 104 context_->ReleaseCurrent(surface_); | 115 context_->ReleaseCurrent(surface_); |
| 105 context_ = NULL; | 116 context_ = NULL; |
| 106 } | 117 } |
| 107 | 118 |
| 108 private: | 119 private: |
| 109 scoped_refptr<gfx::GLContext> context_; | 120 scoped_refptr<gfx::GLContext> context_; |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 616 tex_params.type, | 627 tex_params.type, |
| 617 data); | 628 data); |
| 618 } | 629 } |
| 619 WaitForGl(); | 630 WaitForGl(); |
| 620 | 631 |
| 621 DCHECK(CHECK_GL()); | 632 DCHECK(CHECK_GL()); |
| 622 state->last_transfer_time_ = base::TimeTicks::HighResNow() - begin_time; | 633 state->last_transfer_time_ = base::TimeTicks::HighResNow() - begin_time; |
| 623 } | 634 } |
| 624 | 635 |
| 625 } // namespace gfx | 636 } // namespace gfx |
| OLD | NEW |