Rename namespace dawn_wire to dawn::wire.

But keep a namespace alias to avoid breaking project that depend on the
previous namespace name while they get updated.

Bug: dawn:824
Change-Id: I1e99c4d0d2acf7644a225a88d07806d1a64478e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75540
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2022-01-11 09:57:33 +00:00 committed by Dawn LUCI CQ
parent f07477a1ce
commit 5d846ab503
91 changed files with 202 additions and 198 deletions

View File

@ -86,8 +86,8 @@ static utils::BackendBinding* binding = nullptr;
static GLFWwindow* window = nullptr;
static dawn_wire::WireServer* wireServer = nullptr;
static dawn_wire::WireClient* wireClient = nullptr;
static dawn::wire::WireServer* wireServer = nullptr;
static dawn::wire::WireClient* wireClient = nullptr;
static utils::TerribleCommandBuffer* c2sBuf = nullptr;
static utils::TerribleCommandBuffer* s2cBuf = nullptr;
@ -149,18 +149,18 @@ wgpu::Device CreateCppDawnDevice() {
c2sBuf = new utils::TerribleCommandBuffer();
s2cBuf = new utils::TerribleCommandBuffer();
dawn_wire::WireServerDescriptor serverDesc = {};
dawn::wire::WireServerDescriptor serverDesc = {};
serverDesc.procs = &backendProcs;
serverDesc.serializer = s2cBuf;
wireServer = new dawn_wire::WireServer(serverDesc);
wireServer = new dawn::wire::WireServer(serverDesc);
c2sBuf->SetHandler(wireServer);
dawn_wire::WireClientDescriptor clientDesc = {};
dawn::wire::WireClientDescriptor clientDesc = {};
clientDesc.serializer = c2sBuf;
wireClient = new dawn_wire::WireClient(clientDesc);
procs = dawn_wire::client::GetProcs();
wireClient = new dawn::wire::WireClient(clientDesc);
procs = dawn::wire::client::GetProcs();
s2cBuf->SetHandler(wireClient);
auto deviceReservation = wireClient->ReserveDevice();

View File

@ -17,7 +17,7 @@
#include "common/ityp_array.h"
namespace dawn_wire {
namespace dawn::wire {
enum class ObjectType : uint32_t {
{% for type in by_category["object"] %}
@ -28,7 +28,7 @@ namespace dawn_wire {
template <typename T>
using PerObjectType = ityp::array<ObjectType, T, {{len(by_category["object"])}}>;
} // namespace dawn_wire
} // namespace dawn::wire
#endif // DAWNWIRE_OBJECTTPYE_AUTOGEN_H_

View File

@ -649,7 +649,7 @@
}
{% endmacro %}
namespace dawn_wire {
namespace dawn::wire {
ObjectHandle::ObjectHandle() = default;
ObjectHandle::ObjectHandle(ObjectId id, ObjectGeneration generation)
@ -852,4 +852,4 @@ namespace dawn_wire {
nullptr, resolver) == WireResult::Success;
}
} // namespace dawn_wire
} // namespace dawn::wire

View File

@ -21,7 +21,7 @@
#include "dawn_wire/ObjectType_autogen.h"
#include "dawn_wire/WireResult.h"
namespace dawn_wire {
namespace dawn::wire {
using ObjectId = uint32_t;
using ObjectGeneration = uint32_t;
@ -133,6 +133,6 @@ namespace dawn_wire {
{{write_command_struct(command, True)}}
{% endfor %}
} // namespace dawn_wire
} // namespace dawn::wire
#endif // DAWNWIRE_WIRECMD_AUTOGEN_H_

View File

@ -18,7 +18,7 @@
#include "dawn_wire/ObjectType_autogen.h"
#include "dawn_wire/client/ObjectBase.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
template <typename T>
struct ObjectTypeToTypeEnum {
@ -48,6 +48,6 @@ namespace dawn_wire::client {
};
{% endfor %}
} // namespace dawn_wire::client
} // namespace dawn::wire::client
#endif // DAWNWIRE_CLIENT_APIOBJECTS_AUTOGEN_H_

View File

@ -21,7 +21,7 @@
#include <string>
#include <vector>
namespace dawn_wire::client {
namespace dawn::wire::client {
//* Outputs an rvalue that's the number of elements a pointer member points to.
{% macro member_length(member, accessor) -%}
@ -175,4 +175,4 @@ namespace dawn_wire::client {
const {{Prefix}}ProcTable& GetProcs() {
return gProcTable;
}
} // namespace dawn_wire::client
} // namespace dawn::wire::client

View File

@ -20,7 +20,7 @@
#include "dawn_wire/client/ApiObjects.h"
#include "dawn_wire/client/ObjectAllocator.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
class ClientBase : public ChunkedCommandHandler, public ObjectIdProvider {
public:
@ -69,6 +69,6 @@ namespace dawn_wire::client {
{% endfor %}
};
} // namespace dawn_wire::client
} // namespace dawn::wire::client
#endif // DAWNWIRE_CLIENT_CLIENTBASE_AUTOGEN_H_

View File

@ -17,7 +17,7 @@
#include <string>
namespace dawn_wire::client {
namespace dawn::wire::client {
{% for command in cmd_records["return command"] %}
bool Client::Handle{{command.name.CamelCase()}}(DeserializeBuffer* deserializeBuffer) {
Return{{command.name.CamelCase()}}Cmd cmd;
@ -94,4 +94,4 @@ namespace dawn_wire::client {
return commands;
}
} // namespace dawn_wire::client
} // namespace dawn::wire::client

View File

@ -22,7 +22,7 @@
#include "dawn_wire/WireDeserializeAllocator.h"
#include "dawn_wire/server/ObjectStorage.h"
namespace dawn_wire::server {
namespace dawn::wire::server {
class ServerBase : public ChunkedCommandHandler, public ObjectIdResolver {
public:
@ -100,6 +100,6 @@ namespace dawn_wire::server {
{% endfor %}
};
} // namespace dawn_wire::server
} // namespace dawn::wire::server
#endif // DAWNWIRE_SERVER_SERVERBASE_H_

View File

@ -15,7 +15,7 @@
#include "common/Assert.h"
#include "dawn_wire/server/Server.h"
namespace dawn_wire::server {
namespace dawn::wire::server {
//* Implementation of the command doers
{% for command in cmd_records["command"] %}
{% set type = command.derived_object %}
@ -118,4 +118,4 @@ namespace dawn_wire::server {
}
}
} // namespace dawn_wire::server
} // namespace dawn::wire::server

View File

@ -15,7 +15,7 @@
#include "common/Assert.h"
#include "dawn_wire/server/Server.h"
namespace dawn_wire::server {
namespace dawn::wire::server {
{% for command in cmd_records["command"] %}
{% set method = command.derived_method %}
{% set is_method = method != None %}
@ -147,4 +147,4 @@ namespace dawn_wire::server {
return commands;
}
} // namespace dawn_wire::server
} // namespace dawn::wire::server

View File

@ -19,7 +19,7 @@
#include <cstddef>
namespace dawn_wire {
namespace dawn::wire {
// BufferConsumer is a utility class that allows reading bytes from a buffer
// while simultaneously decrementing the amount of remaining space by exactly
@ -80,6 +80,6 @@ namespace dawn_wire {
}
};
} // namespace dawn_wire
} // namespace dawn::wire
#endif // DAWNWIRE_BUFFERCONSUMER_H_

View File

@ -20,7 +20,7 @@
#include <limits>
#include <type_traits>
namespace dawn_wire {
namespace dawn::wire {
template <typename BufferT>
template <typename T>
@ -68,6 +68,6 @@ namespace dawn_wire {
return WireResult::Success;
}
} // namespace dawn_wire
} // namespace dawn::wire
#endif // DAWNWIRE_BUFFERCONSUMER_IMPL_H_

View File

@ -19,7 +19,7 @@
#include <algorithm>
#include <cstring>
namespace dawn_wire {
namespace dawn::wire {
ChunkedCommandHandler::~ChunkedCommandHandler() = default;
@ -76,4 +76,4 @@ namespace dawn_wire {
return ChunkedCommandsResult::Consumed;
}
} // namespace dawn_wire
} // namespace dawn::wire

View File

@ -22,7 +22,7 @@
#include <cstdint>
#include <memory>
namespace dawn_wire {
namespace dawn::wire {
class ChunkedCommandHandler : public CommandHandler {
public:
@ -66,6 +66,6 @@ namespace dawn_wire {
std::unique_ptr<char[]> mChunkedCommandData;
};
} // namespace dawn_wire
} // namespace dawn::wire
#endif // DAWNWIRE_CHUNKEDCOMMANDHANDLER_H_

View File

@ -14,7 +14,7 @@
#include "dawn_wire/ChunkedCommandSerializer.h"
namespace dawn_wire {
namespace dawn::wire {
ChunkedCommandSerializer::ChunkedCommandSerializer(CommandSerializer* serializer)
: mSerializer(serializer), mMaxAllocationSize(serializer->GetMaximumAllocationSize()) {
@ -35,4 +35,4 @@ namespace dawn_wire {
}
}
} // namespace dawn_wire
} // namespace dawn::wire

View File

@ -24,7 +24,7 @@
#include <cstring>
#include <memory>
namespace dawn_wire {
namespace dawn::wire {
class ChunkedCommandSerializer {
public:
@ -109,6 +109,6 @@ namespace dawn_wire {
size_t mMaxAllocationSize;
};
} // namespace dawn_wire
} // namespace dawn::wire
#endif // DAWNWIRE_CHUNKEDCOMMANDSERIALIZER_H_

View File

@ -14,7 +14,7 @@
#include "dawn_wire/SupportedFeatures.h"
namespace dawn_wire {
namespace dawn::wire {
// Note: Upon updating this list, please also update serialization/deserialization
// of limit structs on Adapter/Device initialization.
@ -46,4 +46,4 @@ namespace dawn_wire {
return false;
}
} // namespace dawn_wire
} // namespace dawn::wire

View File

@ -17,10 +17,10 @@
#include <dawn/webgpu.h>
namespace dawn_wire {
namespace dawn::wire {
bool IsFeatureSupported(WGPUFeatureName feature);
} // namespace dawn_wire
} // namespace dawn::wire
#endif // DAWNWIRE_SUPPORTEDFEATURES_H_

View File

@ -14,7 +14,7 @@
#include "dawn_wire/Wire.h"
namespace dawn_wire {
namespace dawn::wire {
CommandSerializer::CommandSerializer() = default;
CommandSerializer::~CommandSerializer() = default;
@ -25,4 +25,4 @@ namespace dawn_wire {
CommandHandler::CommandHandler() = default;
CommandHandler::~CommandHandler() = default;
} // namespace dawn_wire
} // namespace dawn::wire

View File

@ -15,7 +15,7 @@
#include "dawn_wire/WireClient.h"
#include "dawn_wire/client/Client.h"
namespace dawn_wire {
namespace dawn::wire {
WireClient::WireClient(const WireClientDescriptor& descriptor)
: mImpl(new client::Client(descriptor.serializer, descriptor.memoryTransferService)) {
@ -79,4 +79,4 @@ namespace dawn_wire {
MemoryTransferService::WriteHandle::~WriteHandle() = default;
} // namespace client
} // namespace dawn_wire
} // namespace dawn::wire

View File

@ -16,7 +16,7 @@
#include <algorithm>
namespace dawn_wire {
namespace dawn::wire {
WireDeserializeAllocator::WireDeserializeAllocator() {
Reset();
}
@ -57,4 +57,4 @@ namespace dawn_wire {
mCurrentBuffer = mStaticBuffer;
mRemainingSize = sizeof(mStaticBuffer);
}
} // namespace dawn_wire
} // namespace dawn::wire

View File

@ -19,7 +19,7 @@
#include <vector>
namespace dawn_wire {
namespace dawn::wire {
// A really really simple implementation of the DeserializeAllocator. It's main feature
// is that it has some inline storage so as to avoid allocations for the majority of
// commands.
@ -38,6 +38,6 @@ namespace dawn_wire {
char mStaticBuffer[2048];
std::vector<char*> mAllocations;
};
} // namespace dawn_wire
} // namespace dawn::wire
#endif // DAWNWIRE_WIREDESERIALIZEALLOCATOR_H_

View File

@ -17,7 +17,7 @@
#include "common/Compiler.h"
namespace dawn_wire {
namespace dawn::wire {
enum class [[nodiscard]] WireResult{
Success,
@ -33,6 +33,6 @@ namespace dawn_wire {
} \
} while (0)
} // namespace dawn_wire
} // namespace dawn::wire
#endif // DAWNWIRE_WIRERESULT_H_

View File

@ -15,7 +15,7 @@
#include "dawn_wire/WireServer.h"
#include "dawn_wire/server/Server.h"
namespace dawn_wire {
namespace dawn::wire {
WireServer::WireServer(const WireServerDescriptor& descriptor)
: mImpl(new server::Server(*descriptor.procs,
@ -80,4 +80,4 @@ namespace dawn_wire {
}
} // namespace server
} // namespace dawn_wire
} // namespace dawn::wire

View File

@ -17,7 +17,7 @@
#include "common/Log.h"
#include "dawn_wire/client/Client.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
Adapter::~Adapter() {
mRequestDeviceRequests.CloseAll([](RequestDeviceData* request) {
@ -130,4 +130,4 @@ namespace dawn_wire::client {
return nullptr;
}
} // namespace dawn_wire::client
} // namespace dawn::wire::client

View File

@ -23,7 +23,7 @@
#include "dawn_wire/client/ObjectBase.h"
#include "dawn_wire/client/RequestTracker.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
class Adapter final : public ObjectBase {
public:
@ -65,6 +65,6 @@ namespace dawn_wire::client {
RequestTracker<RequestDeviceData> mRequestDeviceRequests;
};
} // namespace dawn_wire::client
} // namespace dawn::wire::client
#endif // DAWNWIRE_CLIENT_ADAPTER_H_

View File

@ -19,7 +19,7 @@
#include "dawn_wire/client/Client.h"
#include "dawn_wire/client/Device.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
// static
WGPUBuffer Buffer::Create(Device* device, const WGPUBufferDescriptor* descriptor) {
@ -402,4 +402,4 @@ namespace dawn_wire::client {
mMappedData = nullptr;
}
} // namespace dawn_wire::client
} // namespace dawn::wire::client

View File

@ -21,7 +21,7 @@
#include "dawn_wire/client/ObjectBase.h"
#include "dawn_wire/client/RequestTracker.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
class Device;
@ -104,6 +104,6 @@ namespace dawn_wire::client {
std::weak_ptr<bool> mDeviceIsAlive;
};
} // namespace dawn_wire::client
} // namespace dawn::wire::client
#endif // DAWNWIRE_CLIENT_BUFFER_H_

View File

@ -17,7 +17,7 @@
#include "common/Compiler.h"
#include "dawn_wire/client/Device.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
namespace {
@ -168,4 +168,4 @@ namespace dawn_wire::client {
return mDisconnected;
}
} // namespace dawn_wire::client
} // namespace dawn::wire::client

View File

@ -26,7 +26,7 @@
#include "dawn_wire/WireDeserializeAllocator.h"
#include "dawn_wire/client/ClientBase_autogen.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
class Device;
class MemoryTransferService;
@ -90,6 +90,6 @@ namespace dawn_wire::client {
std::unique_ptr<MemoryTransferService> CreateInlineMemoryTransferService();
} // namespace dawn_wire::client
} // namespace dawn::wire::client
#endif // DAWNWIRE_CLIENT_CLIENT_H_

View File

@ -18,7 +18,7 @@
#include <limits>
namespace dawn_wire::client {
namespace dawn::wire::client {
bool Client::DoDeviceUncapturedErrorCallback(Device* device,
WGPUErrorType errorType,
@ -130,4 +130,4 @@ namespace dawn_wire::client {
return shaderModule->GetCompilationInfoCallback(requestSerial, status, info);
}
} // namespace dawn_wire::client
} // namespace dawn::wire::client

View File

@ -19,7 +19,7 @@
#include <cstring>
namespace dawn_wire::client {
namespace dawn::wire::client {
class InlineMemoryTransferService : public MemoryTransferService {
class ReadHandleImpl : public ReadHandle {
@ -128,4 +128,4 @@ namespace dawn_wire::client {
return std::make_unique<InlineMemoryTransferService>();
}
} // namespace dawn_wire::client
} // namespace dawn::wire::client

View File

@ -17,7 +17,7 @@
#include <cstdio>
#include "common/Assert.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
MockMemoryTransferService::MockReadHandle::MockReadHandle(MockMemoryTransferService* service)
: ReadHandle(), mService(service) {
@ -102,4 +102,4 @@ namespace dawn_wire::client {
return new MockWriteHandle(this);
}
} // namespace dawn_wire::client
} // namespace dawn::wire::client

View File

@ -20,7 +20,7 @@
#include "dawn_wire/WireClient.h"
#include "dawn_wire/client/Client.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
class MockMemoryTransferService : public MemoryTransferService {
public:
@ -94,6 +94,6 @@ namespace dawn_wire::client {
MOCK_METHOD(void, OnWriteHandleDestroy, (const void* WriteHandle));
};
} // namespace dawn_wire::client
} // namespace dawn::wire::client
#endif // DAWNWIRE_CLIENT_CLIENTMEMORYTRANSFERSERVICE_MOCK_H_

View File

@ -20,7 +20,7 @@
#include "dawn_wire/client/Client.h"
#include "dawn_wire/client/ObjectAllocator.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
Device::Device(Client* clientIn, uint32_t initialRefcount, uint32_t initialId)
: ObjectBase(clientIn, initialRefcount, initialId), mIsAlive(std::make_shared<bool>()) {
@ -339,4 +339,4 @@ namespace dawn_wire::client {
return true;
}
} // namespace dawn_wire::client
} // namespace dawn::wire::client

View File

@ -26,7 +26,7 @@
#include <memory>
namespace dawn_wire::client {
namespace dawn::wire::client {
class Client;
class Queue;
@ -107,6 +107,6 @@ namespace dawn_wire::client {
std::shared_ptr<bool> mIsAlive;
};
} // namespace dawn_wire::client
} // namespace dawn::wire::client
#endif // DAWNWIRE_CLIENT_DEVICE_H_

View File

@ -16,7 +16,7 @@
#include "dawn_wire/client/Client.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
Instance::~Instance() {
mRequestAdapterRequests.CloseAll([](RequestAdapterData* request) {
@ -98,4 +98,4 @@ namespace dawn_wire::client {
return true;
}
} // namespace dawn_wire::client
} // namespace dawn::wire::client

View File

@ -22,7 +22,7 @@
#include "dawn_wire/client/ObjectBase.h"
#include "dawn_wire/client/RequestTracker.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
class Instance final : public ObjectBase {
public:
@ -51,6 +51,6 @@ namespace dawn_wire::client {
RequestTracker<RequestAdapterData> mRequestAdapterRequests;
};
} // namespace dawn_wire::client
} // namespace dawn::wire::client
#endif // DAWNWIRE_CLIENT_INSTANCE_H_

View File

@ -17,7 +17,7 @@
#include "common/Assert.h"
#include "dawn_wire/SupportedFeatures.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
bool LimitsAndFeatures::GetLimits(WGPUSupportedLimits* limits) const {
ASSERT(limits != nullptr);
@ -60,4 +60,4 @@ namespace dawn_wire::client {
}
}
} // namespace dawn_wire::client
} // namespace dawn::wire::client

