• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 The Dawn Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "dawn_wire/WireServer.h"
16 #include "dawn_wire/server/Server.h"
17 
18 namespace dawn_wire {
19 
WireServer(const WireServerDescriptor & descriptor)20     WireServer::WireServer(const WireServerDescriptor& descriptor)
21         : mImpl(new server::Server(descriptor.device,
22                                    *descriptor.procs,
23                                    descriptor.serializer,
24                                    descriptor.memoryTransferService)) {
25     }
26 
~WireServer()27     WireServer::~WireServer() {
28         mImpl.reset();
29     }
30 
HandleCommands(const char * commands,size_t size)31     const char* WireServer::HandleCommands(const char* commands, size_t size) {
32         return mImpl->HandleCommands(commands, size);
33     }
34 
InjectTexture(DawnTexture texture,uint32_t id,uint32_t generation)35     bool WireServer::InjectTexture(DawnTexture texture, uint32_t id, uint32_t generation) {
36         return mImpl->InjectTexture(texture, id, generation);
37     }
38 
39     namespace server {
40         MemoryTransferService::~MemoryTransferService() = default;
41 
42         MemoryTransferService::ReadHandle::~ReadHandle() = default;
43 
44         MemoryTransferService::WriteHandle::~WriteHandle() = default;
45 
SetTarget(void * data,size_t dataLength)46         void MemoryTransferService::WriteHandle::SetTarget(void* data, size_t dataLength) {
47             mTargetData = data;
48             mDataLength = dataLength;
49         }
50     }  // namespace server
51 
52 }  // namespace dawn_wire
53