ソースを参照

Kernel: Make File weakable

This will be useful for some things. This also removes the need for
TCPSocket to be special about this.
Andreas Kling 4 年 前
コミット
48a0b76a77
2 ファイル変更5 行追加3 行削除
  1. 4 1
      Kernel/FileSystem/File.h
  2. 1 2
      Kernel/Net/TCPSocket.h

+ 4 - 1
Kernel/FileSystem/File.h

@@ -30,6 +30,7 @@
 #include <AK/RefCounted.h>
 #include <AK/String.h>
 #include <AK/Types.h>
+#include <AK/Weakable.h>
 #include <Kernel/Forward.h>
 #include <Kernel/KResult.h>
 #include <Kernel/UnixTypes.h>
@@ -64,7 +65,9 @@ namespace Kernel {
 //   - Called by mmap() when userspace wants to memory-map this File somewhere.
 //   - Should create a Region in the Process and return it if successful.
 
-class File : public RefCounted<File> {
+class File
+    : public RefCounted<File>
+    , public Weakable<File> {
 public:
     virtual ~File();
 

+ 1 - 2
Kernel/Net/TCPSocket.h

@@ -34,8 +34,7 @@
 
 namespace Kernel {
 
-class TCPSocket final : public IPv4Socket
-    , public Weakable<TCPSocket> {
+class TCPSocket final : public IPv4Socket {
 public:
     static void for_each(Function<void(const TCPSocket&)>);
     static NonnullRefPtr<TCPSocket> create(int protocol);