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

Side by Side Diff: ui/ozone/platform/drm/gpu/gpu_lock.cc

Issue 1141243002: [Ozone-Drm] Remove GPU lock (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/ozone/platform/drm/gpu/gpu_lock.h ('k') | ui/ozone/platform/drm/ozone_platform_drm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/ozone/platform/drm/gpu/gpu_lock.h"
6
7 #include <sys/file.h>
8 #include <unistd.h>
9
10 #include "base/logging.h"
11 #include "base/posix/eintr_wrapper.h"
12
13 namespace ui {
14
15 namespace {
16 const char kGpuLockFile[] = "/run/frecon";
17 }
18
19 GpuLock::GpuLock() {
20 fd_ = open(kGpuLockFile, O_RDWR);
21 if (fd_ < 0) {
22 PLOG(ERROR) << "Failed to open lock file '" << kGpuLockFile << "'";
23 return;
24 }
25
26 VLOG(1) << "Taking write lock on '" << kGpuLockFile << "'";
27 if (HANDLE_EINTR(flock(fd_, LOCK_EX)))
28 PLOG(ERROR) << "Error while trying to get lock on '" << kGpuLockFile << "'";
29
30 VLOG(1) << "Done trying to take write lock on '" << kGpuLockFile << "'";
31 }
32
33 GpuLock::~GpuLock() {
34 // Failed to open the lock file, so nothing to do here.
35 if (fd_ < 0)
36 return;
37
38 VLOG(1) << "Releasing write lock on '" << kGpuLockFile << "'";
39 close(fd_);
40 }
41
42 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/gpu_lock.h ('k') | ui/ozone/platform/drm/ozone_platform_drm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698