[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [sink/develop] common: One copy algorithm is enough.
From:       Christian Mollekopf <chrigi_1 () fastmail ! fm>
Date:       2016-12-09 15:45:48
Message-ID: E1cFNMq-0007L1-Pn () code ! kde ! org
[Download RAW message or body]

Git commit 9c8e4612403fc2accc26ac2b49670394972f1293 by Christian Mollekopf.
Committed on 08/12/2016 at 16:43.
Pushed by cmollekopf into branch 'develop'.

One copy algorithm is enough.

M  +0    -13   common/bufferadaptor.h
M  +3    -2    common/domain/applicationdomaintype.h
M  +2    -1    common/pipeline.cpp

https://commits.kde.org/sink/9c8e4612403fc2accc26ac2b49670394972f1293

diff --git a/common/bufferadaptor.h b/common/bufferadaptor.h
index 8787d39..f6994d7 100644
--- a/common/bufferadaptor.h
+++ b/common/bufferadaptor.h
@@ -59,19 +59,6 @@ public:
     {
     }
 
-    MemoryBufferAdaptor(const BufferAdaptor &buffer, const QList<QByteArray> \
                &properties) : BufferAdaptor()
-    {
-        if (properties.isEmpty()) {
-            for (const auto &property : buffer.availableProperties()) {
-                mValues.insert(property, buffer.getProperty(property));
-            }
-        } else {
-            for (const auto &property : properties) {
-                mValues.insert(property, buffer.getProperty(property));
-            }
-        }
-    }
-
     virtual ~MemoryBufferAdaptor()
     {
     }
diff --git a/common/domain/applicationdomaintype.h \
b/common/domain/applicationdomaintype.h index be14513..7c3800d 100644
--- a/common/domain/applicationdomaintype.h
+++ b/common/domain/applicationdomaintype.h
@@ -122,7 +122,7 @@ struct Reference {
     QByteArray value;
 };
 
-void copyBuffer(Sink::ApplicationDomain::BufferAdaptor &buffer, \
Sink::ApplicationDomain::BufferAdaptor &memoryAdaptor, const QList<QByteArray> \
&properties, bool copyBlobs, bool pruneReferences); +void \
copyBuffer(Sink::ApplicationDomain::BufferAdaptor &buffer, \
Sink::ApplicationDomain::BufferAdaptor &memoryAdaptor, const QList<QByteArray> \
&properties = QList<QByteArray>(), bool copyBlobs = false, bool pruneReferences = \
false);  
 /**
  * The domain type interface has two purposes:
@@ -155,7 +155,8 @@ public:
     template <typename DomainType>
     static typename DomainType::Ptr getInMemoryRepresentation(const \
ApplicationDomainType &domainType, const QList<QByteArray> properties = \
QList<QByteArray>())  {
-        auto memoryAdaptor = \
QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create(*(domainType.mAdaptor), \
properties); +        auto memoryAdaptor = \
QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create(); +        \
                copyBuffer(*(domainType.mAdaptor), *memoryAdaptor, properties, false, \
                false);
         //mIdentifier internally still refers to the memory-mapped memory, we need \
to copy the memory or it will become invalid  return \
QSharedPointer<DomainType>::create(domainType.mResourceInstanceIdentifier, \
QByteArray(domainType.mIdentifier.constData(), domainType.mIdentifier.size()), \
domainType.mRevision, memoryAdaptor);  }
diff --git a/common/pipeline.cpp b/common/pipeline.cpp
index 7ee4b91..0eb6df5 100644
--- a/common/pipeline.cpp
+++ b/common/pipeline.cpp
@@ -168,7 +168,8 @@ KAsync::Job<qint64> Pipeline::newEntity(void const *command, \
size_t size)  }
 
     auto adaptor = adaptorFactory->createAdaptor(*entity);
-    auto memoryAdaptor = \
QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create(*(adaptor), \
adaptor->availableProperties()); +    auto memoryAdaptor = \
QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create(); +    \
Sink::ApplicationDomain::copyBuffer(*adaptor, *memoryAdaptor);  
     d->revisionChanged = true;
     auto revision = d->entityStore.maxRevision();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic