From 921019c48baee32431308001904bdd297c8d7865 Mon Sep 17 00:00:00 2001 From: nisse Date: Mon, 12 Dec 2016 23:55:56 -0800 Subject: [PATCH] Delete unused class AsyncFile. BUG=webrtc:6424 Review-Url: https://codereview.webrtc.org/2566953002 Cr-Commit-Position: refs/heads/master@{#15561} --- webrtc/base/BUILD.gn | 2 -- webrtc/base/asyncfile.cc | 21 ----------- webrtc/base/asyncfile.h | 40 --------------------- webrtc/base/physicalsocketserver.cc | 55 ----------------------------- webrtc/base/physicalsocketserver.h | 3 -- 5 files changed, 121 deletions(-) delete mode 100644 webrtc/base/asyncfile.cc delete mode 100644 webrtc/base/asyncfile.h diff --git a/webrtc/base/BUILD.gn b/webrtc/base/BUILD.gn index 02b8a1ad84..5f68157e76 100644 --- a/webrtc/base/BUILD.gn +++ b/webrtc/base/BUILD.gn @@ -388,8 +388,6 @@ rtc_static_library("rtc_base") { sources = [ "applefilesystem.mm", - "asyncfile.cc", - "asyncfile.h", "asyncinvoker-inl.h", "asyncinvoker.cc", "asyncinvoker.h", diff --git a/webrtc/base/asyncfile.cc b/webrtc/base/asyncfile.cc deleted file mode 100644 index ea904c554e..0000000000 --- a/webrtc/base/asyncfile.cc +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2010 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "webrtc/base/asyncfile.h" - -namespace rtc { - -AsyncFile::AsyncFile() { -} - -AsyncFile::~AsyncFile() { -} - -} // namespace rtc diff --git a/webrtc/base/asyncfile.h b/webrtc/base/asyncfile.h deleted file mode 100644 index dd46766880..0000000000 --- a/webrtc/base/asyncfile.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2004 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_BASE_ASYNCFILE_H__ -#define WEBRTC_BASE_ASYNCFILE_H__ - -#include "webrtc/base/sigslot.h" - -namespace rtc { - -// Provides the ability to perform file I/O asynchronously. -// TODO: Create a common base class with AsyncSocket. -class AsyncFile { - public: - AsyncFile(); - virtual ~AsyncFile(); - - // Determines whether the file will receive read events. - virtual bool readable() = 0; - virtual void set_readable(bool value) = 0; - - // Determines whether the file will receive write events. - virtual bool writable() = 0; - virtual void set_writable(bool value) = 0; - - sigslot::signal1 SignalReadEvent; - sigslot::signal1 SignalWriteEvent; - sigslot::signal2 SignalCloseEvent; -}; - -} // namespace rtc - -#endif // WEBRTC_BASE_ASYNCFILE_H__ diff --git a/webrtc/base/physicalsocketserver.cc b/webrtc/base/physicalsocketserver.cc index 2a48274fa0..bf2f2c64f8 100644 --- a/webrtc/base/physicalsocketserver.cc +++ b/webrtc/base/physicalsocketserver.cc @@ -1051,61 +1051,6 @@ class PosixSignalDispatcher : public Dispatcher { PhysicalSocketServer *owner_; }; -class FileDispatcher: public Dispatcher, public AsyncFile { - public: - FileDispatcher(int fd, PhysicalSocketServer *ss) : ss_(ss), fd_(fd) { - set_readable(true); - - ss_->Add(this); - - fcntl(fd_, F_SETFL, fcntl(fd_, F_GETFL, 0) | O_NONBLOCK); - } - - ~FileDispatcher() override { - ss_->Remove(this); - } - - SocketServer* socketserver() { return ss_; } - - int GetDescriptor() override { return fd_; } - - bool IsDescriptorClosed() override { return false; } - - uint32_t GetRequestedEvents() override { return flags_; } - - void OnPreEvent(uint32_t ff) override {} - - void OnEvent(uint32_t ff, int err) override { - if ((ff & DE_READ) != 0) - SignalReadEvent(this); - if ((ff & DE_WRITE) != 0) - SignalWriteEvent(this); - if ((ff & DE_CLOSE) != 0) - SignalCloseEvent(this, err); - } - - bool readable() override { return (flags_ & DE_READ) != 0; } - - void set_readable(bool value) override { - flags_ = value ? (flags_ | DE_READ) : (flags_ & ~DE_READ); - } - - bool writable() override { return (flags_ & DE_WRITE) != 0; } - - void set_writable(bool value) override { - flags_ = value ? (flags_ | DE_WRITE) : (flags_ & ~DE_WRITE); - } - - private: - PhysicalSocketServer* ss_; - int fd_; - int flags_; -}; - -AsyncFile* PhysicalSocketServer::CreateFile(int fd) { - return new FileDispatcher(fd, this); -} - #endif // WEBRTC_POSIX #if defined(WEBRTC_WIN) diff --git a/webrtc/base/physicalsocketserver.h b/webrtc/base/physicalsocketserver.h index 3437eb8cb3..462fab2b18 100644 --- a/webrtc/base/physicalsocketserver.h +++ b/webrtc/base/physicalsocketserver.h @@ -14,7 +14,6 @@ #include #include -#include "webrtc/base/asyncfile.h" #include "webrtc/base/nethelpers.h" #include "webrtc/base/socketserver.h" #include "webrtc/base/criticalsection.h" @@ -79,8 +78,6 @@ class PhysicalSocketServer : public SocketServer { void Remove(Dispatcher* dispatcher); #if defined(WEBRTC_POSIX) - AsyncFile* CreateFile(int fd); - // Sets the function to be executed in response to the specified POSIX signal. // The function is executed from inside Wait() using the "self-pipe trick"-- // regardless of which thread receives the signal--and hence can safely