View File

@ -19,7 +19,7 @@
#include <unordered_set>
namespace dawn_wire::client {
namespace dawn::wire::client {
class LimitsAndFeatures {
public:
@ -35,6 +35,6 @@ namespace dawn_wire::client {
std::unordered_set<WGPUFeatureName> mFeatures;
};
} // namespace dawn_wire::client
} // namespace dawn::wire::client
#endif // DAWNWIRE_CLIENT_LIMITSANDFEATURES_H_

View File

@ -23,7 +23,7 @@
#include <memory>
#include <vector>
namespace dawn_wire::client {
namespace dawn::wire::client {
template <typename T>
class ObjectAllocator {
@ -105,6 +105,6 @@ namespace dawn_wire::client {
std::vector<uint32_t> mFreeIds;
std::vector<ObjectAndSerial> mObjects;
};
} // namespace dawn_wire::client
} // namespace dawn::wire::client
#endif // DAWNWIRE_CLIENT_OBJECTALLOCATOR_H_

View File

@ -20,7 +20,7 @@
#include "common/LinkedList.h"
#include "dawn_wire/ObjectType_autogen.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
class Client;
@ -46,6 +46,6 @@ namespace dawn_wire::client {
const uint32_t id;
};
} // namespace dawn_wire::client
} // namespace dawn::wire::client
#endif // DAWNWIRE_CLIENT_OBJECTBASE_H_

View File

@ -17,7 +17,7 @@
#include "dawn_wire/client/Client.h"
#include "dawn_wire/client/Device.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
Queue::~Queue() {
ClearAllCallbacks(WGPUQueueWorkDoneStatus_Unknown);
@ -95,4 +95,4 @@ namespace dawn_wire::client {
});
}
} // namespace dawn_wire::client
} // namespace dawn::wire::client

View File

@ -21,7 +21,7 @@
#include "dawn_wire/client/ObjectBase.h"
#include "dawn_wire/client/RequestTracker.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
class Queue final : public ObjectBase {
public:
@ -52,6 +52,6 @@ namespace dawn_wire::client {
RequestTracker<OnWorkDoneData> mOnWorkDoneRequests;
};
} // namespace dawn_wire::client
} // namespace dawn::wire::client
#endif // DAWNWIRE_CLIENT_QUEUE_H_

View File

@ -21,7 +21,7 @@
#include <cstdint>
#include <map>
namespace dawn_wire::client {
namespace dawn::wire::client {
class Device;
class MemoryTransferService;
@ -77,6 +77,6 @@ namespace dawn_wire::client {
std::map<uint64_t, Request> mRequests;
};
} // namespace dawn_wire::client
} // namespace dawn::wire::client
#endif // DAWNWIRE_CLIENT_REQUESTTRACKER_H_

