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

Side by Side Diff: ui/gl/gpu_switching_manager.cc

Issue 1917973002: mac: Remove IsOSLion(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tapted Created 4 years, 7 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
« no previous file with comments | « ui/gfx/mac/nswindow_frame_controls.mm ('k') | ui/views/cocoa/bridged_native_widget_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/gl/gpu_switching_manager.h" 5 #include "ui/gl/gpu_switching_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ui/gl/gl_switches.h" 10 #include "ui/gl/gl_switches.h"
11 11
12 #if defined(OS_MACOSX) 12 #if defined(OS_MACOSX)
13 #include <OpenGL/OpenGL.h> 13 #include <OpenGL/OpenGL.h>
14 #include "base/mac/mac_util.h"
15 #include "ui/gl/gl_context_cgl.h" 14 #include "ui/gl/gl_context_cgl.h"
16 #endif // OS_MACOSX 15 #endif // OS_MACOSX
17 16
18 namespace ui { 17 namespace ui {
19 18
20 struct GpuSwitchingManager::PlatformSpecific { 19 struct GpuSwitchingManager::PlatformSpecific {
21 #if defined(OS_MACOSX) 20 #if defined(OS_MACOSX)
22 CGLPixelFormatObj discrete_pixel_format; 21 CGLPixelFormatObj discrete_pixel_format;
23 #endif // OS_MACOSX 22 #endif // OS_MACOSX
24 }; 23 };
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } else { 89 } else {
91 // Browser process. 90 // Browser process.
92 // We only compute this flag in the browser process. 91 // We only compute this flag in the browser process.
93 #if defined(OS_MACOSX) 92 #if defined(OS_MACOSX)
94 flag = (vendor_ids_.size() == 2); 93 flag = (vendor_ids_.size() == 2);
95 if (flag && command_line.HasSwitch(switches::kUseGL) && 94 if (flag && command_line.HasSwitch(switches::kUseGL) &&
96 command_line.GetSwitchValueASCII(switches::kUseGL) != 95 command_line.GetSwitchValueASCII(switches::kUseGL) !=
97 gfx::kGLImplementationDesktopName) 96 gfx::kGLImplementationDesktopName)
98 flag = false; 97 flag = false;
99 98
100 if (flag && !base::mac::IsOSLionOrLater())
101 flag = false;
102
103 if (flag) { 99 if (flag) {
104 // Only advertise that we have two GPUs to the rest of 100 // Only advertise that we have two GPUs to the rest of
105 // Chrome's code if we find an Intel GPU and some other 101 // Chrome's code if we find an Intel GPU and some other
106 // vendor's GPU. Otherwise we don't understand the 102 // vendor's GPU. Otherwise we don't understand the
107 // configuration and don't deal well with it (an example being 103 // configuration and don't deal well with it (an example being
108 // the dual AMD GPUs in recent Mac Pros). 104 // the dual AMD GPUs in recent Mac Pros).
109 const uint32_t intel = 0x8086; 105 const uint32_t intel = 0x8086;
110 flag = ((vendor_ids_[0] == intel && vendor_ids_[1] != intel) || 106 flag = ((vendor_ids_[0] == intel && vendor_ids_[1] != intel) ||
111 (vendor_ids_[0] != intel && vendor_ids_[1] == intel)); 107 (vendor_ids_[0] != intel && vendor_ids_[1] == intel));
112 } 108 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 return; 144 return;
149 CGLPixelFormatAttribute attribs[1]; 145 CGLPixelFormatAttribute attribs[1];
150 attribs[0] = static_cast<CGLPixelFormatAttribute>(0); 146 attribs[0] = static_cast<CGLPixelFormatAttribute>(0);
151 GLint num_pixel_formats = 0; 147 GLint num_pixel_formats = 0;
152 CGLChoosePixelFormat(attribs, &platform_specific_->discrete_pixel_format, 148 CGLChoosePixelFormat(attribs, &platform_specific_->discrete_pixel_format,
153 &num_pixel_formats); 149 &num_pixel_formats);
154 } 150 }
155 #endif // OS_MACOSX 151 #endif // OS_MACOSX
156 152
157 } // namespace ui 153 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/mac/nswindow_frame_controls.mm ('k') | ui/views/cocoa/bridged_native_widget_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698