View File

@ -16,7 +16,7 @@
#include "dawn_wire/client/Client.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
ShaderModule::~ShaderModule() {
ClearAllCallbacks(WGPUCompilationInfoRequestStatus_Unknown);
@ -61,4 +61,4 @@ namespace dawn_wire::client {
});
}
} // namespace dawn_wire::client
} // namespace dawn::wire::client

View File

@ -20,7 +20,7 @@
#include "dawn_wire/client/ObjectBase.h"
#include "dawn_wire/client/RequestTracker.h"
namespace dawn_wire::client {
namespace dawn::wire::client {
class ShaderModule final : public ObjectBase {
public:
@ -43,6 +43,6 @@ namespace dawn_wire::client {
RequestTracker<CompilationInfoRequest> mCompilationInfoRequests;
};
} // namespace dawn_wire::client
} // namespace dawn::wire::client
#endif // DAWNWIRE_CLIENT_SHADER_MODULE_H_

View File

@ -22,7 +22,7 @@
#include <map>
#include <unordered_set>
namespace dawn_wire::server {
namespace dawn::wire::server {
struct DeviceInfo {
std::unordered_set<uint64_t> childObjectTypesAndIds;
@ -223,6 +223,6 @@ namespace dawn_wire::server {
std::map<T, ObjectId> mTable;
};
} // namespace dawn_wire::server
} // namespace dawn::wire::server
#endif // DAWNWIRE_SERVER_OBJECTSTORAGE_H_

View File

@ -15,7 +15,7 @@
#include "dawn_wire/server/Server.h"
#include "dawn_wire/WireServer.h"
namespace dawn_wire::server {
namespace dawn::wire::server {
Server::Server(const DawnProcTable& procs,
CommandSerializer* serializer,
@ -210,4 +210,4 @@ namespace dawn_wire::server {
return true;
}
} // namespace dawn_wire::server
} // namespace dawn::wire::server

View File

@ -18,7 +18,7 @@
#include "dawn_wire/ChunkedCommandSerializer.h"
#include "dawn_wire/server/ServerBase_autogen.h"
namespace dawn_wire::server {
namespace dawn::wire::server {
class Server;
class MemoryTransferService;
@ -238,6 +238,6 @@ namespace dawn_wire::server {
std::unique_ptr<MemoryTransferService> CreateInlineMemoryTransferService();
} // namespace dawn_wire::server
} // namespace dawn::wire::server
#endif // DAWNWIRE_SERVER_SERVER_H_

View File

@ -16,7 +16,7 @@
#include "dawn_wire/SupportedFeatures.h"
namespace dawn_wire::server {
namespace dawn::wire::server {
bool Server::DoAdapterRequestDevice(ObjectId adapterId,
uint64_t requestSerial,
@ -107,4 +107,4 @@ namespace dawn_wire::server {
SerializeCommand(cmd);
}
} // namespace dawn_wire::server
} // namespace dawn::wire::server

View File

@ -19,7 +19,7 @@
#include <memory>
namespace dawn_wire::server {
namespace dawn::wire::server {
bool Server::PreHandleBufferUnmap(const BufferUnmapCmd& cmd) {
auto* buffer = BufferObjects().Get(cmd.selfId);
@ -279,4 +279,4 @@ namespace dawn_wire::server {
});
}
} // namespace dawn_wire::server
} // namespace dawn::wire::server

View File

@ -14,7 +14,7 @@
#include "dawn_wire/server/Server.h"
namespace dawn_wire::server {
namespace dawn::wire::server {
namespace {
@ -201,4 +201,4 @@ namespace dawn_wire::server {
SerializeCommand(cmd);
}
} // namespace dawn_wire::server
} // namespace dawn::wire::server

View File

@ -18,7 +18,7 @@
#include <cstring>
namespace dawn_wire::server {
namespace dawn::wire::server {
class InlineMemoryTransferService : public MemoryTransferService {
public:
@ -91,4 +91,4 @@ namespace dawn_wire::server {
return std::make_unique<InlineMemoryTransferService>();
}
} // namespace dawn_wire::server
} // namespace dawn::wire::server

View File

@ -18,7 +18,7 @@
#include <algorithm>
namespace dawn_wire::server {
namespace dawn::wire::server {
bool Server::DoInstanceRequestAdapter(ObjectId instanceId,
uint64_t requestSerial,
@ -97,4 +97,4 @@ namespace dawn_wire::server {
SerializeCommand(cmd);
}
} // namespace dawn_wire::server
} // namespace dawn::wire::server

View File

@ -16,7 +16,7 @@
#include "common/Assert.h"
namespace dawn_wire::server {
namespace dawn::wire::server {
MockMemoryTransferService::MockReadHandle::MockReadHandle(MockMemoryTransferService* service)
: ReadHandle(), mService(service) {
@ -88,4 +88,4 @@ namespace dawn_wire::server {
return new MockWriteHandle(this);
}
} // namespace dawn_wire::server
} // namespace dawn::wire::server

View File

@ -20,7 +20,7 @@
#include "dawn_wire/WireServer.h"
#include "dawn_wire/server/Server.h"
namespace dawn_wire::server {
namespace dawn::wire::server {
class MockMemoryTransferService : public MemoryTransferService {
public:
@ -103,6 +103,6 @@ namespace dawn_wire::server {
MOCK_METHOD(void, OnWriteHandleDestroy, (const WriteHandle* writeHandle));
};
} // namespace dawn_wire::server
} // namespace dawn::wire::server
#endif // DAWNWIRE_SERVER_SERVERMEMORYTRANSFERSERVICE_MOCK_H_

View File

@ -15,7 +15,7 @@
#include "common/Assert.h"
#include "dawn_wire/server/Server.h"
namespace dawn_wire::server {
namespace dawn::wire::server {
void Server::OnQueueWorkDone(QueueWorkDoneUserdata* data, WGPUQueueWorkDoneStatus status) {
ReturnQueueWorkDoneCallbackCmd cmd;
@ -100,4 +100,4 @@ namespace dawn_wire::server {
return true;
}
} // namespace dawn_wire::server
} // namespace dawn::wire::server

View File

@ -16,7 +16,7 @@
#include <memory>
namespace dawn_wire::server {
namespace dawn::wire::server {
bool Server::DoShaderModuleGetCompilationInfo(ObjectId shaderModuleId, uint64_t requestSerial) {
auto* shaderModule = ShaderModuleObjects().Get(shaderModuleId);
@ -46,4 +46,4 @@ namespace dawn_wire::server {
SerializeCommand(cmd);
}
} // namespace dawn_wire::server
} // namespace dawn::wire::server

View File

@ -28,7 +28,7 @@
namespace {
class DevNull : public dawn_wire::CommandSerializer {
class DevNull : public dawn::wire::CommandSerializer {
public:
size_t GetMaximumAllocationSize() const override {
// Some fuzzer bots have a 2GB allocation limit. Pick a value reasonably below that.
@ -116,11 +116,11 @@ int DawnWireServerFuzzer::Run(const uint8_t* data,
}
DevNull devNull;
dawn_wire::WireServerDescriptor serverDesc = {};
dawn::wire::WireServerDescriptor serverDesc = {};
serverDesc.procs = &procs;
serverDesc.serializer = &devNull;
std::unique_ptr<dawn_wire::WireServer> wireServer(new dawn_wire::WireServer(serverDesc));
std::unique_ptr<dawn::wire::WireServer> wireServer(new dawn_wire::WireServer(serverDesc));
wireServer->InjectDevice(device.Get(), 1, 0);
wireServer->HandleCommands(reinterpret_cast<const char*>(data), size);

View File

@ -113,6 +113,7 @@ namespace dawn::platform {
} // namespace dawn::platform
// TODO(dawn:824): Remove once the deprecation period is passed.
namespace dawn_platform = dawn::platform;
#endif // DAWNPLATFORM_DAWNPLATFORM_H_

View File

@ -21,7 +21,7 @@
#include "dawn/webgpu.h"
#include "dawn_wire/dawn_wire_export.h"
namespace dawn_wire {
namespace dawn::wire {
class DAWN_WIRE_EXPORT CommandSerializer {
public:
@ -71,6 +71,9 @@ namespace dawn_wire {
const volatile char* deserializeBuffer,
size_t deserializeBufferSize);
} // namespace dawn_wire
} // namespace dawn::wire
// TODO(dawn:824): Remove once the deprecation period is passed.
namespace dawn_wire = dawn::wire;
#endif // DAWNWIRE_WIRE_H_

View File

@ -21,7 +21,7 @@
#include <memory>
#include <vector>
namespace dawn_wire {
namespace dawn::wire {
namespace client {
class Client;
@ -178,6 +178,6 @@ namespace dawn_wire {
// Backdoor to get the order of the ProcMap for testing
DAWN_WIRE_EXPORT std::vector<const char*> GetProcMapNamesForTesting();
} // namespace client
} // namespace dawn_wire
} // namespace dawn::wire
#endif // DAWNWIRE_WIRECLIENT_H_

View File

@ -21,7 +21,7 @@
struct DawnProcTable;
namespace dawn_wire {
namespace dawn::wire {
namespace server {
class Server;
@ -145,6 +145,6 @@ namespace dawn_wire {
};
} // namespace server
} // namespace dawn_wire
} // namespace dawn::wire
#endif // DAWNWIRE_WIRESERVER_H_

View File

@ -201,11 +201,11 @@ namespace detail {
class ExpectBetweenColors;
} // namespace detail
namespace dawn_wire {
namespace dawn::wire {
class CommandHandler;
class WireClient;
class WireServer;
} // namespace dawn_wire
} // namespace dawn::wire
void InitDawnEnd2EndTestEnvironment(int argc, char** argv);

View File

@ -67,12 +67,12 @@ namespace {
case DawnFlavor::Wire: {
mC2sBuf = std::make_unique<utils::TerribleCommandBuffer>();
dawn_wire::WireClientDescriptor clientDesc = {};
dawn::wire::WireClientDescriptor clientDesc = {};
clientDesc.serializer = mC2sBuf.get();
mWireClient = std::make_unique<dawn_wire::WireClient>(clientDesc);
mWireClient = std::make_unique<dawn::wire::WireClient>(clientDesc);
mDevice = wgpu::Device::Acquire(mWireClient->ReserveDevice().device);
mProcs = dawn_wire::client::GetProcs();
mProcs = dawn::wire::client::GetProcs();
break;
}
@ -94,7 +94,7 @@ namespace {
dawn_native::null::Adapter mNativeAdapter;
std::unique_ptr<utils::TerribleCommandBuffer> mC2sBuf;
std::unique_ptr<dawn_wire::WireClient> mWireClient;
std::unique_ptr<dawn::wire::WireClient> mWireClient;
wgpu::Device mDevice;
DawnProcTable mProcs;
@ -162,7 +162,7 @@ namespace {
}
TEST(GetProcAddressInternalTests, CheckDawnWireClientProcMapOrder) {
std::vector<const char*> names = dawn_wire::client::GetProcMapNamesForTesting();
std::vector<const char*> names = dawn::wire::client::GetProcMapNamesForTesting();
for (size_t i = 1; i < names.size(); i++) {
ASSERT_LT(std::string(names[i - 1]), std::string(names[i]));
}

View File

@ -25,7 +25,7 @@
namespace {
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
class WireAdapterTests : public WireTest {
protected:

View File

@ -19,7 +19,7 @@
#include <array>
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
class WireArgumentTests : public WireTest {
public:

View File

@ -15,7 +15,7 @@
#include "tests/unittests/wire/WireTest.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
class WireBasicTests : public WireTest {
public:

View File

@ -17,7 +17,7 @@
#include "dawn_wire/WireClient.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
namespace {

View File

@ -17,7 +17,7 @@
#include "dawn_wire/WireClient.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
namespace {

View File

@ -16,7 +16,7 @@
#include "tests/unittests/wire/WireTest.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
class WireDestroyObjectTests : public WireTest {};

View File

@ -19,7 +19,7 @@
#include "tests/MockCallback.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
namespace {

View File

@ -17,7 +17,7 @@
#include "dawn_wire/WireClient.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
namespace {

View File

@ -15,7 +15,7 @@
#include "tests/unittests/wire/WireTest.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
class WireExtensionTests : public WireTest {
public:

View File

@ -18,7 +18,7 @@
#include "dawn_wire/WireServer.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
class WireInjectDeviceTests : public WireTest {
public:

View File

@ -18,7 +18,7 @@
#include "dawn_wire/WireServer.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
namespace {

View File

@ -18,7 +18,7 @@
#include "dawn_wire/WireServer.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
class WireInjectSwapChainTests : public WireTest {
public:

View File

@ -18,7 +18,7 @@
#include "dawn_wire/WireServer.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
class WireInjectTextureTests : public WireTest {
public:

View File

@ -25,7 +25,7 @@
namespace {
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
class WireInstanceBasicTest : public WireTest {};
class WireInstanceTests : public WireTest {

View File

@ -18,7 +18,7 @@
#include "dawn_wire/server/ServerMemoryTransferService_mock.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
namespace {
@ -314,8 +314,8 @@ class WireMemoryTransferServiceTests : public WireTest {
// mUpdatedBufferContent| after all writes are flushed.
static uint32_t mUpdatedBufferContent;
testing::StrictMock<dawn_wire::server::MockMemoryTransferService> serverMemoryTransferService;
testing::StrictMock<dawn_wire::client::MockMemoryTransferService> clientMemoryTransferService;
testing::StrictMock<dawn::wire::server::MockMemoryTransferService> serverMemoryTransferService;
testing::StrictMock<dawn::wire::client::MockMemoryTransferService> clientMemoryTransferService;
};
uint32_t WireMemoryTransferServiceTests::mBufferContent = 1337;

View File

@ -15,7 +15,7 @@
#include "tests/unittests/wire/WireTest.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
class WireOptionalTests : public WireTest {
public:

View File

@ -17,7 +17,7 @@
#include "dawn_wire/WireClient.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
class MockQueueWorkDoneCallback {
public:

View File

@ -17,7 +17,7 @@
#include "dawn_wire/WireClient.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
namespace {

View File

@ -20,7 +20,7 @@
#include "utils/TerribleCommandBuffer.h"
using namespace testing;
using namespace dawn_wire;
using namespace dawn::wire;
WireTest::WireTest() {
}
@ -65,7 +65,7 @@ void WireTest::SetUp() {
mWireClient.reset(new WireClient(clientDesc));
mS2cBuf->SetHandler(mWireClient.get());
dawnProcSetProcs(&dawn_wire::client::GetProcs());
dawnProcSetProcs(&dawn::wire::client::GetProcs());
auto deviceReservation = mWireClient->ReserveDevice();
EXPECT_CALL(api, DeviceReference(mockDevice));
@ -120,11 +120,11 @@ void WireTest::FlushServer(bool success) {
ASSERT_EQ(mS2cBuf->Flush(), success);
}
dawn_wire::WireServer* WireTest::GetWireServer() {
dawn::wire::WireServer* WireTest::GetWireServer() {
return mWireServer.get();
}
dawn_wire::WireClient* WireTest::GetWireClient() {
dawn::wire::WireClient* WireTest::GetWireClient() {
return mWireClient.get();
}

View File

@ -97,7 +97,7 @@ inline testing::Matcher<const char*> ValidStringMessage() {
return MakeMatcher(new StringMessageMatcher());
}
namespace dawn_wire {
namespace dawn::wire {
class WireClient;
class WireServer;
namespace client {
@ -106,7 +106,7 @@ namespace dawn_wire {
namespace server {
class MemoryTransferService;
} // namespace server
} // namespace dawn_wire
} // namespace dawn::wire
namespace utils {
class TerribleCommandBuffer;
@ -131,8 +131,8 @@ class WireTest : public testing::Test {
WGPUDevice device;
WGPUQueue queue;
dawn_wire::WireServer* GetWireServer();
dawn_wire::WireClient* GetWireClient();
dawn::wire::WireServer* GetWireServer();
dawn::wire::WireClient* GetWireClient();
void DeleteServer();
void DeleteClient();
@ -140,11 +140,11 @@ class WireTest : public testing::Test {
private:
void SetupIgnoredCallExpectations();
virtual dawn_wire::client::MemoryTransferService* GetClientMemoryTransferService();
virtual dawn_wire::server::MemoryTransferService* GetServerMemoryTransferService();
virtual dawn::wire::client::MemoryTransferService* GetClientMemoryTransferService();
virtual dawn::wire::server::MemoryTransferService* GetServerMemoryTransferService();
std::unique_ptr<dawn_wire::WireServer> mWireServer;
std::unique_ptr<dawn_wire::WireClient> mWireClient;
std::unique_ptr<dawn::wire::WireServer> mWireServer;
std::unique_ptr<dawn::wire::WireClient> mWireClient;
std::unique_ptr<utils::TerribleCommandBuffer> mS2cBuf;
std::unique_ptr<utils::TerribleCommandBuffer> mC2sBuf;
};

View File

@ -28,13 +28,13 @@ TEST_F(WireWGPUDevicePropertiesTests, SerializeWGPUDeviceProperties) {
sentWGPUDeviceProperties.timestampQuery = true;
size_t sentWGPUDevicePropertiesSize =
dawn_wire::SerializedWGPUDevicePropertiesSize(&sentWGPUDeviceProperties);
dawn::wire::SerializedWGPUDevicePropertiesSize(&sentWGPUDeviceProperties);
std::vector<char> buffer;
buffer.resize(sentWGPUDevicePropertiesSize);
dawn_wire::SerializeWGPUDeviceProperties(&sentWGPUDeviceProperties, buffer.data());
dawn::wire::SerializeWGPUDeviceProperties(&sentWGPUDeviceProperties, buffer.data());
WGPUDeviceProperties receivedWGPUDeviceProperties;
ASSERT_TRUE(dawn_wire::DeserializeWGPUDeviceProperties(&receivedWGPUDeviceProperties,
ASSERT_TRUE(dawn::wire::DeserializeWGPUDeviceProperties(&receivedWGPUDeviceProperties,
buffer.data(), buffer.size()));
ASSERT_TRUE(receivedWGPUDeviceProperties.textureCompressionBC);
ASSERT_FALSE(receivedWGPUDeviceProperties.pipelineStatisticsQuery);
@ -46,12 +46,12 @@ TEST_F(WireWGPUDevicePropertiesTests, DeserializeBufferTooSmall) {
WGPUDeviceProperties sentWGPUDeviceProperties = {};
size_t sentWGPUDevicePropertiesSize =
dawn_wire::SerializedWGPUDevicePropertiesSize(&sentWGPUDeviceProperties);
dawn::wire::SerializedWGPUDevicePropertiesSize(&sentWGPUDeviceProperties);
std::vector<char> buffer;
buffer.resize(sentWGPUDevicePropertiesSize);
dawn_wire::SerializeWGPUDeviceProperties(&sentWGPUDeviceProperties, buffer.data());
dawn::wire::SerializeWGPUDeviceProperties(&sentWGPUDeviceProperties, buffer.data());
WGPUDeviceProperties receivedWGPUDeviceProperties;
ASSERT_FALSE(dawn_wire::DeserializeWGPUDeviceProperties(&receivedWGPUDeviceProperties,
ASSERT_FALSE(dawn::wire::DeserializeWGPUDeviceProperties(&receivedWGPUDeviceProperties,
buffer.data(), buffer.size() - 1));
}

View File

@ -21,11 +21,11 @@ namespace utils {
TerribleCommandBuffer::TerribleCommandBuffer() {
}
TerribleCommandBuffer::TerribleCommandBuffer(dawn_wire::CommandHandler* handler)
TerribleCommandBuffer::TerribleCommandBuffer(dawn::wire::CommandHandler* handler)
: mHandler(handler) {
}
void TerribleCommandBuffer::SetHandler(dawn_wire::CommandHandler* handler) {
void TerribleCommandBuffer::SetHandler(dawn::wire::CommandHandler* handler) {
mHandler = handler;
}

View File

@ -19,12 +19,12 @@
namespace utils {
class TerribleCommandBuffer : public dawn_wire::CommandSerializer {
class TerribleCommandBuffer : public dawn::wire::CommandSerializer {
public:
TerribleCommandBuffer();
TerribleCommandBuffer(dawn_wire::CommandHandler* handler);
TerribleCommandBuffer(dawn::wire::CommandHandler* handler);
void SetHandler(dawn_wire::CommandHandler* handler);
void SetHandler(dawn::wire::CommandHandler* handler);
size_t GetMaximumAllocationSize() const override;
@ -32,7 +32,7 @@ namespace utils {
bool Flush() override;
private:
dawn_wire::CommandHandler* mHandler = nullptr;
dawn::wire::CommandHandler* mHandler = nullptr;
size_t mOffset = 0;
char mBuffer[1000000];
};

View File

@ -34,10 +34,10 @@ namespace utils {
namespace {
class WireServerTraceLayer : public dawn_wire::CommandHandler {
class WireServerTraceLayer : public dawn::wire::CommandHandler {
public:
WireServerTraceLayer(const char* dir, dawn_wire::CommandHandler* handler)
: dawn_wire::CommandHandler(), mDir(dir), mHandler(handler) {
WireServerTraceLayer(const char* dir, dawn::wire::CommandHandler* handler)
: dawn::wire::CommandHandler(), mDir(dir), mHandler(handler) {
const char* sep = GetPathSeparator();
if (mDir.size() > 0 && mDir.back() != *sep) {
mDir += sep;
@ -75,7 +75,7 @@ namespace utils {
private:
std::string mDir;
dawn_wire::CommandHandler* mHandler;
dawn::wire::CommandHandler* mHandler;
std::ofstream mFile;
};
@ -108,11 +108,11 @@ namespace utils {
mC2sBuf = std::make_unique<utils::TerribleCommandBuffer>();
mS2cBuf = std::make_unique<utils::TerribleCommandBuffer>();
dawn_wire::WireServerDescriptor serverDesc = {};
dawn::wire::WireServerDescriptor serverDesc = {};
serverDesc.procs = &dawn_native::GetProcs();
serverDesc.serializer = mS2cBuf.get();
mWireServer.reset(new dawn_wire::WireServer(serverDesc));
mWireServer.reset(new dawn::wire::WireServer(serverDesc));
mC2sBuf->SetHandler(mWireServer.get());
if (wireTraceDir != nullptr && strlen(wireTraceDir) > 0) {
@ -121,12 +121,12 @@ namespace utils {
mC2sBuf->SetHandler(mWireServerTraceLayer.get());
}
dawn_wire::WireClientDescriptor clientDesc = {};
dawn::wire::WireClientDescriptor clientDesc = {};
clientDesc.serializer = mC2sBuf.get();
mWireClient.reset(new dawn_wire::WireClient(clientDesc));
mWireClient.reset(new dawn::wire::WireClient(clientDesc));
mS2cBuf->SetHandler(mWireClient.get());
dawnProcSetProcs(&dawn_wire::client::GetProcs());
dawnProcSetProcs(&dawn::wire::client::GetProcs());
}
std::pair<wgpu::Device, WGPUDevice> RegisterDevice(WGPUDevice backendDevice) override {
@ -157,8 +157,8 @@ namespace utils {
std::unique_ptr<utils::TerribleCommandBuffer> mC2sBuf;
std::unique_ptr<utils::TerribleCommandBuffer> mS2cBuf;
std::unique_ptr<WireServerTraceLayer> mWireServerTraceLayer;
std::unique_ptr<dawn_wire::WireServer> mWireServer;
std::unique_ptr<dawn_wire::WireClient> mWireClient;
std::unique_ptr<dawn::wire::WireServer> mWireServer;
std::unique_ptr<dawn::wire::WireClient> mWireClient;
};
} // anonymous namespace